sundaysebasidian-byte/moonbean/decimal does not have a README file

    Decimal

    pub(all) struct Decimal {
    mantissa :
    BigInt

    scale : Int
    }

    Decimal::abs

    fn Decimal::abs(self : Decimal) -> Decimal

    Decimal::add

    fn Decimal::add(a : Decimal, b : Decimal) -> Decimal

    Decimal::compare

    fn Decimal::compare(a : Decimal, b : Decimal) -> Int

    Decimal::div

    fn Decimal::div(a : Decimal, b : Decimal) -> Decimal?

    Decimal division following Python's decimal semantics at precision 28: exact results keep at least the "ideal" exponent, inexact results are rounded to 28 significant digits with ROUND_HALF_EVEN.

    Decimal::equal

    fn Decimal::equal(a : Decimal, b : Decimal) -> Bool

    Decimal::from_int

    fn Decimal::from_int(value : Int) -> Decimal

    Decimal::from_int64

    fn Decimal::from_int64(value : Int64) -> Decimal

    Decimal::has_fractional_digits

    fn Decimal::has_fractional_digits(self : Decimal) -> Bool

    True when the literal carries fractional digits (Beancount only infers a tolerance from numbers with a fractional part).

    Decimal::is_negative

    fn Decimal::is_negative(self : Decimal) -> Bool

    Decimal::is_positive

    fn Decimal::is_positive(self : Decimal) -> Bool

    Decimal::is_zero

    fn Decimal::is_zero(self : Decimal) -> Bool

    Decimal::last_digit_place

    fn Decimal::last_digit_place(self : Decimal) -> Decimal

    Returns 10^-scale, i.e. the value of the least significant digit.

    Decimal::less_equal

    fn Decimal::less_equal(a : Decimal, b : Decimal) -> Bool

    Decimal::less_than

    fn Decimal::less_than(a : Decimal, b : Decimal) -> Bool

    Decimal::mantissa

    Decimal::mul

    fn Decimal::mul(a : Decimal, b : Decimal) -> Decimal

    Decimal::neg

    fn Decimal::neg(self : Decimal) -> Decimal

    Decimal::new

    fn Decimal::new(mantissa :
    BigInt
    , scale : Int) -> Decimal

    Decimal::one

    fn Decimal::one() -> Decimal

    Decimal::parse

    fn Decimal::parse(input : String) -> Decimal?

    Parses a plain decimal literal: optional sign, digits, optional fraction. Thousands separators (commas between digits) are accepted. Exponents are intentionally rejected; Beancount numbers are written in plain notation.

    Decimal::quantize

    fn Decimal::quantize(self : Decimal, target_scale : Int) -> Decimal

    Rounds to the nearest value with the requested scale, ties to even.

    Decimal::round_to_integer

    fn Decimal::round_to_integer(self : Decimal) -> Decimal

    Decimal::round_to_significant

    fn Decimal::round_to_significant(self : Decimal, digits : Int) -> Decimal

    Rounds to digits significant digits, ties to even.

    Decimal::scale

    fn Decimal::scale(self : Decimal) -> Int

    Decimal::shift_scale

    fn Decimal::shift_scale(self : Decimal, k : Int) -> Decimal

    Multiplies the value by 10^k, preserving the represented value.

    Decimal::signum

    fn Decimal::signum(self : Decimal) -> Int

    Decimal::sub

    fn Decimal::sub(a : Decimal, b : Decimal) -> Decimal

    Decimal::to_display

    fn Decimal::to_display(self : Decimal, min_scale? : Int) -> String

    Human oriented formatting: trims trailing zeros but keeps at least min_scale fractional digits.

    Decimal::to_string

    fn Decimal::to_string(self : Decimal) -> String

    Decimal::zero

    fn Decimal::zero() -> Decimal

    Decimal::zero_scaled

    fn Decimal::zero_scaled(scale : Int) -> Decimal

    Source Files

    Powered by MoonBit

    Site sourceReport issueModulesSkillsBuild queueStatistics

    © 2026 mooncakes.io