Average Error: 12.2 → 2.2
Time: 43.5s
Precision: 64
Internal precision: 128
\[\frac{x \cdot \left(y + z\right)}{z}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;x \le -6.168596136367833 \cdot 10^{-58}:\\
\;\;\;\;x \cdot \frac{y + z}{z}\\
\mathbf{if}\;x \le 6.519946701032483 \cdot 10^{+140}:\\
\;\;\;\;\frac{y \cdot x}{z} + x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y + z}{z}\\
\end{array}\]
Target
| Original | 12.2 |
| Comparison | 3.0 |
| Herbie | 2.2 |
\[ \frac{x}{\frac{z}{y + z}} \]
Derivation
- Split input into 2 regimes.
-
if x < -6.168596136367833e-58 or 6.519946701032483e+140 < x
Initial program 21.9
\[\frac{x \cdot \left(y + z\right)}{z}\]
- Using strategy
rm
Applied associate-/l* 0.2
\[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}}\]
- Using strategy
rm
Applied div-inv 0.2
\[\leadsto \color{blue}{x \cdot \frac{1}{\frac{z}{y + z}}}\]
Applied simplify 0.2
\[\leadsto x \cdot \color{blue}{\frac{y + z}{z}}\]
if -6.168596136367833e-58 < x < 6.519946701032483e+140
Initial program 6.7
\[\frac{x \cdot \left(y + z\right)}{z}\]
Applied taylor 3.3
\[\leadsto \frac{y \cdot x}{z} + x\]
Taylor expanded around 0 3.3
\[\leadsto \color{blue}{\frac{y \cdot x}{z} + x}\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie --seed '#(1732877526 4196286305 669315667 760288596 3024672377 3977034441)'
(FPCore (x y z)
:name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
:target
(/ x (/ z (+ y z)))
(/ (* x (+ y z)) z))