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{...@@ -818,7 +818,6 @@ const src_files = [_][]const u8{
818 "musl/src/math/aarch64/nearbyintf.c",818 "musl/src/math/aarch64/nearbyintf.c",
819 "musl/src/math/aarch64/rint.c",819 "musl/src/math/aarch64/rint.c",
820 "musl/src/math/aarch64/rintf.c",820 "musl/src/math/aarch64/rintf.c",
821 "musl/src/math/aarch64/roundf.c",
822 "musl/src/math/acosf.c",821 "musl/src/math/acosf.c",
823 "musl/src/math/acosh.c",822 "musl/src/math/acosh.c",
824 "musl/src/math/acoshf.c",823 "musl/src/math/acoshf.c",
...@@ -996,7 +995,6 @@ const src_files = [_][]const u8{...@@ -996,7 +995,6 @@ const src_files = [_][]const u8{
996 "musl/src/math/powerpc64/lrintf.c",995 "musl/src/math/powerpc64/lrintf.c",
997 "musl/src/math/powerpc64/lround.c",996 "musl/src/math/powerpc64/lround.c",
998 "musl/src/math/powerpc64/lroundf.c",997 "musl/src/math/powerpc64/lroundf.c",
999 "musl/src/math/powerpc64/roundf.c",
1000 "musl/src/math/powerpc/fma.c",998 "musl/src/math/powerpc/fma.c",
1001 "musl/src/math/powerpc/fmaf.c",999 "musl/src/math/powerpc/fmaf.c",
1002 "musl/src/math/powf.c",1000 "musl/src/math/powf.c",
...@@ -1019,7 +1017,6 @@ const src_files = [_][]const u8{...@@ -1019,7 +1017,6 @@ const src_files = [_][]const u8{
1019 "musl/src/math/riscv32/fmaf.c",1017 "musl/src/math/riscv32/fmaf.c",
1020 "musl/src/math/riscv64/fma.c",1018 "musl/src/math/riscv64/fma.c",
1021 "musl/src/math/riscv64/fmaf.c",1019 "musl/src/math/riscv64/fmaf.c",
1022 "musl/src/math/roundf.c",
1023 "musl/src/math/s390x/fma.c",1020 "musl/src/math/s390x/fma.c",
1024 "musl/src/math/s390x/fmaf.c",1021 "musl/src/math/s390x/fmaf.c",
1025 "musl/src/math/s390x/nearbyint.c",1022 "musl/src/math/s390x/nearbyint.c",
...@@ -1028,7 +1025,6 @@ const src_files = [_][]const u8{...@@ -1028,7 +1025,6 @@ const src_files = [_][]const u8{
1028 "musl/src/math/s390x/rint.c",1025 "musl/src/math/s390x/rint.c",
1029 "musl/src/math/s390x/rintf.c",1026 "musl/src/math/s390x/rintf.c",
1030 "musl/src/math/s390x/rintl.c",1027 "musl/src/math/s390x/rintl.c",
1031 "musl/src/math/s390x/roundf.c",
1032 "musl/src/math/scalb.c",1028 "musl/src/math/scalb.c",
1033 "musl/src/math/scalbf.c",1029 "musl/src/math/scalbf.c",
1034 "musl/src/math/scalbln.c",1030 "musl/src/math/scalbln.c",
src/libs/wasi_libc.zig-1
...@@ -808,7 +808,6 @@ const libc_top_half_src_files = [_][]const u8{...@@ -808,7 +808,6 @@ const libc_top_half_src_files = [_][]const u8{
808 "musl/src/math/remquof.c",808 "musl/src/math/remquof.c",
809 "musl/src/math/remquol.c",809 "musl/src/math/remquol.c",
810 "musl/src/math/rintl.c",810 "musl/src/math/rintl.c",
811 "musl/src/math/roundf.c",
812 "musl/src/math/scalb.c",811 "musl/src/math/scalb.c",
813 "musl/src/math/scalbf.c",812 "musl/src/math/scalbf.c",
814 "musl/src/math/scalbln.c",813 "musl/src/math/scalbln.c",
test/libc.zig+1-1
...@@ -297,7 +297,7 @@ pub fn addCases(cases: *tests.LibcContext) void {...@@ -297,7 +297,7 @@ pub fn addCases(cases: *tests.LibcContext) void {
297 cases.addLibcTestCase("math/rintf.c", true, .{});297 cases.addLibcTestCase("math/rintf.c", true, .{});
298 // cases.addLibcTestCase("math/rintl.c", true, .{});298 // cases.addLibcTestCase("math/rintl.c", true, .{});
299 cases.addLibcTestCase("math/round.c", true, .{});299 cases.addLibcTestCase("math/round.c", true, .{});
300 // cases.addLibcTestCase("math/roundf.c", true, .{});300 cases.addLibcTestCase("math/roundf.c", true, .{});
301 cases.addLibcTestCase("math/roundl.c", true, .{});301 cases.addLibcTestCase("math/roundl.c", true, .{});
302 cases.addLibcTestCase("math/scalb.c", true, .{});302 cases.addLibcTestCase("math/scalb.c", true, .{});
303 cases.addLibcTestCase("math/scalbf.c", true, .{});303 cases.addLibcTestCase("math/scalbf.c", true, .{});