\frac{x \cdot \left(y - z\right)}{y}\begin{array}{l}
\mathbf{if}\;x \leq -1.63699500564847 \cdot 10^{-96}:\\
\;\;\;\;x \cdot \frac{y - z}{y}\\
\mathbf{elif}\;x \leq 5.016104641969166 \cdot 10^{-67}:\\
\;\;\;\;x - \frac{x \cdot z}{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 -1.63699500564847e-96) (* x (/ (- y z) y)) (if (<= x 5.016104641969166e-67) (- x (/ (* x 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 <= -1.63699500564847e-96) {
tmp = x * ((y - z) / y);
} else if (x <= 5.016104641969166e-67) {
tmp = x - ((x * 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.6 |
|---|---|
| Target | 3.0 |
| Herbie | 1.8 |
if x < -1.63699500564847e-96Initial program 16.5
rmApplied *-un-lft-identity_binary64_1985616.5
Applied times-frac_binary64_198620.7
Simplified0.7
if -1.63699500564847e-96 < x < 5.0161046419691658e-67Initial program 6.3
rmApplied div-inv_binary64_198536.4
Taylor expanded around 0 3.4
if 5.0161046419691658e-67 < x Initial program 18.5
rmApplied associate-/l*_binary64_198010.5
Final simplification1.8
herbie shell --seed 2020342
(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))