bigdecimal-rs
bigdecimal-rs copied to clipboard
[Possible Bug] - Display panics for large numbers
Is this intentional? I think it'd be an improvement to avoid panics in display, and simply use a different display format for numbers that can't be displayed with the standard implementation.
EG: the following test will panic
#[test]
fn test_big_scale() {
let min: i64 = i64::MIN;
let str = &format!("1E{min}");
BigDecimal::from_str(str).unwrap().to_string();
}
Will panic with "attempt to subtract with overflow"
Same for example for
#[test]
fn test_small_scale() {
let max: i64 = i64::MAX;
let str = &format!("1E{}", max);
BigDecimal::from_str(str).unwrap().to_string();
}