zig/lib
David Rubin 938efe4aab compiler-rt: fix f80 ceil/floor optimization
Our implementation did the classic add-sub rounding trick `(y = x +/- C =+ C - x)`
with `C = 1 / eps(T) = 2^(mantissa - 1)`. This approach only works for values whose
magnitude is below the rounding capacity of the constant. For a 64-bit mantissa
(like f80 has), `C = 2^63` only rounds for `|x| < 2^63`. Before we allowed this to
be ran on `e < bias + 64` aka `|x| < 2^64`. And because it isn't large enough,
we lose a bit to rounding.

For reference, the musl implementation does the same thing, using `mantissa - 1`:
https://git.musl-libc.org/cgit/musl/tree/src/math/ceill.c#n18
where `LDBL_MANT_DIG` is 64 for `long double` on x86.

This commit also combines the floor and ceil implementations into one generic one.
2026-01-08 00:45:52 +01:00
..
build-web all: replace all @Type usages 2025-11-22 22:42:38 +00:00
c feat(libzigc): add div, ldiv, lldiv and imaxdiv 2026-01-07 21:53:40 +01:00
compiler update API usage of std.crypto.random to io.random 2026-01-07 11:03:36 -08:00
compiler_rt compiler-rt: fix f80 ceil/floor optimization 2026-01-08 00:45:52 +01:00
docs std: Remove a handful of things deprecated during the 0.15 release cycle 2025-11-27 20:17:04 +00:00
include remove all IBM AIX and z/OS support 2025-10-29 14:25:51 +01:00
init update init template for new main API 2026-01-04 00:27:09 -08:00
libc feat(libzigc): add div, ldiv, lldiv and imaxdiv 2026-01-07 21:53:40 +01:00
libcxx libcxx: use compiler's _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION when set 2025-11-14 02:02:59 +01:00
libcxxabi remove all IBM AIX and z/OS support 2025-10-29 14:25:51 +01:00
libtsan remove all IBM AIX and z/OS support 2025-10-29 14:25:51 +01:00
libunwind remove all IBM AIX and z/OS support 2025-10-29 14:25:51 +01:00
std byteSwapAllFieldsAligned: use std.mem.Alignment API (#30724) 2026-01-08 00:44:08 +01:00
c.zig libc: use zig isnan and derivates for mingw 2025-08-27 03:58:32 +02:00
compiler_rt.zig compiler-rt: fix f80 ceil/floor optimization 2026-01-08 00:45:52 +01:00
fuzzer.zig test-standalone: fix most compilation errors 2025-12-23 22:15:12 -08:00
ubsan_rt.zig Coff: implement threadlocal variables 2025-10-10 22:47:47 -07:00
zig.h zig.h: drop dependency on deleted compiler_rt functions 2025-11-12 16:00:16 +00:00