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

Float32.isNaN

Added in 0.6.5 No other changes yet.
1
isNaN : (x: Float32) => Bool

Checks if the value is a float NaN value (Not A Number).

Parameters:

param type description
x Float32 The value to check

Returns:

type description
Bool true if the value is NaN, otherwise false

Examples:

1
Float32.isNaN(NaNf)
1
Float32.isNaN(Infinityf) == false
1
Float32.isNaN(-Infinityf) == false
1
Float32.isNaN(0.5f) == false
1
Float32.isNaN(1.0f) == false

Float32.isInfinite

Added in 0.6.5 No other changes yet.
1
isInfinite : (x: Float32) => Bool

Checks if a float is infinite, that is either of positive or negative infinity.

Parameters:

param type description
x Float32 The value to check

Returns:

type description
Bool true if the value is infinite or false otherwise

Examples:

1
Float32.isInfinite(Infinityf)
1
Float32.isInfinite(-Infinityf)
1
Float32.isInfinite(NaNf) == false
1
Float32.isInfinite(0.5f) == false
1
Float32.isInfinite(1.0f) == false

Float32.abs

Added in 0.6.5 No other changes yet.
1
abs : (x: Float32) => Float32

Returns the absolute value. That is, it returns x if x is positive or zero and the negation of x if x is negative.

Parameters:

param type description
x Float32 The operand

Returns:

type description
Float32 The absolute value of the operand

Examples:

1
Float32.abs(-1.0f) == 1.0f
1
Float32.abs(5.0f) == 5.0f

Float32.neg

Added in 0.6.5 No other changes yet.
1
neg : (x: Float32) => Float32

Returns the negation of its operand.

Parameters:

param type description
x Float32 The operand

Returns:

type description
Float32 The negated operand

Examples:

1
Float32.neg(-1.0f) == 1.0f
1
Float32.neg(1.0f) == -1.0f
This is a notification!