Skip to main content

ldexp

Function ldexp 

Source
pub fn ldexp(x: f64, e: i32) -> f64
Expand description

Construct x * 2^e, correctly handling subnormals and overflow.

use mathverse_core::float::{frexp, ldexp};
let x = 123.456;
let (m, e) = frexp(x);
assert!((ldexp(m, e) - x).abs() < 1e-12);
assert!(ldexp(1.0, 2000).is_infinite());