Average Error: 13.9 → 3.6
Time: 56.3s
Precision: 64
Internal Precision: 384
\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1.0\right)}\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \le 2.2502306453381415 \cdot 10^{-36}:\\
\;\;\;\;\frac{y \cdot \frac{x}{z}}{z \cdot \left(z + 1.0\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\frac{y}{z}}{z} \cdot \left(\sqrt[3]{\frac{x}{1.0 + z}} \cdot \sqrt[3]{\frac{x}{1.0 + z}}\right)\right) \cdot \sqrt[3]{\frac{x}{1.0 + z}}\\
\end{array}\]
Target
| Original | 13.9 |
|---|
| Target | 4.0 |
|---|
| Herbie | 3.6 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \lt 249.6182814532307:\\
\;\;\;\;\frac{y \cdot \frac{x}{z}}{z + z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{y}{z}}{1 + z} \cdot x}{z}\\
\end{array}\]
Derivation
- Split input into 2 regimes
if x < 2.2502306453381415e-36
Initial program 13.4
\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1.0\right)}\]
Taylor expanded around 0 23.1
\[\leadsto \frac{x \cdot y}{\color{blue}{1.0 \cdot {z}^{2} + {z}^{3}}}\]
Applied simplify6.4
\[\leadsto \color{blue}{\frac{\frac{y}{z}}{z} \cdot \frac{x}{1.0 + z}}\]
- Using strategy
rm Applied div-inv6.4
\[\leadsto \color{blue}{\left(\frac{y}{z} \cdot \frac{1}{z}\right)} \cdot \frac{x}{1.0 + z}\]
Applied associate-*l*3.3
\[\leadsto \color{blue}{\frac{y}{z} \cdot \left(\frac{1}{z} \cdot \frac{x}{1.0 + z}\right)}\]
Applied simplify3.2
\[\leadsto \frac{y}{z} \cdot \color{blue}{\frac{\frac{x}{z}}{z + 1.0}}\]
- Using strategy
rm Applied frac-times3.8
\[\leadsto \color{blue}{\frac{y \cdot \frac{x}{z}}{z \cdot \left(z + 1.0\right)}}\]
if 2.2502306453381415e-36 < x
Initial program 15.7
\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1.0\right)}\]
Taylor expanded around 0 25.1
\[\leadsto \frac{x \cdot y}{\color{blue}{1.0 \cdot {z}^{2} + {z}^{3}}}\]
Applied simplify2.4
\[\leadsto \color{blue}{\frac{\frac{y}{z}}{z} \cdot \frac{x}{1.0 + z}}\]
- Using strategy
rm Applied add-cube-cbrt2.9
\[\leadsto \frac{\frac{y}{z}}{z} \cdot \color{blue}{\left(\left(\sqrt[3]{\frac{x}{1.0 + z}} \cdot \sqrt[3]{\frac{x}{1.0 + z}}\right) \cdot \sqrt[3]{\frac{x}{1.0 + z}}\right)}\]
Applied associate-*r*2.9
\[\leadsto \color{blue}{\left(\frac{\frac{y}{z}}{z} \cdot \left(\sqrt[3]{\frac{x}{1.0 + z}} \cdot \sqrt[3]{\frac{x}{1.0 + z}}\right)\right) \cdot \sqrt[3]{\frac{x}{1.0 + 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 +o reduce:binary-search
(FPCore (x y z)
:name "Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2"
:herbie-target
(if (< z 249.6182814532307) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1 z)) x) z))
(/ (* x y) (* (* z z) (+ z 1.0))))