Average Error: 6.5 → 6.7
Time: 9.6s
Precision: 64
Internal precision: 128
\[\frac{x \cdot y}{z}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;z \le 2.1434644401519457 \cdot 10^{-300}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{if}\;z \le 8.719617136183342 \cdot 10^{-188}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{if}\;z \le 2.2547275136738512 \cdot 10^{-175}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}\]
Target
| Original | 6.5 |
| Comparison | 6.1 |
| Herbie | 6.7 |
\[ \begin{array}{l}
\mathbf{if}\;z \lt -4.262230790519429 \cdot 10^{-138}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{if}\;z \lt 1.7042130660650472 \cdot 10^{-164}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\end{array} \]
Derivation
- Split input into 3 regimes.
-
if z < 2.1434644401519457e-300
Initial program 6.9
\[\frac{x \cdot y}{z}\]
if 2.1434644401519457e-300 < z < 8.719617136183342e-188 or 2.2547275136738512e-175 < z
Initial program 5.9
\[\frac{x \cdot y}{z}\]
- Using strategy
rm
Applied associate-/l* 6.2
\[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
if 8.719617136183342e-188 < z < 2.2547275136738512e-175
Initial program 17.3
\[\frac{x \cdot y}{z}\]
- Recombined 3 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie --seed '#(1425140707 2219112211 325894078 2739722066 2235539986 2733763905)'
(FPCore (x y z)
:name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, A"
:target
(if (< z -4.262230790519429e-138) (/ (* x y) z) (if (< z 1.7042130660650472e-164) (/ x (/ z y)) (* (/ x z) y)))
(/ (* x y) z))