Average Error: 1.9 → 2.3
Time: 45.7s
Precision: 64
Internal Precision: 384
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
↓
\[\begin{array}{l}
\mathbf{if}\;y \le -1.3647715936252021 \cdot 10^{+175}:\\
\;\;\;\;x \cdot \frac{z - t}{y} + t\\
\mathbf{if}\;y \le 1.9607321077053286 \cdot 10^{+33}:\\
\;\;\;\;\frac{x \cdot \left(z - t\right)}{y} + t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z - t}{y} + t\\
\end{array}\]
Target
| Original | 1.9 |
|---|
| Target | 2.2 |
|---|
| Herbie | 2.3 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \lt 2.759456554562692 \cdot 10^{-282}:\\
\;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\
\mathbf{if}\;z \lt 2.326994450874436 \cdot 10^{-110}:\\
\;\;\;\;x \cdot \frac{z - t}{y} + t\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\
\end{array}\]
Derivation
- Split input into 2 regimes
if y < -1.3647715936252021e+175 or 1.9607321077053286e+33 < y
Initial program 1.1
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
- Using strategy
rm Applied div-inv1.2
\[\leadsto \color{blue}{\left(x \cdot \frac{1}{y}\right)} \cdot \left(z - t\right) + t\]
Applied associate-*l*1.3
\[\leadsto \color{blue}{x \cdot \left(\frac{1}{y} \cdot \left(z - t\right)\right)} + t\]
Applied simplify1.3
\[\leadsto x \cdot \color{blue}{\frac{z - t}{y}} + t\]
if -1.3647715936252021e+175 < y < 1.9607321077053286e+33
Initial program 2.5
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
- Using strategy
rm Applied associate-*l/3.0
\[\leadsto \color{blue}{\frac{x \cdot \left(z - t\right)}{y}} + t\]
- 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)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:herbie-target
(if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))
(+ (* (/ x y) (- z t)) t))