Skip to content

Commit 42a0b22

Browse files
committed
Overflow
1 parent 295a195 commit 42a0b22

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/math/log.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ pub fn log(mut x: f64) -> f64 {
133133

134134
fn cr_log(x: f64) -> f64 {
135135
let mut v = x.to_bits();
136-
let mut e: i32 = ((v >> 52) - 0x3ff) as i32;
136+
let mut e: i32 = (v >> 52).wrapping_sub(0x3ff) as i32;
137137
if e >= 0x400 || e == -0x3ff {
138138
/* x <= 0 or NaN/Inf or subnormal */
139139
if x <= 0.0 {

0 commit comments

Comments
 (0)