\frac{x \cdot \left(y - z\right)}{y}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y - z\right)}{y} \leq -\infty:\\
\;\;\;\;x \cdot \frac{1}{\frac{y}{y - z}}\\
\mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \leq -1.0180063867341753 \cdot 10^{+171}:\\
\;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
(FPCore (x y z)
:precision binary64
(if (<= (/ (* x (- y z)) y) (- INFINITY))
(* x (/ 1.0 (/ y (- y z))))
(if (<= (/ (* x (- y z)) y) -1.0180063867341753e+171)
(/ (* x (- y z)) y)
(/ x (/ y (- y z))))))double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
double code(double x, double y, double z) {
double tmp;
if (((x * (y - z)) / y) <= -((double) INFINITY)) {
tmp = x * (1.0 / (y / (y - z)));
} else if (((x * (y - z)) / y) <= -1.0180063867341753e+171) {
tmp = (x * (y - z)) / y;
} else {
tmp = x / (y / (y - z));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.9 |
|---|---|
| Target | 3.1 |
| Herbie | 2.3 |
if (/.f64 (*.f64 x (-.f64 y z)) y) < -inf.0Initial program 64.0
rmApplied *-un-lft-identity_binary6464.0
Applied times-frac_binary640.1
Simplified0.1
rmApplied clear-num_binary640.1
if -inf.0 < (/.f64 (*.f64 x (-.f64 y z)) y) < -1.0180063867341753e171Initial program 0.2
if -1.0180063867341753e171 < (/.f64 (*.f64 x (-.f64 y z)) y) Initial program 9.4
rmApplied associate-/l*_binary642.7
Final simplification2.3
herbie shell --seed 2020268
(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))