ESC
No recent searches
Search by
Standard Library  /  Float64

Float64

Utilities for working with the Float64 type.

Edit on GitHub
Added in 0.2.0 No other changes yet.
from "float64" include Float64
5.0d
-5.0d
Infinityd
NaNd

Values

Functions and constants included in the Float64 module.

Float64.infinity

Added in 0.4.0 No other changes yet.
infinity : Float64

Infinity represented as a Float64 value. This is an alternative to the Infinityd literal.

Float64.nan

Added in 0.4.0 No other changes yet.
nan : Float64

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

Float64.pi

Added in 0.5.2 No other changes yet.
pi : Float64

Pi represented as a Float64 value.

Float64.tau

Added in 0.5.2 No other changes yet.
tau : Float64

Tau represented as a Float64 value.

Float64.e

Added in 0.5.2 No other changes yet.
e : Float64

Euler’s number represented as a Float64 value.

Float64.fromNumber

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

Converts a Number to a Float64.

Parameters:

number: The value to convert

Returns:

Float64: The Number represented as a Float64

Float64.toNumber

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

Converts a Float64 to a Number.

Parameters:

float: The value to convert

Returns:

Number: The Float64 represented as a Number

Float64.(+)

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

Computes the sum of its operands.

Parameters:

x: The first operand
y: The second operand

Returns:

Float64: The sum of the two operands

Examples:

use Float64.{ (+) }
assert 1.0d + 1.0d == 2.0d

Float64.(-)

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

Computes the difference of its operands.

Parameters:

x: The first operand
y: The second operand

Returns:

Float64: The difference of the two operands

Examples:

use Float64.{ (-) }
assert 5.0d - 4.0d == 1.0d

Float64.(*)

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

Computes the product of its operands.

Parameters:

x: The first operand
y: The second operand

Returns:

Float64: The product of the two operands

Examples:

use Float64.{ (*) }
assert -5.0d * 4.0d == -20.0d

Float64.(/)

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

Computes the quotient of its operands.

Parameters:

x: The first operand
y: The second operand

Returns:

Float64: The quotient of the two operands

Examples:

use Float64.{ (/) }
assert 25.0d / 4.0d == 6.25d

Float64.(<)

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

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

Parameters:

x: The first value
y: The second value

Returns:

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

Examples:

use Float64.{ (<) }
assert -5.0d < 5.0d

Float64.(>)

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

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

Parameters:

x: The first value
y: The second value

Returns:

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

Examples:

use Float64.{ (>) }
assert 6.0d > 5.0d

Float64.(<=)

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

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

Parameters:

x: The first value
y: The second value

Returns:

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

Examples:

use Float64.{ (<=) }
assert 1.0d <= 2.0d
use Float64.{ (<=) }
assert 2.0d <= 2.0d

Float64.(>=)

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

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

Parameters:

x: The first value
y: The second value

Returns:

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

Examples:

use Float64.{ (>=) }
assert 5.0d >= 2.0d
use Float64.{ (>=) }
assert -1.0d >= -1.0d

Float64.isNaN

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

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

Parameters:

x: The value to check

Returns:

Bool: true if the value is NaN, otherwise false

Examples:

Float64.isNaN(NaNd)
Float64.isNaN(Infinityd) == false
Float64.isNaN(-Infinityd) == false
Float64.isNaN(0.5d) == false
Float64.isNaN(1.0d) == false

Float64.isInfinite

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

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

Parameters:

x: The value to check

Returns:

Bool: true if the value is infinite or false otherwise

Examples:

Float64.isInfinite(Infinityd)
Float64.isInfinite(-Infinityd)
Float64.isInfinite(NaNd) == false
Float64.isInfinite(0.5d) == false
Float64.isInfinite(1.0d) == false

Float64.abs

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

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:

x: The operand

Returns:

Float64: The absolute value of the operand

Examples:

Float64.abs(-1.0d) == 1.0d
Float64.abs(5.0d) == 5.0d

Float64.neg

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

Returns the negation of its operand.

Parameters:

x: The operand

Returns:

Float64: The negated operand

Examples:

Float64.neg(-1.0d) == 1.0d
Float64.neg(1.0d) == -1.0d

Sign up for farm-to-inbox developer news

You can unsubscribe at any time. Read our privacy policy.

Copyright © 2024 The Grain Programming Language