\frac{x \cdot y}{z}\begin{array}{l}
\mathbf{if}\;x \cdot y \le -5.3410482028785801 \cdot 10^{162}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;x \cdot y \le -2.16750548614418782 \cdot 10^{-63}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;x \cdot y \le 2.47033 \cdot 10^{-323}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;x \cdot y \le 1.92506525785641613 \cdot 10^{197}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}double code(double x, double y, double z) {
return ((x * y) / z);
}
double code(double x, double y, double z) {
double VAR;
if (((x * y) <= -5.34104820287858e+162)) {
VAR = (x / (z / y));
} else {
double VAR_1;
if (((x * y) <= -2.1675054861441878e-63)) {
VAR_1 = ((x * y) / z);
} else {
double VAR_2;
if (((x * y) <= 2.4703282292062e-323)) {
VAR_2 = (x * (y / z));
} else {
double VAR_3;
if (((x * y) <= 1.925065257856416e+197)) {
VAR_3 = ((x * y) / z);
} else {
VAR_3 = (x / (z / y));
}
VAR_2 = VAR_3;
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 6.2 |
|---|---|
| Target | 6.2 |
| Herbie | 1.2 |
if (* x y) < -5.34104820287858e+162 or 1.925065257856416e+197 < (* x y) Initial program 20.7
rmApplied associate-/l*1.6
if -5.34104820287858e+162 < (* x y) < -2.1675054861441878e-63 or 2.4703282292062e-323 < (* x y) < 1.925065257856416e+197Initial program 0.4
if -2.1675054861441878e-63 < (* x y) < 2.4703282292062e-323Initial program 9.4
rmApplied *-un-lft-identity9.4
Applied times-frac2.4
Simplified2.4
Final simplification1.2
herbie shell --seed 2020092 +o rules:numerics
(FPCore (x y z)
:name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:herbie-target
(if (< z -4.262230790519429e-138) (/ (* x y) z) (if (< z 1.7042130660650472e-164) (/ x (/ z y)) (* (/ x z) y)))
(/ (* x y) z))