Skip to content

Commit 7175c5b

Browse files
committed
words insertion on k_expo2
1 parent 41c5d03 commit 7175c5b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/math/k_expo2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use super::exp;
22

33
/* k is such that k*ln2 has minimal relative error and x - kln2 > log(FLT_MIN) */
4-
const K: i64 = 2043;
4+
const K: i32 = 2043;
55

66
/* expf(x)/2 for x >= log(FLT_MAX), slightly better than 0.5f*expf(x/2)*expf(x/2) */
77
#[inline]
88
pub(crate) fn k_expo2(x: f64) -> f64 {
99
let k_ln2 = f64::from_bits(0x40962066151add8b);
1010
/* note that k is odd and scale*scale overflows */
11-
let scale = f64::from_bits(((0x3ff + K / 2) as u64) << 20);
11+
let scale = f64::from_bits(((((0x3ff + K / 2) as u32) << 20) as u64) << 32);
1212
/* exp(x - k ln2) * 2**(k-1) */
1313
exp(x - k_ln2) * scale * scale
1414
}

0 commit comments

Comments
 (0)