jax
48d877e7 - Mark complex exp, sinh, and cosh infinite border regions as inaccurate in lax_test.

Commit
3 days ago
Mark complex exp, sinh, and cosh infinite border regions as inaccurate in lax_test. https://github.com/openxla/stablehlo/pull/3039 updates StableHLO's complex math expander lowering of `stablehlo.exponential` to follow C99 Annex G.6.3.1 when the real part is infinite and the imaginary part is non-finite: `exp(-inf + I*y)` returns `0` and `exp(+inf + I*y)` returns `+inf + nanj`. Because complex `sinh` and `cosh` lower through `stablehlo.exponential`, `sinh(±inf ± infj)` evaluates to `±inf + nanj` and `cosh(±inf ± infj)` evaluates to `+inf + nanj`. Meanwhile, `mpmath` still evaluates all three operations at `(±inf ± infj)` to `nan + nanj`, causing `testSuccessOnComplexPlane` for `exp`, `sinh`, and `cosh` (`complex64` and `complex128`) in `FunctionAccuracyTest` to fail on CPU and GPU. Mark `'ninf'`, `'pinf'`, `'ninfj'`, and `'pinfj'` as known inaccurate regions for `exp` and `cosh`, and expand `'ninf.imag'` and `'pinf.imag'` to `'ninf'` and `'pinf'` for `sinh` on CPU and CUDA (`'ninfj.real'` and `'pinfj.real'` are already listed for `sinh`). This remains backward-compatible with older XLA/StableHLO builds because `testFailureOnComplexPlane` skips regions that still match `mpmath`. PiperOrigin-RevId: 1024054142
Author
Parents
Loading