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




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 11.8 |
|---|---|
| Target | 3.1 |
| Herbie | 1.8 |
if y < -1.5514254731341713e28Initial program 17.6
Applied associate-/l*_binary640.1
if -1.5514254731341713e28 < y < 3.7924148815698593e-114Initial program 6.6
Taylor expanded in y around 0 3.8
if 3.7924148815698593e-114 < y Initial program 12.7
Applied *-un-lft-identity_binary6412.7
Applied times-frac_binary641.0
Simplified1.0
Final simplification1.8
herbie shell --seed 2022076
(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))