Fix vectorized erf returning NaN at ±inf instead of ±1
Summary
- Clamp input to
[-28, 28]ingeneric_fast_erf<double>, matching the pattern already used bygeneric_fast_erfc<double> - Without clamping, infinite inputs cause NaN via
twoprod_low(inf, inf, inf)andexp(-inf) * NaNpropagation inerfc_double_large - Since
erf(28.0)is indistinguishable from1.0in double precision, the clamp is mathematically exact
Test plan
-
Custom test:
erf(±inf)returns±1for both float and double -
special_functionstest suite passes -
special_packetmathtest suite passes (SIMD paths)
Closes #3053 (closed)