authorgravatar for christ@ophe.netChristophe Delage <christ@ophe.net> 2026-05-29 14:01:12+02:00
committergravatar for christ@ophe.netChristophe Delage <christ@ophe.net> 2026-05-29 14:01:12+02:00
log84aceda2d76c711001d1b9f0795ff084be91c629
treeb6ccb60cd8d47eb2aae47720d4c1979b641a6399
parent4cd396fc32cdc4488ecd9a36f2067b61142d727e

Remove stray frexp2


1 files changed, 0 insertions(+), 24 deletions(-)

lib/compiler_rt/log.zig-24
...@@ -633,30 +633,6 @@ pub fn logl(x: c_longdouble) callconv(.c) c_longdouble {...@@ -633,30 +633,6 @@ pub fn logl(x: c_longdouble) callconv(.c) c_longdouble {
633 }633 }
634}634}
635635
636/// Returns (f, k) such that x = f * 2^k and f in [1,2).
637/// Asserts that x is finite and positive.
638pub fn frexp2(x: f128) math.Frexp(f128) {
639 std.debug.assert(math.isFinite(x));
640 std.debug.assert(x > 0.0);
641
642 const bits: u128 = @bitCast(x);
643 const uexp: i32 = @intCast(bits >> 112);
644
645 std.debug.assert(uexp >= 0);
646
647 if (uexp == 0) {
648 const shift: u7 = @intCast(@clz(bits) - 15);
649
650 const exp = -@as(i32, shift) - 0x3ffe;
651 const frac: f128 = @bitCast((bits << shift) | (0x3fff << 112));
652 return .{ .significand = frac, .exponent = exp };
653 }
654
655 const exp = uexp - 0x3fff;
656 const frac: f128 = @bitCast((0x3fff << 112) | ((bits << 16) >> 16));
657 return .{ .significand = frac, .exponent = exp };
658}
659
660test "logf() special" {636test "logf() special" {
661 try expectEqual(logf(0.0), -math.inf(f32));637 try expectEqual(logf(0.0), -math.inf(f32));
662 try expectEqual(logf(-0.0), -math.inf(f32));638 try expectEqual(logf(-0.0), -math.inf(f32));