Average Error: 15.9 → 7.2
Time: 2.6m
Precision: 64
Internal Precision: 1920
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
↓
\[\begin{array}{l}
\mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \le -6.090130279416385 \cdot 10^{-196}:\\
\;\;\;\;x + \frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t - x}{\sqrt[3]{a - z}}\\
\mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \le 4.7656810866124795 \cdot 10^{-307}:\\
\;\;\;\;t - \left(t - x\right) \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t - x}{\sqrt[3]{a - z}}\\
\end{array}\]
Target
| Original | 15.9 |
|---|
| Target | 15.9 |
|---|
| Herbie | 7.2 |
|---|
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
Derivation
- Split input into 2 regimes
if (+ x (* (- y z) (/ (- t x) (- a z)))) < -6.090130279416385e-196 or 4.7656810866124795e-307 < (+ x (* (- y z) (/ (- t x) (- a z))))
Initial program 7.2
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
- Using strategy
rm Applied add-cube-cbrt7.9
\[\leadsto x + \left(y - z\right) \cdot \frac{t - x}{\color{blue}{\left(\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}\right) \cdot \sqrt[3]{a - z}}}\]
Applied *-un-lft-identity7.9
\[\leadsto x + \left(y - z\right) \cdot \frac{\color{blue}{1 \cdot \left(t - x\right)}}{\left(\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}\right) \cdot \sqrt[3]{a - z}}\]
Applied times-frac7.9
\[\leadsto x + \left(y - z\right) \cdot \color{blue}{\left(\frac{1}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t - x}{\sqrt[3]{a - z}}\right)}\]
Applied associate-*r*5.3
\[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot \frac{1}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}\right) \cdot \frac{t - x}{\sqrt[3]{a - z}}}\]
Applied simplify5.3
\[\leadsto x + \color{blue}{\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}} \cdot \frac{t - x}{\sqrt[3]{a - z}}\]
if -6.090130279416385e-196 < (+ x (* (- y z) (/ (- t x) (- a z)))) < 4.7656810866124795e-307
Initial program 60.9
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
Taylor expanded around inf 22.4
\[\leadsto \color{blue}{\left(\frac{y \cdot x}{z} + t\right) - \frac{y \cdot t}{z}}\]
Applied simplify17.4
\[\leadsto \color{blue}{t - \left(t - x\right) \cdot \frac{y}{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 t a)
:name "Numeric.Signal:interpolate from hsignal-0.2.7.1"
:herbie-target
(+ x (* (- y z) (/ (- t x) (- a z))))
(+ x (* (- y z) (/ (- t x) (- a z)))))