Fix vectorized erf returning NaN at ±inf instead of ±1

Summary

  • Clamp input to [-28, 28] in generic_fast_erf<double>, matching the pattern already used by generic_fast_erfc<double>
  • Without clamping, infinite inputs cause NaN via twoprod_low(inf, inf, inf) and exp(-inf) * NaN propagation in erfc_double_large
  • Since erf(28.0) is indistinguishable from 1.0 in double precision, the clamp is mathematically exact

Test plan

  • Custom test: erf(±inf) returns ±1 for both float and double
  • special_functions test suite passes
  • special_packetmath test suite passes (SIMD paths)

Closes #3053 (closed)

Merge request reports

Loading