jax
a194ad53 - Add jax.lax.asinpi, acospi, atanpi, and atan2pi.

Commit
18 days ago
Add jax.lax.asinpi, acospi, atanpi, and atan2pi. Computing inverse trigonometric functions in half-revolutions by dividing `jnp.asin`, `jnp.acos`, `jnp.atan`, or `jnp.atan2` by `pi` rounds an irrational number after computing the angle. That extra rounding step introduces small errors and misses exact rational values at special inputs, such as `acospi(-1) = 1` or `atanpi(1) = 0.25`. Add `jax.lax.asinpi`, `jax.lax.acospi`, `jax.lax.atanpi`, and `jax.lax.atan2pi` (and their core primitives) to compute `asin(x) / pi`, `acos(x) / pi`, `atan(x) / pi`, and `atan2(x, y) / pi` directly. Each returns exact results at special inputs (`0`, `±1`, `±inf`, and axis-aligned inputs) and avoids overflow or underflow when computing `atan2pi(x, y)` on very large or very small numbers. Also register `sinpi`, `cospi`, and `tanpi` alongside the new primitives in Pallas cost estimation, move the `sinpi`, `cospi`, and `tanpi` special-value tests out of `lax_test.py` into per-op special-value tests in `tests/numerics/trig_test.py`, and share the inverse-trig test point lists as module constants. PiperOrigin-RevId: 1014274466
Author
Parents
Loading