cosmopolitan/third_party
Gabriel Ravier 4754f200ee
Fix printf-family long double prec/rounding issues (#1283)
Currently, in cosmopolitan, there is no handling of the current rounding
mode for long double conversions, such that round-to-nearest gets always
used, regardless of the current rounding mode. %Le also improperly calls
gdtoa with a too small precision (which led to relatively similar bugs).

This patch fixes these issues, in particular by modifying the FPI object
passed to gdtoa such that it is modifiable (so that __fmt can adjust its
rounding field to correspond to FLT_ROUNDS (note that this is not needed
for dtoa, which checks FLT_ROUNDS directly)) and ors STRTOG_Neg into the
kind field in both of the __fmt_dfpbits and __fmt_ldfpbits functions, as
the gdtoa function also depends on it to be able to accurately round any
negative arguments. The change to kind also requires a few other changes
to make sure kind's upper bits (which include STRTOG_Neg) are masked off
when attempting to only examine the lower bits' value. Furthermore, this
patch also makes exactly one change in gdtoa, which appears to be needed
to fix rounding issues with FE_TOWARDZERO (this seems like a gdtoa bug).

The patch also adds a few tests for these issues, along with also taking
the opportunity to clean up some of the previous tests to do the asserts
in the right order (i.e. with the first argument as the expected result,
and the second one being used as the value that it is compared against).
2024-09-07 18:26:04 -07:00
..
aarch64 Release Cosmopolitan v3.8.0 2024-08-30 20:14:07 -07:00
argon2 Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
awk Release Cosmopolitan v3.8.0 2024-08-30 20:14:07 -07:00
bzip2 Release Cosmopolitan v3.6.0 2024-07-23 03:28:19 -07:00
chibicc Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
compiler_rt Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
ctags Fix ctype.h and wctype.h 2024-07-21 15:54:17 -07:00
dlmalloc Fix the build 2024-08-26 16:44:05 -07:00
double-conversion Release Cosmopolitan v3.8.0 2024-08-30 20:14:07 -07:00
finger Fix ctype.h and wctype.h 2024-07-21 15:54:17 -07:00
gdtoa Fix printf-family long double prec/rounding issues (#1283) 2024-09-07 18:26:04 -07:00
getopt Delete ASAN 2024-06-22 05:45:49 -07:00
hiredis Fix ctype.h and wctype.h 2024-07-21 15:54:17 -07:00
intel Release Cosmopolitan v3.8.0 2024-08-30 20:14:07 -07:00
less Update Musl Libc code 2024-07-30 22:51:29 -07:00
libcxx Add missing pragma 2024-08-16 21:49:28 -07:00
libcxxabi Fix some static analysis issues 2024-07-27 09:16:54 -07:00
libunwind Release Cosmopolitan v3.8.0 2024-08-30 20:14:07 -07:00
linenoise Make improvements 2024-09-01 01:27:47 -07:00
lua Introduce pthread_condattr_setclock() 2024-09-02 23:45:42 -07:00
lz4cli Implement proper time zone support 2024-05-04 23:06:37 -07:00
make Release Cosmopolitan v3.6.0 2024-07-23 03:28:19 -07:00
maxmind Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
mbedtls Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
musl Make improvements 2024-09-01 01:27:47 -07:00
ncurses Release Cosmopolitan v3.6.0 2024-07-23 03:28:19 -07:00
nsync Delve into clock rabbit hole 2024-09-04 01:32:46 -07:00
openmp Introduce pthread_condattr_setclock() 2024-09-02 23:45:42 -07:00
pcre Update Musl Libc code 2024-07-30 22:51:29 -07:00
puff Delete ASAN 2024-06-22 05:45:49 -07:00
python Upgrade pl_mpeg 2024-09-06 19:10:34 -07:00
qemu more modeline errata (#1019) 2023-12-16 23:07:10 -05:00
readline Fix --ftrace on Windows 2024-01-01 00:00:42 -08:00
regex Update Musl Libc code 2024-07-30 22:51:29 -07:00
sed Update Musl Libc code 2024-07-30 22:51:29 -07:00
smallz4 Release Cosmopolitan v3.8.0 2024-08-30 20:14:07 -07:00
sqlite3 Move LoadZipArgs() to cosmo.h 2024-08-17 12:06:27 -07:00
stb Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
tidy Fix MODE=optlinux and MODE=tiny builds 2024-07-23 04:04:19 -07:00
tr Make improvements 2024-09-01 01:27:47 -07:00
tree Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
tz Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
unzip Update Musl Libc code 2024-07-30 22:51:29 -07:00
vqsort more modeline errata (#1019) 2023-12-16 23:07:10 -05:00
xed Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
xxhash Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
zip Change InfoZIP to not auto-append .zip to pathname 2024-08-17 06:45:23 -07:00
zlib Release Cosmopolitan v3.6.0 2024-07-23 03:28:19 -07:00
zstd Remove .internal from more header filenames 2024-08-04 12:52:25 -07:00
.clang-format Reduce header complexity 2023-11-28 14:39:42 -08:00
BUILD.mk Release Cosmopolitan v3.6.0 2024-07-23 03:28:19 -07:00