Float32

GitHub   Edit on GitHub

Utilities for working with the Float32 type.

Added in 0.2.0 No other changes yet.
1
from "float32" include Float32
1
4.0f
1
-4.0f
1
Infinityf
1
NaNf

Values

Functions and constants included in the Float32 module.

Float32.infinity

Added in 0.4.0 No other changes yet.
1
infinity : Float32

Infinity represented as a Float32 value. This is an alternative to the Infinityf literal.

Float32.nan

Added in 0.4.0 No other changes yet.
1
nan : Float32

NaN (Not a Number) represented as a Float32 value. This is an alternative to the NaNf literal.

Float32.pi

Added in 0.5.2 No other changes yet.
1
pi : Float32

Pi represented as a Float32 value.

Float32.tau

Added in 0.5.2 No other changes yet.
1
tau : Float32

Tau represented as a Float32 value.

Float32.e

Added in 0.5.2 No other changes yet.
1
e : Float32

Euler’s number represented as a Float32 value.

Float32.fromNumber

Added in 0.2.0 No other changes yet.
1
fromNumber : (number: Number) => Float32

Converts a Number to a Float32.

Parameters:

param type description
number Number The value to convert

Returns:

type description
Float32 The Number represented as a Float32

Float32.toNumber

Added in 0.2.0 No other changes yet.
1
toNumber : (float: Float32) => Number

Converts a Float32 to a Number.

Parameters:

param type description
float Float32 The value to convert

Returns:

type description
Number The Float32 represented as a Number

Float32.(+)

Added in 0.6.0
versionchanges
0.2.0Originally named `add`
1
(+) : (x: Float32, y: Float32) => Float32

Computes the sum of its operands.

Parameters:

param type description
x Float32 The first operand
y Float32 The second operand

Returns:

type description
Float32 The sum of the two operands

Examples:

1
2
use Float32.{ (+) }
assert 1.0f + 1.0f == 2.0f

Float32.(-)

Added in 0.6.0
versionchanges
0.2.0Originally named `sub`
1
(-) : (x: Float32, y: Float32) => Float32

Computes the difference of its operands.

Parameters:

param type description
x Float32 The first operand
y Float32 The second operand

Returns:

type description
Float32 The difference of the two operands

Examples:

1
2
use Float32.{ (-) }
assert 1.0f - 1.0f == 0.0f

Float32.(*)

Added in 0.6.0
versionchanges
0.2.0Originally named `mul`
1
(*) : (x: Float32, y: Float32) => Float32

Computes the product of its operands.

Parameters:

param type description
x Float32 The first operand
y Float32 The second operand

Returns:

type description
Float32 The product of the two operands

Examples:

1
2
use Float32.{ (*) }
assert 2.0f * 2.0f == 4.0f

Float32.(/)

Added in 0.6.0
versionchanges
0.2.0Originally named `div`
1
(/) : (x: Float32, y: Float32) => Float32

Computes the quotient of its operands.

Parameters:

param type description
x Float32 The first operand
y Float32 The second operand

Returns:

type description
Float32 The quotient of the two operands

Examples:

1
2
use Float32.{ (/) }
assert 10.0f / 4.0f == 2.5f

Float32.(<)

Added in 0.6.0
versionchanges
0.2.0Originally named `lt`
1
(<) : (x: Float32, y: Float32) => Bool

Checks if the first value is less than the second value.

Parameters:

param type description
x Float32 The first value
y Float32 The second value

Returns:

type description
Bool true if the first value is less than the second value or false otherwise

Examples:

1
2
use Float32.{ (<) }
assert 1.0f < 2.0f

Float32.(>)

Added in 0.6.0
versionchanges
0.2.0Originally named `gt`
1
(>) : (x: Float32, y: Float32) => Bool

Checks if the first value is greater than the second value.

Parameters:

param type description
x Float32 The first value
y Float32 The second value

Returns:

type description
Bool true if the first value is greater than the second value or false otherwise

Examples:

1
2
use Float32.{ (>) }
assert 2.0f > 1.0f

Float32.(<=)

Added in 0.6.0
versionchanges
0.2.0Originally named `lte`
1
(<=) : (x: Float32, y: Float32) => Bool

Checks if the first value is less than or equal to the second value.

Parameters:

param type description
x Float32 The first value
y Float32 The second value

Returns:

type description
Bool true if the first value is less than or equal to the second value or false otherwise

Examples:

1
2
use Float32.{ (<=) }
assert -1.0f <= 1.0f
1
2
use Float32.{ (<=) }
assert -2.0f <= -2.0f

Float32.(>=)

Added in 0.6.0
versionchanges
0.2.0Originally named `gte`
1
(>=) : (x: Float32, y: Float32) => Bool

Checks if the first value is greater than or equal to the second value.

Parameters:

param type description
x Float32 The first value
y Float32 The second value

Returns:

type description
Bool true if the first value is greater than or equal to the second value or false otherwise

Examples:

1
2
use Float32.{ (>=) }
assert 4.0f >= 1.0f
1
2
use Float32.{ (>=) }
assert 3.0f >= 3.0f
This is a notification!