\frac{x}{y} \cdot \left(z - t\right) + t\begin{array}{l}
\mathbf{if}\;t \leq 3.2944057946354315 \cdot 10^{-254} \lor \neg \left(t \leq 3.603101262572962 \cdot 10^{-84}\right):\\
\;\;\;\;t + \frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x \cdot \left(z - t\right)}{y}\\
\end{array}(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
(FPCore (x y z t) :precision binary64 (if (or (<= t 3.2944057946354315e-254) (not (<= t 3.603101262572962e-84))) (+ t (* (/ x y) (- z t))) (+ t (/ (* x (- z t)) y))))
double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= 3.2944057946354315e-254) || !(t <= 3.603101262572962e-84)) {
tmp = t + ((x / y) * (z - t));
} else {
tmp = t + ((x * (z - t)) / y);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 1.9 |
|---|---|
| Target | 2.4 |
| Herbie | 2.1 |
if t < 3.2944057946354315e-254 or 3.6031012625729618e-84 < t Initial program 1.6
if 3.2944057946354315e-254 < t < 3.6031012625729618e-84Initial program 3.9
rmApplied associate-*l/_binary644.8
Final simplification2.1
herbie shell --seed 2020233
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
: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))