\frac{x \cdot \left(y - z\right)}{y}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y - z\right)}{y} \leq 8.399881127348085 \cdot 10^{-16}:\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\
\mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \leq 3.830825279456158 \cdot 10^{+283}:\\
\;\;\;\;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 (<= (/ (* x (- y z)) y) 8.399881127348085e-16)
(/ x (/ y (- y z)))
(if (<= (/ (* x (- y z)) y) 3.830825279456158e+283)
(- 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 (((x * (y - z)) / y) <= 8.399881127348085e-16) {
tmp = x / (y / (y - z));
} else if (((x * (y - z)) / y) <= 3.830825279456158e+283) {
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 | 12.5 |
|---|---|
| Target | 3.2 |
| Herbie | 1.9 |
if (/.f64 (*.f64 x (-.f64 y z)) y) < 8.39988112734808504e-16Initial program 10.8
rmApplied sub-neg_binary6410.8
Applied distribute-rgt-in_binary6410.8
Simplified10.8
Simplified10.8
rmApplied distribute-rgt-neg-in_binary6410.8
Applied distribute-lft-out_binary6410.8
Applied associate-/l*_binary642.3
if 8.39988112734808504e-16 < (/.f64 (*.f64 x (-.f64 y z)) y) < 3.83082527945615827e283Initial program 0.2
Taylor expanded around 0 0.2
if 3.83082527945615827e283 < (/.f64 (*.f64 x (-.f64 y z)) y) Initial program 54.9
rmApplied *-un-lft-identity_binary6454.9
Applied times-frac_binary642.5
Final simplification1.9
herbie shell --seed 2021118
(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))