Logo GenPRES

Decimal Module

Rounds a decimal to a number of significant digits and formats a decimal as a Dutch number with a decimal comma.

Functions and values

Function or value Description

Decimal.fixPrecision n d

Full Usage: Decimal.fixPrecision n d

Parameters:
    n : int
    d : decimal

Returns: decimal

Rounds d to the number of decimals that shows at least n significant digits. For example, 0.0666m |> fixPrecision 2 = 0.067m and 6.6666m |> fixPrecision 2 = 6.7m. Returns d unchanged when n is negative.

n : int
d : decimal
Returns: decimal

Decimal.getPrecision n d

Full Usage: Decimal.getPrecision n d

Parameters:
Returns: int

Returns the number of decimals that shows d with at least n significant digits. For example, 0.0666m |> getPrecision 2 = 3 and 6.6666m |> getPrecision 2 = 1. A negative n counts as 0. Returns n when d is zero.

n : int
d : Decimal
Returns: int

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

Formats d as a Dutch number: a narrow no-break space between the thousands and a decimal comma. The text p gives the number of decimals; an empty p gives the default of the F format, two in .NET.

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

Type something to start searching.