You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use rust_decimal::prelude::*;fnmain(){Decimal::ZERO.ln();}
thread 'main' panicked at 'Division by zero', /Users/rollen/.cargo/registry/src/github.com-1ecc6299db9ec823/rust_decimal-1.14.2/src/decimal.rs:1972:45
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Of course taking the log of zero should yield some sort of error, but so should taking the log of negative numbers most likely, and for those the result is set to zero.
Decimal::new(-1,0).ln() == Decimal::ZERO//true
The easiest fix might be to extend the predicate on this line to also check for *self != Decimal::ZERO
MWE:
Of course taking the log of zero should yield some sort of error, but so should taking the log of negative numbers most likely, and for those the result is set to zero.
The easiest fix might be to extend the predicate on this line to also check for
*self != Decimal::ZERO
rust-decimal/src/maths.rs
Line 328 in e346c59
The text was updated successfully, but these errors were encountered: