Skip to content

Commit cbb3c3c

Browse files
committed
Overflow
1 parent dd16892 commit cbb3c3c

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
@@ -132,7 +132,7 @@ pub fn log(mut x: f64) -> f64 {
132132

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

0 commit comments

Comments
 (0)