Float32
Utilities for working with the Float32 type.
Edit on GitHubAdded in 0.2.0
No other changes yet.
from "float32" include Float32
4.0f
-4.0f
Infinityf
NaNf
Functions and constants included in the Float32 module.
Added in 0.4.0
No other changes yet.
infinity : Float32
Infinity represented as a Float32 value.
This is an alternative to the Infinityf literal.
Added in 0.4.0
No other changes yet.
nan : Float32
NaN (Not a Number) represented as a Float32 value.
This is an alternative to the NaNf literal.
Added in 0.5.2
No other changes yet.
pi : Float32
Pi represented as a Float32 value.
Added in 0.5.2
No other changes yet.
tau : Float32
Tau represented as a Float32 value.
Added in 0.5.2
No other changes yet.
e : Float32
Euler’s number represented as a Float32 value.
Added in 0.2.0
No other changes yet.
fromNumber : (number: Number) => Float32
Converts a Number to a Float32.
Parameters:
| param | type | description |
|---|---|---|
number | Number | The value to convert |
number: The value to convertReturns:
| type | description |
|---|---|
Float32 | The Number represented as a Float32 |
Float32: The Number represented as a Float32Added in 0.2.0
No other changes yet.
toNumber : (float: Float32) => Number
Converts a Float32 to a Number.
Parameters:
| param | type | description |
|---|---|---|
float | Float32 | The value to convert |
float: The value to convertReturns:
| type | description |
|---|---|
Number | The Float32 represented as a Number |
Number: The Float32 represented as a NumberAdded in 0.6.0
| version | changes |
|---|---|
0.2.0 | Originally named `add` |
(+) : (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 |
x: The first operandy: The second operandReturns:
| type | description |
|---|---|
Float32 | The sum of the two operands |
Float32: The sum of the two operandsExamples:
use Float32.{ (+) }
assert 1.0f + 1.0f == 2.0f
Added in 0.6.0
| version | changes |
|---|---|
0.2.0 | Originally named `sub` |
(-) : (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 |
x: The first operandy: The second operandReturns:
| type | description |
|---|---|
Float32 | The difference of the two operands |
Float32: The difference of the two operandsExamples:
use Float32.{ (-) }
assert 1.0f - 1.0f == 0.0f
Added in 0.6.0
| version | changes |
|---|---|
0.2.0 | Originally named `mul` |
(*) : (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 |
x: The first operandy: The second operandReturns:
| type | description |
|---|---|
Float32 | The product of the two operands |
Float32: The product of the two operandsExamples:
use Float32.{ (*) }
assert 2.0f * 2.0f == 4.0f
Added in 0.6.0
| version | changes |
|---|---|
0.2.0 | Originally named `div` |
(/) : (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 |
x: The first operandy: The second operandReturns:
| type | description |
|---|---|
Float32 | The quotient of the two operands |
Float32: The quotient of the two operandsExamples:
use Float32.{ (/) }
assert 10.0f / 4.0f == 2.5f
Added in 0.6.0
| version | changes |
|---|---|
0.2.0 | Originally named `lt` |
(<) : (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 |
x: The first valuey: The second valueReturns:
| type | description |
|---|---|
Bool | true if the first value is less than the second value or false otherwise |
Bool: true if the first value is less than the second value or false otherwiseExamples:
use Float32.{ (<) }
assert 1.0f < 2.0f
Added in 0.6.0
| version | changes |
|---|---|
0.2.0 | Originally named `gt` |
(>) : (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 |
x: The first valuey: The second valueReturns:
| type | description |
|---|---|
Bool | true if the first value is greater than the second value or false otherwise |
Bool: true if the first value is greater than the second value or false otherwiseExamples:
use Float32.{ (>) }
assert 2.0f > 1.0f
Added in 0.6.0
| version | changes |
|---|---|
0.2.0 | Originally named `lte` |
(<=) : (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 |
x: The first valuey: The second valueReturns:
| type | description |
|---|---|
Bool | true if the first value is less than or equal to the second value or false otherwise |
Bool: true if the first value is less than or equal to the second value or false otherwiseExamples:
use Float32.{ (<=) }
assert -1.0f <= 1.0f
use Float32.{ (<=) }
assert -2.0f <= -2.0f
Added in 0.6.0
| version | changes |
|---|---|
0.2.0 | Originally named `gte` |
(>=) : (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 |
x: The first valuey: The second valueReturns:
| type | description |
|---|---|
Bool | true if the first value is greater than or equal to the second value or false otherwise |
Bool: true if the first value is greater than or equal to the second value or false otherwiseExamples:
use Float32.{ (>=) }
assert 4.0f >= 1.0f
use Float32.{ (>=) }
assert 3.0f >= 3.0f
Added in 0.6.5
No other changes yet.
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 |
x: The value to checkReturns:
| type | description |
|---|---|
Bool | true if the value is NaN, otherwise false |
Bool: true if the value is NaN, otherwise falseExamples:
Float32.isNaN(NaNf)
Float32.isNaN(Infinityf) == false
Float32.isNaN(-Infinityf) == false
Float32.isNaN(0.5f) == false
Float32.isNaN(1.0f) == false
Added in 0.6.5
No other changes yet.
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 |
x: The value to checkReturns:
| type | description |
|---|---|
Bool | true if the value is infinite or false otherwise |
Bool: true if the value is infinite or false otherwiseExamples:
Float32.isInfinite(Infinityf)
Float32.isInfinite(-Infinityf)
Float32.isInfinite(NaNf) == false
Float32.isInfinite(0.5f) == false
Float32.isInfinite(1.0f) == false
Added in 0.6.5
No other changes yet.
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 |
x: The operandReturns:
| type | description |
|---|---|
Float32 | The absolute value of the operand |
Float32: The absolute value of the operandExamples:
Float32.abs(-1.0f) == 1.0f
Float32.abs(5.0f) == 5.0f
Added in 0.6.5
No other changes yet.
neg : (x: Float32) => Float32
Returns the negation of its operand.
Parameters:
| param | type | description |
|---|---|---|
x | Float32 | The operand |
x: The operandReturns:
| type | description |
|---|---|
Float32 | The negated operand |
Float32: The negated operandExamples:
Float32.neg(-1.0f) == 1.0f
Float32.neg(1.0f) == -1.0f