zig/lib/std/math/scalbn.zig
Andrew Kelley 6f0198cadb Revert "Merge pull request #17637 from jacobly0/x86_64-test-std"
This reverts commit 0c99ba1eab63865592bb084feb271cd4e4b0357e, reversing
changes made to 5f92b070bf284f1493b1b5d433dd3adde2f46727.

This caused a CI failure when it landed in master branch due to a
128-bit `@byteSwap` in std.mem.
2023-10-22 12:16:35 -07:00

16 lines
510 B
Zig

const std = @import("std");
const expect = std.testing.expect;
/// Returns a * FLT_RADIX ^ exp.
///
/// Zig only supports binary base IEEE-754 floats. Hence FLT_RADIX=2, and this is an alias for ldexp.
pub const scalbn = @import("ldexp.zig").ldexp;
test "math.scalbn" {
// Verify we are using base 2.
try expect(scalbn(@as(f16, 1.5), 4) == 24.0);
try expect(scalbn(@as(f32, 1.5), 4) == 24.0);
try expect(scalbn(@as(f64, 1.5), 4) == 24.0);
try expect(scalbn(@as(f128, 1.5), 4) == 24.0);
}