Skip to content
Playground(another site)

bynk.types.unknown_rounding_mode

Error A Decimal round or div was not given a rounding mode written RoundingMode.<mode>; the modes are Down, Up, Floor, Ceiling, HalfUp, HalfDown and HalfEven (#2622).

Decimal's round and div must be told how to break a tie, and the choice is part of the money arithmetic, so it is named, not defaulted: write RoundingMode.<mode> as the last argument, where the mode is one of Down, Up, Floor, Ceiling, HalfUp, HalfDown or HalfEven. A number, a string or a variable is refused. A mode kept in a binding is bynk.types.rounding_mode_position.

Example

price.round(2, 1) // ✗ not a rounding mode
price.round(2, RoundingMode.HalfEven) // ✓

In the Book

See also

  • Every code in its category, Type checking, on the diagnostic index.
  • bynk explain bynk.types.unknown_rounding_mode shows the same from the installed toolchain, without a network.