Module precision

Module precision 

Source
Expand description

Financial-grade precision calculation utilities.

Provides high-precision numerical operations for financial calculations:

  • Rounding modes (Round, RoundUp, RoundDown)
  • Precision counting modes (DecimalPlaces, SignificantDigits, TickSize)
  • Number formatting and parsing
  • Decimal type helper functions

Enums§

CountingMode
Precision counting mode.
PaddingMode
Output padding mode.
RoundingMode
Rounding mode for precision calculations.

Functions§

decimal_to_precision
Formats a decimal to a specific precision with configurable rounding and counting modes.
number_to_string
Converts a decimal number to string, handling scientific notation.
precision_from_string
Extracts precision (number of decimal places) from a string representation.
truncate
Truncates a decimal to the specified number of decimal places, returning a Decimal.
truncate_to_string
Truncates a decimal to the specified number of decimal places without rounding.