bigdecimal-rs icon indicating copy to clipboard operation
bigdecimal-rs copied to clipboard

Regression: scientific notation in `BigDecimal::to_string()`

Open findepi opened this issue 1 year ago • 7 comments

to_scientific_notation() is supposed to produce scientific notation, to_string() used to (and IMO should continue) to produce decimal form without scientific notation.

The following test

#[test]
fn test() {
    let big_decimal = BigDecimal::from_str("0.00000000000000000000000000000000000001").unwrap()
        .normalized();
    assert_eq!(big_decimal.to_string(), "0.00000000000000000000000000000000000001");
}

Used to pass with v 0.4.2 and no longer passes with 0.4.3:

assertion `left == right` failed
  left: "1E-38"
 right: "0.00000000000000000000000000000000000001"

findepi avatar Sep 25 '24 15:09 findepi