Prevent exp underflow.
This commit is contained in:
parent
d07d4d295d
commit
98a232cb8c
@ -319,6 +319,8 @@ mod decimal_functions {
|
|||||||
if cfg!(not(feature = "unchecked")) {
|
if cfg!(not(feature = "unchecked")) {
|
||||||
if x > Decimal::from_parts(117578, 0, 0, false, 4) {
|
if x > Decimal::from_parts(117578, 0, 0, false, 4) {
|
||||||
Err(make_err(format!("Exponential overflow: e ** {}", x,)))
|
Err(make_err(format!("Exponential overflow: e ** {}", x,)))
|
||||||
|
} else if x < Decimal::from_parts(8, 0, 0, true, 0) {
|
||||||
|
Err(make_err(format!("Exponential underflow: e ** {}", x,)))
|
||||||
} else {
|
} else {
|
||||||
Ok(x.exp())
|
Ok(x.exp())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user