Files
zig/test/behavior
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
..
2025-11-22 22:42:38 +00:00
2025-09-20 18:33:00 -07:00
2025-06-16 13:22:19 +03:30
2025-11-22 22:42:38 +00:00
2025-11-22 22:42:38 +00:00
2025-06-16 13:22:19 +03:30
2025-06-16 13:22:19 +03:30
2025-11-22 22:42:38 +00:00
2025-11-22 22:42:38 +00:00
2024-05-11 02:17:24 -07:00
2025-06-16 13:22:19 +03:30
2024-06-13 02:20:47 -07:00
2025-12-07 07:21:15 +01:00
2025-11-22 22:42:38 +00:00
2025-11-22 22:42:38 +00:00
2025-09-20 18:33:00 -07:00
2025-06-16 13:22:19 +03:30
2025-06-16 13:22:19 +03:30
2025-06-16 13:22:19 +03:30
2025-11-22 22:42:38 +00:00
2025-11-22 22:42:38 +00:00
2025-09-20 18:33:01 -07:00
2025-11-22 22:42:38 +00:00
2024-06-13 02:20:47 -07:00
2025-12-07 07:21:15 +01:00
2025-07-27 08:01:07 -04:00