Commit fd0580b
committed
fix(kpm): widen relative tolerance to 1e-5 for M6-2 dual-mode tests
The previous 1e-6 relative scaling was still too tight for near-singular
2x2 systems on Apple Silicon ARM64. A failing case showed:
rust=-358.62683, cpp=-358.62802, diff=1.19e-3, tol=3.59e-4
The relative error of ~3.3e-6 exceeded the 1e-6 scale factor.
Random 2x2 systems occasionally hit ill-conditioned configurations where
solutions have large magnitude and are very sensitive to FMA rounding
order. f32 has ~7 decimal digits of precision, so even well-conditioned
results can diverge by ~1e-5 relative across platforms; ill-conditioned
ones diverge more.
Bump relative scale from 1e-5 (per |x|) to ensure cross-platform
stability without losing test sensitivity for typical values:
tol = max(1e-5, |x| * 1e-5)
This is consistent with f32 precision floor and accommodates the worst
observed cross-platform divergence with a safety margin.
Refs #1161 parent 8f88d0f commit fd0580b
1 file changed
Lines changed: 16 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2112 | 2112 | | |
2113 | 2113 | | |
2114 | 2114 | | |
2115 | | - | |
2116 | | - | |
2117 | | - | |
2118 | | - | |
2119 | | - | |
2120 | | - | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
2121 | 2130 | | |
2122 | 2131 | | |
2123 | 2132 | | |
| |||
2191 | 2200 | | |
2192 | 2201 | | |
2193 | 2202 | | |
2194 | | - | |
| 2203 | + | |
2195 | 2204 | | |
2196 | 2205 | | |
2197 | 2206 | | |
| |||
0 commit comments