RoundingMode.Up

Updated on

RoundingMode.Up (0) 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 up.

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 upward, since it is exactly half.

= Number.Round( 9.5555, 3, 0 )               // Returns 9.556
= Number.Round( 9.5555, 3, RoundingMode.Up ) // Returns 9.556
= Number.Round( 9.5554, 3, RoundingMode.Up ) // 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.6658, 2, RoundingMode.Up ) // Returns 9.67

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

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

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

= Number.Round( 9.5,       RoundingMode.Up ) // Returns 10
= Byte.From(    9.5, null, RoundingMode.Up ) // Returns 10
= Int8.From(    9.5, null, RoundingMode.Up ) // Returns 10
= Int16.From(   9.5, null, RoundingMode.Up ) // Returns 10
= Int32.From(   9.5, null, RoundingMode.Up ) // Returns 10
= Int64.From(   9.5, null, RoundingMode.Up ) // Returns 10


= Currency.From( 9.665812345, null, RoundingMode.Up ) // Returns 9.6658

Other related enumerations are:

Applies to

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

BI Gorilla Youtube Channel

Contribute » | Contributors: Rick de Groot