Rounding modes
Rounding modes specify how numerical currency values are handled by Smile. Rounding a numerical value means replacing it by another value that is approximately equal but, has a shorter, simpler or more explicit representation. For example, the value $23.4476 is rounded up to two decimal places, resulting in the value $23.45.
- Half Up (default)
- Rounds towards the “nearest neighbour” unless both neighbours are equidistant, in which case, this mode rounds up to the next larger absolute value, away from zero. This rounding method behaves the same as the Up rounding method if the discarded fraction (decimal point) is >= 0.5. Otherwise this rounding method behaves the same as the Down rounding method.
- Half Down
- Rounds towards the “nearest neighbour” unless both neighbours are equidistant, in which case this mode rounds down to the next smaller absolute value, towards zero. This rounding mode behaves the same as the Up rounding mode if the discarded fraction (decimal point) is > 0.5. Otherwise it behaves the same as Down rounding mode.
- Half Even
- Rounds towards the “nearest neighbour” unless both neighbours are equidistant, in which case, this mode rounds towards the even neighbor. This rounding mode behaves the same as the Half Up rounding mode if the digit to the left of the discarded fraction (decimal point) is odd. It behaves the same as the Half Down rounding method if it is even.
- Up
- Rounds away from zero to the next greater absolute value. This rounding mode never decreases the magnitude of the calculated value.
- Down
- Rounds towards zero to the next smaller absolute value. This rounding mode never increases the magnitude of the calculated value.
- Ceiling
- Rounds towards positive infinity. If the result is positive, this mode behaves the same as the Up rounding mode. If the result is negative, it behaves the same as the Down rounding mode. This rounding mode never decreases the calculated value.
- Floor
- Rounds towards negative infinity. If the result is positive, this mode behaves the same as the Down rounding mode. If negative, this mode behaves the same as the Up rounding mode. This rounding mode never increases the calculated value.