Appendix A — Import Paths
# Recommended: import everything commonly needed
from decimo.prelude import *
# Brings in: BigInt, BInt, Decimal, BigDecimal, BDec, Decimal128, Dec128,
# BigFloat, BFlt, RoundingMode, ROUND_DOWN, ROUND_HALF_UP,
# ROUND_HALF_EVEN, ROUND_UP, ROUND_CEILING, ROUND_FLOOR
# Or import specific types
from decimo import BInt, BigInt
from decimo import Decimal # also available as BigDecimal or BDec
from decimo import BigFloat, BFlt
from decimo import RoundingMode
# The exact fraction is exported but not in the prelude, which carries the
# four types most programs reach for.
from decimo import Rational
# The MPFR-backed float is in the source but not exported, and carries no
# promise of a stable interface. It also needs its C wrapper linked; see
# `src/decimo/mpf/__init__.mojo`.
from decimo.mpf.mpf import MPF
# Number-theory free functions
from decimo import gcd, lcm, extended_gcd, mod_pow, mod_inverse
# The binary float's own functions live in their modules; the top
# level exports the type and not its functions
from decimo.bigfloat import exp, exp2, exp10, expm1, ln, ln10, log
from decimo.bigfloat import log1p, log2, log10, sqrt
from decimo.bigfloat import power
from decimo.bigfloat import cbrt, root
from decimo.bigfloat import arctan2, hypot
from decimo.bigfloat import ceil, floor, number_class, truncate
from decimo.bigfloat import fma, logb, next_plus, remainder, scaleb
from decimo.bigfloat.trigonometric import cos, sin, tan
# Chinese numerals: the style presets are re-exported at the top level, the
# string-level engine lives in the `decimo.numerals` sub-package
from decimo import ChineseNumeralStyle
from decimo.numerals import (
decimal_string_to_chinese,
MAX_CHINESE_NUMERAL_DIGITS,
)
# Expression engine: `eval` at the top level, the individual stages in the
# `decimo.expression` sub-package
from decimo import eval
from decimo.expression import tokenize, parse_to_rpn, evaluate_rpn
Built from decimo main. This page in the manual.