Skip to main content
Version: 1.12.1

MathContext

Indicates the scale, precision and rounding mode for math operations.

Note: the default context is { precision: 28 } and this cannot currently be set globally, so a context should be provided on each operation.

Syntax

object {
  scale?,
  precision?
  round?
}

Properties

  • scale?: number
    • Number of decimal digits to preserve in the result.
  • precision?: number
    • Number of total digits (integer and decimal) to preserve in the result.
  • round?: RoundingModeType
    • Rounding mode to use, defaults to 'half-even'

References