viable/strict/1792277451: [MPS] Fix complex log1p precision (#201093)
- PyTorch: 2465 events in the last 90 days
- PyTorch: 2432th Release in the last 90 days
- Previous: earlier the same day · viable/strict/1792272242
What happened
Complex log1p on MPS computed log(hypot(1 + x, y)) , so for small |z| everything below eps relative to 1 was lost in 1 + x (e.g. log1p(1e-19+1e-18j) had a real part of 0 instead of 1e-19 ), and, more generally, the real part cancels catastrophically whenever 1 + z is close to the unit circle ( log|1 + z| ~ 0 ). Against an mpmath reference the real part was off by up to ~8e6 ulp for small |z| and ~6e14 ulp near the u…
Summary assembled by rule from the sources below