RoundingMode.Down

Updated on

RoundingMode.Down (1) is an enumeration that specifies rounding direction when there is a tie between the possible numbers to round to. It is a member of the RoundingMode.Type and indicates rounding down.

Examples

Below examples round the main value to 3 decimals. The value 9.5555 has four decimals and needs to get rid of one. RoundMode.Up makes sure that the rounding of the 4th decimals happens downward, since it is exactly half.

= Number.Round( 9.5555, 3, 1 )                 // Returns 9.555
= Number.Round( 9.5555, 3, RoundingMode.Down ) // Returns 9.555
= Number.Round( 9.5554, 3, RoundingMode.Down ) // Returns 9.555

When the decimal to round is higher than half, it is also rounded up to the closest numbers that’s higher.

= Number.Round( 9.6650, 2, RoundingMode.Down ) // Returns 9.65

Note that when Number having fewer decimals than instructed by the rounding, the entire value is returned unrounded.

= Number.Round( 9.55, 3, RoundingMode.Down ) // Returns 9.55

You can find an example for all functions supporting the RoundingMode.Type below.

= Number.Round( 9.5, 0,    RoundingMode.Down ) // Returns 9
= Byte.From(    9.5, null, RoundingMode.Down ) // Returns 9
= Int8.From(    9.5, null, RoundingMode.Down ) // Returns 9
= Int16.From(   9.5, null, RoundingMode.Down ) // Returns 9
= Int32.From(   9.5, null, RoundingMode.Down ) // Returns 9
= Int64.From(   9.5, null, RoundingMode.Down ) // Returns 9

// Functions returns a maximum of 4 decimals
= Currency.From( 9.665412345, null, RoundingMode.Down ) // Returns 9.6654
= Currency.From( 9.665,       null, RoundingMode.Down ) // Returns 9.665

Other related enumerations are:

Applies to

Here’s a list of functions that work with RoundingMode.Type:

Contribute » | Contributors: Rick de Groot