\frac{x \cdot \left(y - z\right)}{y}\begin{array}{l}
\mathbf{if}\;y \leq -1.0766423981689913 \cdot 10^{-63}:\\
\;\;\;\;x - x \cdot \frac{z}{y}\\
\mathbf{elif}\;y \leq 1.2558456771868084 \cdot 10^{-292}:\\
\;\;\;\;x - \frac{x \cdot z}{y}\\
\mathbf{elif}\;y \leq 9.067204618713828 \cdot 10^{-232}:\\
\;\;\;\;\frac{x}{\sqrt{y}} \cdot \frac{y - z}{\sqrt{y}}\\
\mathbf{elif}\;y \leq 9.608731286136189 \cdot 10^{-45}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x - x \cdot \frac{z}{y}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
(FPCore (x y z)
:precision binary64
(if (<= y -1.0766423981689913e-63)
(- x (* x (/ z y)))
(if (<= y 1.2558456771868084e-292)
(- x (/ (* x z) y))
(if (<= y 9.067204618713828e-232)
(* (/ x (sqrt y)) (/ (- y z) (sqrt y)))
(if (<= y 9.608731286136189e-45)
(* (- y z) (/ x y))
(- x (* x (/ 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.0766423981689913e-63) {
tmp = x - (x * (z / y));
} else if (y <= 1.2558456771868084e-292) {
tmp = x - ((x * z) / y);
} else if (y <= 9.067204618713828e-232) {
tmp = (x / sqrt(y)) * ((y - z) / sqrt(y));
} else if (y <= 9.608731286136189e-45) {
tmp = (y - z) * (x / y);
} else {
tmp = x - (x * (z / y));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.6 |
|---|---|
| Target | 3.1 |
| Herbie | 2.3 |
if y < -1.07664239816899128e-63 or 9.6087312861361891e-45 < y Initial program 14.8
rmApplied *-un-lft-identity_binary64_1985614.8
Applied times-frac_binary64_198620.3
Simplified0.3
Taylor expanded around 0 0.3
rmApplied sub-neg_binary64_198490.3
Applied distribute-rgt-in_binary64_198060.3
if -1.07664239816899128e-63 < y < 1.2558456771868084e-292Initial program 9.1
rmApplied associate-/l*_binary64_198018.6
Taylor expanded around 0 5.8
if 1.2558456771868084e-292 < y < 9.067204618713828e-232Initial program 12.0
rmApplied add-sqr-sqrt_binary64_1987812.2
Applied times-frac_binary64_198627.8
if 9.067204618713828e-232 < y < 9.6087312861361891e-45Initial program 6.3
rmApplied associate-/l*_binary64_198016.4
rmApplied associate-/r/_binary64_198026.4
Final simplification2.3
herbie shell --seed 2021015
(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))