mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
4754f200ee
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). |
||
---|---|---|
.. | ||
aarch64 | ||
argon2 | ||
awk | ||
bzip2 | ||
chibicc | ||
compiler_rt | ||
ctags | ||
dlmalloc | ||
double-conversion | ||
finger | ||
gdtoa | ||
getopt | ||
hiredis | ||
intel | ||
less | ||
libcxx | ||
libcxxabi | ||
libunwind | ||
linenoise | ||
lua | ||
lz4cli | ||
make | ||
maxmind | ||
mbedtls | ||
musl | ||
ncurses | ||
nsync | ||
openmp | ||
pcre | ||
puff | ||
python | ||
qemu | ||
readline | ||
regex | ||
sed | ||
smallz4 | ||
sqlite3 | ||
stb | ||
tidy | ||
tr | ||
tree | ||
tz | ||
unzip | ||
vqsort | ||
xed | ||
xxhash | ||
zip | ||
zlib | ||
zstd | ||
.clang-format | ||
BUILD.mk |