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




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.2 |
|---|---|
| Target | 2.9 |
| Herbie | 2.0 |
if y < -4.72288359045261534e65 or 5.0368630958340786e-170 < y Initial program 15.2
Applied associate-/l*_binary640.9
Applied div-inv_binary641.1
Simplified1.0
if -4.72288359045261534e65 < y < 5.0368630958340786e-170Initial program 7.0
Taylor expanded in y around 0 3.7
Final simplification2.0
herbie shell --seed 2021329
(FPCore (x y z)
:name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
:precision binary64
:herbie-target
(if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))
(/ (* x (- y z)) y))