Logo GenPRES

Double Module

Parses a float from text, checks whether a float is valid, rounds a float to significant digits, converts a float to a fraction and formats a float as a Dutch number.

Functions and values

Function or value Description

Double.fixPrecision n f

Full Usage: Double.fixPrecision n f

Parameters:
    n : int
    f : float

Returns: float

Fix the precision of a float f to match a minimum of non zero digits n * 66.666 |> fixPrecision 1 = 67 * 6.6666 |> fixPrecision 1 = 7 * 0.6666 |> fixPrecision 1 = 0.7 * 0.0666 |> fixPrecision 1 = 0.07 * 0.0666 |> fixPrecision 1 = 0.07 * 0.0666 |> fixPrecision 2 = 0.067 * 0.0666 |> fixPrecision 3 = 0.0666 * 6.6666 |> fixPrecision 1 = 7 * 6.6666 |> fixPrecision 2 = 6.7 * 6.6666 |> fixPrecision 3 = 6.67 etc If n < 0 then the value is not changed.

n : int
f : float
Returns: float

Double.floatHasDecimals v

Full Usage: Double.floatHasDecimals v

Parameters:
    v : float

Returns: bool

Check whether a float has any decimal digits

v : float
Returns: bool

Double.floatToFract v

Full Usage: Double.floatToFract v

Parameters:
    v : float

Returns: (BigInteger * BigInteger) option

Return a float as a fraction of two BigIntegers

v : float
Returns: (BigInteger * BigInteger) option

Double.getPrecision n f

Full Usage: Double.getPrecision n f

Parameters:
    n : int
    f : float

Returns: int

Calculates the number of decimal digits that should be shown according to a precision number n that specifies the number of non zero digits in the decimals. * 66.666 |> getPrecision 1 = 0 * 6.6666 |> getPrecision 1 = 0 * 0.6666 |> getPrecision 1 = 1 * 0.0666 |> getPrecision 1 = 2 * 0.0666 |> getPrecision 0 = 0 * 0.0666 |> getPrecision 1 = 2 * 0.0666 |> getPrecision 2 = 3 * 0.0666 |> getPrecision 3 = 4 * 6.6666 |> getPrecision 0 = 0 * 6.6666 |> getPrecision 1 = 0 * 6.6666 |> getPrecision 2 = 1 * 6.6666 |> getPrecision 3 = 2 etc If n < 0 then n = 0 is used.

n : int
f : float
Returns: int

Double.isInfinity n

Full Usage: Double.isInfinity n

Parameters:
    n : float

Returns: bool

Check whether a Double is positive or negative infinity

n : float
Returns: bool

Double.isNaN d

Full Usage: Double.isNaN d

Parameters:
    d : float

Returns: bool

Check whether a Double is a NaN value

d : float
Returns: bool

Double.isValid n

Full Usage: Double.isValid n

Parameters:
    n : float

Returns: bool

Check whether a Double is valid

n : float
Returns: bool

Double.parse s

Full Usage: Double.parse s

Parameters:
    s : string

Returns: float

Get the double value of a string using InvariantCulture

s : string
Returns: float

Double.roundingDecimals n f

Full Usage: Double.roundingDecimals n f

Parameters:
    n : int
    f : float

Returns: int

Returns the number of decimals that f is rounded to for n significant digits. The number is at most 15, because Math.Round takes at most 15 decimals for a float.

n : int
f : float
Returns: int

Double.stringToFloat32 s

Full Usage: Double.stringToFloat32 s

Parameters:
    s : string

Returns: float32

Get a float32 from a string returns a 0 value when the string cannot be parsed

s : string
Returns: float32

Double.toStringNumberNL p n

Full Usage: Double.toStringNumberNL p n

Parameters:
    p : string
    n : float

Returns: string

Returns a string representation of a float in Dutch format, with a decimal comma and a narrow no-break space between the thousands.

p : string
n : float
Returns: string

Double.toStringNumberNLWithoutTrailingZeros f

Full Usage: Double.toStringNumberNLWithoutTrailingZeros f

Parameters:
    f : float

Returns: string

Formats f as a Dutch number with at least 3 significant digits and without trailing zeros.

f : float
Returns: string

Double.toStringNumberNLWithoutTrailingZerosFixPrecision n f

Full Usage: Double.toStringNumberNLWithoutTrailingZerosFixPrecision n f

Parameters:
    n : int
    f : float

Returns: string

Formats f as a Dutch number with at least n significant digits and without trailing zeros. A negative n counts as 15, the most significant digits that a float holds exactly. Example: 0.0666 with n = 2 gives "0,067".

n : int
f : float
Returns: string

Double.tryParse s

Full Usage: Double.tryParse s

Parameters:
    s : string

Returns: float option

Get the finite float a string holds, read with the float number style and the invariant culture: none for a decimal comma, a thousands separator, a currency sign, parentheses, not a number, an infinity or an overflow. Spaces around the number are allowed.

s : string
Returns: float option

Type something to start searching.