Rounding Service

Socotra will sometimes round fractional values to a certain precision level, such as when required to confirm to precision levels specified in Data Extensions. When it does this, it will use the rounding method specified in the tenant configuration.

Each data extension property can be configured with a different rounding mode with its roundingMode property. If no method is specified for a property, the system will use halfEven.

Each of the following rounding modes are available:

  • halfEven: Rounds towards the “nearest neighbor” unless both neighbors are equidistant, in which case, rounds towards the even neighbor. This is the default.

  • ceiling: Rounds towards positive infinity.

  • down: Rounds towards zero.

  • floor: Rounds towards negative infinity.

  • halfDown: Rounds towards the “nearest neighbor” unless both neighbors are equidistant, in which case rounds down.

  • halfUp: Rounds towards the “nearest neighbor” unless both neighbors are equidistant, in which case rounds up.

  • up: Rounds away from zero.