Average Error: 16.4 → 6.8
Time: 1.4m
Precision: 64
Internal precision: 128
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;a \le -7.346288643304349 \cdot 10^{-35}:\\
\;\;\;\;x + {\left(\sqrt[3]{y - z} \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\right)}^3\\
\mathbf{if}\;a \le 2.4800667194058456 \cdot 10^{-134}:\\
\;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\
\mathbf{if}\;a \le 9.581782060813449 \cdot 10^{-54}:\\
\;\;\;\;x + {\left(\sqrt[3]{y - z} \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\right)}^3\\
\mathbf{if}\;a \le 2.9697010902129357 \cdot 10^{-33}:\\
\;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\
\mathbf{if}\;a \le 1.347053492520341 \cdot 10^{+250}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\end{array}\]
Target
| Original | 16.4 |
| Comparison | 16.4 |
| Herbie | 6.8 |
\[ x + \left(y - z\right) \cdot \frac{t - x}{a - z} \]
Derivation
- Split input into 4 regimes.
-
if a < -7.346288643304349e-35 or 2.4800667194058456e-134 < a < 9.581782060813449e-54
Initial program 10.9
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
- Using strategy
rm
Applied add-cube-cbrt 11.4
\[\leadsto x + \left(y - z\right) \cdot \frac{t - x}{\color{blue}{{\left(\sqrt[3]{a - z}\right)}^3}}\]
Applied add-cube-cbrt 11.5
\[\leadsto x + \left(y - z\right) \cdot \frac{\color{blue}{{\left(\sqrt[3]{t - x}\right)}^3}}{{\left(\sqrt[3]{a - z}\right)}^3}\]
Applied cube-undiv 11.6
\[\leadsto x + \left(y - z\right) \cdot \color{blue}{{\left(\frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\right)}^3}\]
Applied add-cube-cbrt 11.6
\[\leadsto x + \color{blue}{{\left(\sqrt[3]{y - z}\right)}^3} \cdot {\left(\frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\right)}^3\]
Applied cube-unprod 9.0
\[\leadsto x + \color{blue}{{\left(\sqrt[3]{y - z} \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\right)}^3}\]
if -7.346288643304349e-35 < a < 2.4800667194058456e-134 or 9.581782060813449e-54 < a < 2.9697010902129357e-33
Initial program 29.4
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
Applied taylor 6.1
\[\leadsto \left(\frac{y \cdot x}{z} + t\right) - \frac{y \cdot t}{z}\]
Taylor expanded around inf 6.1
\[\leadsto \color{blue}{\left(\frac{y \cdot x}{z} + t\right) - \frac{y \cdot t}{z}}\]
Applied simplify 2.2
\[\leadsto \color{blue}{t - \frac{y}{z} \cdot \left(t - x\right)}\]
if 2.9697010902129357e-33 < a < 1.347053492520341e+250
Initial program 10.3
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
if 1.347053492520341e+250 < a
Initial program 3.6
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
- Recombined 4 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie --seed '#(1422125155 1800593038 3492843827 2194528598 3784060004 4100869845)'
(FPCore (x y z t a)
:name "Numeric.Signal:interpolate from hsignal-0.2.7.1"
:target
(+ x (* (- y z) (/ (- t x) (- a z))))
(+ x (* (- y z) (/ (- t x) (- a z)))))