Repository navigation
Avoid NaN real components in complex tanh after overflow - #1435
agourakis82 wants to merge 1 commit into
Conversation
|
Published in 1b61a71. I moved the overflow regression into the existing typed On macOS ARM64 with Apple Clang 21 and C++23, the scoped complex and real hyperbolic tests pass all four cases in each mode, with 128 assertions in strict mode and 28 in fast-math. Removing the overflow correction in an isolated header copy causes 40 assertions to fail in strict mode. A separate numerator mutation is rejected in both modes, confirming that the shared finite numerical checks execute. Prepared with OpenAI Codex assistance. |
When cosh(2*real(z)) overflows, use the sign of the real part instead of an inf/inf quotient.
1b61a71 to
f1b5cb0
Compare
|
Superseded by #1456 |
When
cosh(2*real(z))overflows, the real part of complex tanh was an inf/inf quotient and became NaN. The non-fast-math path now substitutes the sign of the real input once the denominator is infinite. An 8 by 8 grid compares the batch withstd::tanh, covering huge real parts, signed zeros and ordinary controls. That grid is omitted under fast-math, which does not implement the recovery.Part of #1432.
Written by me with AI assistance.