\frac{x}{y} \cdot \left(z - t\right) + t
\begin{array}{l}
\mathbf{if}\;y \leq -2.809238893075622 \cdot 10^{-87}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y}, z - t, t\right)\\
\mathbf{elif}\;y \leq 3.791419667085907 \cdot 10^{-21}:\\
\;\;\;\;\left(t + \frac{x \cdot z}{y}\right) - \frac{x \cdot t}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot \left(z - t\right)\\
\end{array}
(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
(FPCore (x y z t)
:precision binary64
(if (<= y -2.809238893075622e-87)
(fma (/ x y) (- z t) t)
(if (<= y 3.791419667085907e-21)
(- (+ t (/ (* x z) y)) (/ (* x t) y))
(+ t (* (/ x y) (- z t))))))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 (y <= -2.809238893075622e-87) {
tmp = fma((x / y), (z - t), t);
} else if (y <= 3.791419667085907e-21) {
tmp = (t + ((x * z) / y)) - ((x * t) / y);
} else {
tmp = t + ((x / y) * (z - t));
}
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 y < -2.80923889307562196e-87Initial program 1.1
Simplified1.1
if -2.80923889307562196e-87 < y < 3.7914196670859069e-21Initial program 4.1
Simplified4.1
Taylor expanded in x around 0 2.1
if 3.7914196670859069e-21 < y Initial program 1.2
Final simplification1.4
herbie shell --seed 2022088
(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))