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




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 2.1 |
|---|---|
| Target | 2.2 |
| Herbie | 2.0 |
if x < 3.3889475038126382e-96Initial program 1.9
if 3.3889475038126382e-96 < x Initial program 2.9
rmApplied div-inv_binary64_145652.9
Applied associate-*l*_binary64_145112.5
Simplified2.4
rmApplied div-sub_binary64_145732.4
Final simplification2.0
herbie shell --seed 2020281
(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))