mirror of https://git.musl-libc.org/git/musl
Browse Source
the expression LDBL_MANT_DIG/4+1 was intended to represent the number of hex digits which can be significant, after which all that matters to the result, regardless of rounding mode, is whether any part of the tail is nonzero. however, the expression LDBL_MANT_DIG/4 is only exact for ld80 archs. for ld64 and ld128, the truncation of the remainder caused one too few digits to be processed, producing incorrect rounding. for ld128 archs, only strtold and scanf's %La conversion specifier were affected; doubles and floats still had plenty of trailing digits to yield a correct final rounding. but for ld64 archs, the number of digits processed were insufficient for double, and could affect any code using strtod or scanf's %a. for ld64 archs, 0x1.111111111111281 produces an incorrect rounding down, and 0x1.11111111111111 produces an incorrect rounding up. for ld128 archs, the inputs 0x1.111111111111111111111111111281 and 0x1.11111111111111111111111111111 behave respectively. rounding up in the expression for the number of hex digits needed produces correct results.master
1 changed files with 1 additions and 1 deletions
Loading…
Reference in new issue