about summary refs log tree commit diff
path: root/src/legacy/err.c
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2023-08-18 23:17:38 +0200
committerRich Felker <dalias@aerifal.cx>2023-08-19 14:09:00 -0400
commit39e43f0881b12d602ddcb8a9e9295456354b765b (patch)
tree91a5db902649322e8700f0fdc4fc529418fbce1c /src/legacy/err.c
parent6d10102709df4bc966d2846c1c45cd667e5048e5 (diff)
downloadmusl-39e43f0881b12d602ddcb8a9e9295456354b765b.tar.gz
musl-39e43f0881b12d602ddcb8a9e9295456354b765b.tar.xz
musl-39e43f0881b12d602ddcb8a9e9295456354b765b.zip
math: fix ld80 powl(x,huge) and powl(LDBL_MAX,small)
powl used >= LDBL_MAX as infinity check, but LDBL_MAX is finite, so
this can cause wrong results e.g. powl(LDBL_MAX, 0.5) returned inf
or powl(2, LDBL_MAX) returned inf without raising overflow.

huge y values (close to LDBL_MAX) could cause intermediate results to
overflow (computing y * log2(x) with more than long double precision)
and e.g. powl(0.5, 0x1p16380L) or powl(10, 0x1p16380L) returned nan.
this is fixed by handling huge y early since that always overflows or
underflows.

reported by Paul Zimmermann against expl10 (which uses powl).
Diffstat (limited to 'src/legacy/err.c')
0 files changed, 0 insertions, 0 deletions