Skip to content

v0.4.2

Compare
Choose a tag to compare
@akubera akubera released this 16 Oct 07:44
· 77 commits to trunk since this release

Changes

  • Add Context struct

    • For user-controlled precision and rounding
    • Support for a few BigDecimal functions added (eg: sqrt_with_context(&self, ctx: &Context)) , more to come in future versions.
    • Note standard operations use default (compile-time-defined) context
  • Add BigDecimalRef struct

    • Non-owning BigDecimal struct that has some non-digit-changing methods (i.e. change sign/scale without copying digits) for more efficient calculations
    • Implements math operations Add,Sub
    • Implement From<&BigInt> for BigDecimalRef
  • Compile-time default rounding mode may be set by environment variable RUST_BIGDECIMAL_DEFAULT_ROUNDING_MODE

  • Fix issue recompiling if RUST_BIGDECIMAL_DEFAULT_PRECISION haddn't changed

  • Add BigDecimal::with_precision_round()

    • trim the bigdecimal after operations, rounding at given point
  • Add BigDecimal::fractional_digit_count()

    • Return's the bigdecimal's "scale", (number of digits right of the decimal point)
  • Support reading subnormal floating-point numbers

  • Improve initial "guess" in calculation of inverted value.

  • Fix panic in from_str_radix (#115)

  • (internal) Reorganize std::ops implementations by moving each to separate functions (src/impl_ops_add.rs, src/impl_ops_sub.rs, etc)

Performance Improvements

  • BigDecimal::eq takes into account trailing zeros, avoids aligning digits
  • (internal) ten_to_the - used everywhere to align BigIntegers within BigDecimals, all operations with high precision numbers should be faster