Average Error: 6.0 → 4.7
Time: 27.8s
Precision: 64
Internal Precision: 384
\[\frac{x \cdot y}{z}\]
↓
\[\begin{array}{l}
\mathbf{if}\;\frac{x \cdot y}{z} \le -0.0:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\
\end{array}\]
Target
| Original | 6.0 |
|---|
| Target | 5.6 |
|---|
| Herbie | 4.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 2 regimes
if (/ (* x y) z) < -0.0
Initial program 6.9
\[\frac{x \cdot y}{z}\]
- Using strategy
rm Applied associate-/l*4.8
\[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
if -0.0 < (/ (* x y) z)
Initial program 4.6
\[\frac{x \cdot y}{z}\]
- Using strategy
rm Applied div-inv4.7
\[\leadsto \color{blue}{\left(x \cdot y\right) \cdot \frac{1}{z}}\]
- Recombined 2 regimes into one program.
- Removed slow
pow expressions.
Runtime
herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit
(FPCore (x y z)
:name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, A"
:herbie-target
(if (< z -4.262230790519429e-138) (/ (* x y) z) (if (< z 1.7042130660650472e-164) (/ x (/ z y)) (* (/ x z) y)))
(/ (* x y) z))