Commit 100ab2d
ld128: fix coshl returning 1+x instead of 1 for tiny |x|
The early-exit branch in coshl for tiny |x| returned `w = 1 + expm1l(x)`,
which is ~1+x for representable small x, not 1. Reproduced on AArch64
(112-bit mantissa) per #285:
coshl(0x1p-72) = 0x1.000000000000000001p+0 (should be 1.0)
cosh(x) = 1 + x^2/2 + O(x^4); for any |x| < 2^-71 the x^2/2 term is
below ulp(1) = 2^-112, so returning exactly 1 is correctly rounded.
Also fix the threshold comment: 0x3fb80000 is exp 0x3fb8 - bias 0x3fff
= -71, not -116.
Closes #285.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent aeef4da commit 100ab2d
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
79 | | - | |
| 78 | + | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
0 commit comments