Logo GenPRES

Decimal Module

Parses a decimal from text, rounds a decimal to significant digits and formats a decimal as a Dutch number.

Functions and values

Function or value Description

Decimal.Ten

Full Usage: Decimal.Ten

Returns: decimal
Returns: decimal

Decimal.fixPrecision n d

Full Usage: Decimal.fixPrecision n d

Parameters:
    n : int
    d : decimal

Returns: decimal

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
d : decimal
Returns: decimal

Decimal.getPrecision n d

Full Usage: Decimal.getPrecision n d

Parameters:
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
d : Decimal
Returns: int

Decimal.parse s

Full Usage: Decimal.parse s

Parameters:
    s : string

Returns: decimal

Get the double value of a string using InvariantCulture

s : string
Returns: decimal

Decimal.roundingDecimals n d

Full Usage: Decimal.roundingDecimals n d

Parameters:
    n : int
    d : decimal

Returns: int

Returns the number of decimals that d is rounded to for n significant digits. The number is at most 28, because Math.Round takes at most 28 decimals for a decimal.

n : int
d : decimal
Returns: int

Decimal.toStringNumberNL p d

Full Usage: Decimal.toStringNumberNL p d

Parameters:
    p : string
    d : decimal

Returns: string

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

p : string
d : decimal
Returns: string

Decimal.toStringNumberNLWithoutTrailingZeros d

Full Usage: Decimal.toStringNumberNLWithoutTrailingZeros d

Parameters:
    d : decimal

Returns: string

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

d : decimal
Returns: string

Decimal.toStringNumberNLWithoutTrailingZerosFixPrecision n d

Full Usage: Decimal.toStringNumberNLWithoutTrailingZerosFixPrecision n d

Parameters:
    n : int
    d : decimal

Returns: string

Formats d as a Dutch number with at least n significant digits and without trailing zeros. A negative n prints the number in full, without rounding. Example: 0.0666m with n = 2 gives "0,067".

n : int
d : decimal
Returns: string

Decimal.tryParse s

Full Usage: Decimal.tryParse s

Parameters:
    s : string

Returns: decimal option

Get a float Option from a string

s : string
Returns: decimal option

Type something to start searching.