Skip to main content

DB_Column.round

rounddecimal_placesuse_bankers

Group: Math

Documentation

Round to a specified number of decimal places. round is only valid for Value_Type.Decimal, Value_Type.Float, and Value_Type.Integer columns. By default, rounding uses "symmetric round-half-up", also known as "round towards 0." If use_bankers=True, then it uses "round-half-even", also known as "banker's rounding". The return type depends on the backend.

Arguments

  • decimal_places: The number of decimal places to round to. Can be negative, which results in rounding to positive integer powers of 10. Must be between -15 and 15 (inclusive).
  • use_bankers: Rounds mid-point to nearest even number.

Examples

Round a column to two decimal places.

      import Standard.Examples

example_round = Examples.decimal_column.round 2

Errors

If decimal_places is outside the range -15..15 (inclusive), an Illegal_Argument error is thrown.

Remarks

NaN/Inf

If a NaN or Inf value is passed to round, it immediately returns the same value.

Negative decimal place counts

Rounding to n digits can be thought of as "rounding to the nearest multiple of 10^(-n)". For negative decimal counts, this results in rounding to the nearest positive integer power of 10.