Skip to main content

frexp

Function frexp 

Source
pub fn frexp<T, D>(
    input: &Array<T, D>,
) -> Result<(Array<T, D>, Array<i32, D>), FerrayError>
where T: Element + Float, D: Dimension,
Expand description

Decompose into mantissa and exponent: x = m * 2^e.

Returns (mantissa_array, exponent_array) where mantissa is in [0.5, 1.0). This matches C’s frexp: for x=4.0, returns (0.5, 3) since 0.5 * 2^3 = 4.

Uses IEEE 754 bit extraction for f64 and f32 (O(1) per element), with f64 round-trip fallback for other float types.