\frac{x}{y} \cdot \left(z - t\right) + t
\begin{array}{l}
\mathbf{if}\;t + \frac{x}{y} \cdot \left(z - t\right) \leq 2.0777486913097956 \cdot 10^{+307}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y}, z - t, t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\end{array}
(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
(FPCore (x y z t) :precision binary64 (if (<= (+ t (* (/ x y) (- z t))) 2.0777486913097956e+307) (fma (/ 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 + ((x / y) * (z - t))) <= 2.0777486913097956e+307) {
tmp = fma((x / y), (z - t), t);
} else {
tmp = x * ((z - t) / y);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 2.0 |
|---|---|
| Target | 2.4 |
| Herbie | 1.4 |
if (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) < 2.07774869130979561e307Initial program 1.4
Simplified1.4
if 2.07774869130979561e307 < (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) Initial program 57.0
Simplified57.0
Taylor expanded in x around inf 4.5
Simplified4.5
Final simplification1.4
herbie shell --seed 2021313
(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))