Average Error: 3.4 → 1.2
Time: 1.4m
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}\;y \le -6.798242451867544 \cdot 10^{-115}:\\
\;\;\;\;\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{if}\;y \le 4.7969606968471655 \cdot 10^{-108}:\\
\;\;\;\;\left(x \cdot 2.0 - \left(y \cdot \left(9.0 \cdot z\right)\right) \cdot t\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 | 1.2 |
|---|
\[\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 y < -6.798242451867544e-115 or 4.7969606968471655e-108 < y
Initial program 5.1
\[\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*1.4
\[\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 -6.798242451867544e-115 < y < 4.7969606968471655e-108
Initial program 0.6
\[\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*0.7
\[\leadsto \left(x \cdot 2.0 - \color{blue}{\left(y \cdot \left(9.0 \cdot z\right)\right)} \cdot t\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 +o reduce:binary-search
(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)))