authorgravatar for kj4tmp@gmail.comkj4tmp <kj4tmp@gmail.com> 2026-01-31 17:18:42-08:00
committergravatar for kj4tmp@gmail.comkj4tmp <kj4tmp@gmail.com> 2026-01-31 18:18:29-08:00
log379d128cba904a7599ebb191afa0873ef1a633cc
tree6f5504f5da26ac562fea62a27f4018fceb01e4d6
parent69a95571ed6e0f2c4562b70dc222f427b3366858

libzigc: roundf


7 files changed, 1 insertions(+), 79 deletions(-)

lib/libc/musl/src/math/aarch64/roundf.c deleted-7
......@@ -1,7 +0,0 @@
1#include <math.h>
2
3float roundf(float x)
4{
5 __asm__ ("frinta %s0, %s1" : "=w"(x) : "w"(x));
6 return x;
7}
lib/libc/musl/src/math/powerpc64/roundf.c deleted-15
......@@ -1,15 +0,0 @@
1#include <math.h>
2
3#ifdef _ARCH_PWR5X
4
5float roundf(float x)
6{
7 __asm__ ("frin %0, %1" : "=f"(x) : "f"(x));
8 return x;
9}
10
11#else
12
13#include "../roundf.c"
14
15#endif
lib/libc/musl/src/math/roundf.c deleted-36
......@@ -1,36 +0,0 @@
1#include "libm.h"
2
3#if FLT_EVAL_METHOD==0
4#define EPS FLT_EPSILON
5#elif FLT_EVAL_METHOD==1
6#define EPS DBL_EPSILON
7#elif FLT_EVAL_METHOD==2
8#define EPS LDBL_EPSILON
9#endif
10static const float_t toint = 1/EPS;
11
12float roundf(float x)
13{
14 union {float f; uint32_t i;} u = {x};
15 int e = u.i >> 23 & 0xff;
16 float_t y;
17
18 if (e >= 0x7f+23)
19 return x;
20 if (u.i >> 31)
21 x = -x;
22 if (e < 0x7f-1) {
23 FORCE_EVAL(x + toint);
24 return 0*u.f;
25 }
26 y = x + toint - toint - x;
27 if (y > 0.5f)
28 y = y + x - 1;
29 else if (y <= -0.5f)
30 y = y + x + 1;
31 else
32 y = y + x;
33 if (u.i >> 31)
34 y = -y;
35 return y;
36}
lib/libc/musl/src/math/s390x/roundf.c deleted-15
......@@ -1,15 +0,0 @@
1#include <math.h>
2
3#if defined(__HTM__) || __ARCH__ >= 9
4
5float roundf(float x)
6{
7 __asm__ ("fiebra %0, 1, %1, 4" : "=f"(x) : "f"(x));
8 return x;
9}
10
11#else
12
13#include "../roundf.c"
14
15#endif
src/libs/musl.zig-4
......@@ -818,7 +818,6 @@ const src_files = [_][]const u8{
818818 "musl/src/math/aarch64/nearbyintf.c",
819819 "musl/src/math/aarch64/rint.c",
820820 "musl/src/math/aarch64/rintf.c",
821 "musl/src/math/aarch64/roundf.c",
822821 "musl/src/math/acosf.c",
823822 "musl/src/math/acosh.c",
824823 "musl/src/math/acoshf.c",
......@@ -996,7 +995,6 @@ const src_files = [_][]const u8{
996995 "musl/src/math/powerpc64/lrintf.c",
997996 "musl/src/math/powerpc64/lround.c",
998997 "musl/src/math/powerpc64/lroundf.c",
999 "musl/src/math/powerpc64/roundf.c",
1000998 "musl/src/math/powerpc/fma.c",
1001999 "musl/src/math/powerpc/fmaf.c",
10021000 "musl/src/math/powf.c",
......@@ -1019,7 +1017,6 @@ const src_files = [_][]const u8{
10191017 "musl/src/math/riscv32/fmaf.c",
10201018 "musl/src/math/riscv64/fma.c",
10211019 "musl/src/math/riscv64/fmaf.c",
1022 "musl/src/math/roundf.c",
10231020 "musl/src/math/s390x/fma.c",
10241021 "musl/src/math/s390x/fmaf.c",
10251022 "musl/src/math/s390x/nearbyint.c",
......@@ -1028,7 +1025,6 @@ const src_files = [_][]const u8{
10281025 "musl/src/math/s390x/rint.c",
10291026 "musl/src/math/s390x/rintf.c",
10301027 "musl/src/math/s390x/rintl.c",
1031 "musl/src/math/s390x/roundf.c",
10321028 "musl/src/math/scalb.c",
10331029 "musl/src/math/scalbf.c",
10341030 "musl/src/math/scalbln.c",
src/libs/wasi_libc.zig-1
......@@ -808,7 +808,6 @@ const libc_top_half_src_files = [_][]const u8{
808808 "musl/src/math/remquof.c",
809809 "musl/src/math/remquol.c",
810810 "musl/src/math/rintl.c",
811 "musl/src/math/roundf.c",
812811 "musl/src/math/scalb.c",
813812 "musl/src/math/scalbf.c",
814813 "musl/src/math/scalbln.c",
test/libc.zig+1-1
......@@ -297,7 +297,7 @@ pub fn addCases(cases: *tests.LibcContext) void {
297297 cases.addLibcTestCase("math/rintf.c", true, .{});
298298 // cases.addLibcTestCase("math/rintl.c", true, .{});
299299 cases.addLibcTestCase("math/round.c", true, .{});
300 // cases.addLibcTestCase("math/roundf.c", true, .{});
300 cases.addLibcTestCase("math/roundf.c", true, .{});
301301 cases.addLibcTestCase("math/roundl.c", true, .{});
302302 cases.addLibcTestCase("math/scalb.c", true, .{});
303303 cases.addLibcTestCase("math/scalbf.c", true, .{});