\frac{x \cdot \left(y - z\right)}{y}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y - z\right)}{y} \leq -2.1473147582397338 \cdot 10^{+293}:\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\
\mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \leq -8.814136530602186 \cdot 10^{+28}:\\
\;\;\;\;x - \frac{x \cdot z}{y}\\
\mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \leq 0:\\
\;\;\;\;x \cdot \frac{y - z}{y}\\
\mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \leq 5.508883096360809 \cdot 10^{+302}:\\
\;\;\;\;x - \frac{x \cdot z}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{y}\right)\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
(FPCore (x y z)
:precision binary64
(if (<= (/ (* x (- y z)) y) -2.1473147582397338e+293)
(/ x (/ y (- y z)))
(if (<= (/ (* x (- y z)) y) -8.814136530602186e+28)
(- x (/ (* x z) y))
(if (<= (/ (* x (- y z)) y) 0.0)
(* x (/ (- y z) y))
(if (<= (/ (* x (- y z)) y) 5.508883096360809e+302)
(- x (/ (* x z) y))
(* x (- 1.0 (/ 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) <= -2.1473147582397338e+293) {
tmp = x / (y / (y - z));
} else if (((x * (y - z)) / y) <= -8.814136530602186e+28) {
tmp = x - ((x * z) / y);
} else if (((x * (y - z)) / y) <= 0.0) {
tmp = x * ((y - z) / y);
} else if (((x * (y - z)) / y) <= 5.508883096360809e+302) {
tmp = x - ((x * z) / y);
} else {
tmp = x * (1.0 - (z / y));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.2 |
|---|---|
| Target | 2.9 |
| Herbie | 0.4 |
if (/.f64 (*.f64 x (-.f64 y z)) y) < -2.1473147582397338e293Initial program 58.2
rmApplied associate-/l*_binary64_187781.3
if -2.1473147582397338e293 < (/.f64 (*.f64 x (-.f64 y z)) y) < -8.8141365306021856e28 or -0.0 < (/.f64 (*.f64 x (-.f64 y z)) y) < 5.50888309636080925e302Initial program 0.4
rmApplied associate-/l*_binary64_187784.9
Taylor expanded around 0 0.3
if -8.8141365306021856e28 < (/.f64 (*.f64 x (-.f64 y z)) y) < -0.0Initial program 10.9
rmApplied *-un-lft-identity_binary64_1883310.9
Applied times-frac_binary64_188390.2
Simplified0.2
if 5.50888309636080925e302 < (/.f64 (*.f64 x (-.f64 y z)) y) Initial program 62.1
rmApplied associate-/l*_binary64_187780.6
rmApplied div-inv_binary64_188300.6
Simplified0.6
Final simplification0.4
herbie shell --seed 2021019
(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))