Average Error: 1.9 → 2.0
Time: 42.5s
Precision: 64
Internal Precision: 384
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
↓
\[\begin{array}{l}
\mathbf{if}\;t \le -1.0656602041483226 \cdot 10^{-38}:\\
\;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\
\mathbf{if}\;t \le 6.223312755956837 \cdot 10^{-188}:\\
\;\;\;\;\left(x \cdot \left(z - t\right)\right) \cdot \frac{1}{y} + t\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\
\end{array}\]
Target
| Original | 1.9 |
|---|
| Target | 2.1 |
|---|
| Herbie | 2.0 |
|---|
\[\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 t < -1.0656602041483226e-38 or 6.223312755956837e-188 < t
Initial program 0.6
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
if -1.0656602041483226e-38 < t < 6.223312755956837e-188
Initial program 4.2
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
- Using strategy
rm Applied associate-*l/4.6
\[\leadsto \color{blue}{\frac{x \cdot \left(z - t\right)}{y}} + t\]
- Using strategy
rm Applied div-inv4.7
\[\leadsto \color{blue}{\left(x \cdot \left(z - t\right)\right) \cdot \frac{1}{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
(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))