\frac{x}{y} \cdot \left(z - t\right) + t\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2.752278609399082 \cdot 10^{+207} \lor \neg \left(\frac{x}{y} \leq -2.507387929897188 \cdot 10^{-152}\right) \land \frac{x}{y} \leq 0:\\
\;\;\;\;t + x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot \left(z - t\right)\\
\end{array}double code(double x, double y, double z, double t) {
return ((double) (((double) ((x / y) * ((double) (z - t)))) + t));
}
double code(double x, double y, double z, double t) {
double VAR;
if ((((x / y) <= -2.752278609399082e+207) || (!((x / y) <= -2.507387929897188e-152) && ((x / y) <= 0.0)))) {
VAR = ((double) (t + ((double) (x * (((double) (z - t)) / y)))));
} else {
VAR = ((double) (t + ((double) ((x / y) * ((double) (z - t))))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 2.1 |
|---|---|
| Target | 2.4 |
| Herbie | 1.2 |
if (/ x y) < -2.7522786093990821e207 or -2.5073879298971879e-152 < (/ x y) < 0.0Initial program Error: 3.8 bits
SimplifiedError: 0.8 bits
if -2.7522786093990821e207 < (/ x y) < -2.5073879298971879e-152 or 0.0 < (/ x y) Initial program Error: 1.3 bits
Final simplificationError: 1.2 bits
herbie shell --seed 2020200
(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))