Average Error: 3.4 → 3.5
Time: 1.2m
Precision: 64
Internal Precision: 384
\[\left(x \cdot 2.0 - \left(\left(y \cdot 9.0\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27.0\right) \cdot b\]
↓
\[\begin{array}{l}
\mathbf{if}\;z \le -5.0071510977473634 \cdot 10^{+140}:\\
\;\;\;\;\left(x \cdot 2.0 - \left(y \cdot 9.0\right) \cdot \left(z \cdot t\right)\right) + \left(a \cdot 27.0\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2.0 - \left(y \cdot 9.0\right) \cdot \left(z \cdot t\right)\right) + \left(a \cdot 27.0\right) \cdot b\\
\end{array}\]
Target
| Original | 3.4 |
|---|
| Target | 2.5 |
|---|
| Herbie | 3.5 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \lt 7.590524218811189 \cdot 10^{-161}:\\
\;\;\;\;\left(x \cdot 2.0 - \left(\left(y \cdot 9.0\right) \cdot z\right) \cdot t\right) + a \cdot \left(27.0 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2.0 - 9.0 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) + \left(a \cdot 27.0\right) \cdot b\\
\end{array}\]
Derivation
- Split input into 2 regimes
if z < -5.0071510977473634e+140
Initial program 10.5
\[\left(x \cdot 2.0 - \left(\left(y \cdot 9.0\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27.0\right) \cdot b\]
- Using strategy
rm Applied associate-*l*11.6
\[\leadsto \left(x \cdot 2.0 - \color{blue}{\left(y \cdot 9.0\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27.0\right) \cdot b\]
if -5.0071510977473634e+140 < z
Initial program 2.5
\[\left(x \cdot 2.0 - \left(\left(y \cdot 9.0\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27.0\right) \cdot b\]
- Using strategy
rm Applied associate-*l*2.5
\[\leadsto \left(x \cdot 2.0 - \color{blue}{\left(y \cdot 9.0\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27.0\right) \cdot b\]
- 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 t a b)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, A"
:herbie-target
(if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b)))
(+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))