\frac{x \cdot y}{z}\begin{array}{l}
\mathbf{if}\;x \cdot y \le -3.2208625570158223 \cdot 10^{267}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;x \cdot y \le -1.09971896141137388 \cdot 10^{-228}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;x \cdot y \le 5.0223574014577535 \cdot 10^{-307}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{elif}\;x \cdot y \le 2.87915916409507102 \cdot 10^{171}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\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) <= -3.2208625570158223e+267)) {
VAR = (x / (z / y));
} else {
double VAR_1;
if (((x * y) <= -1.0997189614113739e-228)) {
VAR_1 = ((x * y) / z);
} else {
double VAR_2;
if (((x * y) <= 5.0223574014577535e-307)) {
VAR_2 = (y / (z / x));
} else {
double VAR_3;
if (((x * y) <= 2.879159164095071e+171)) {
VAR_3 = ((x * y) / z);
} else {
VAR_3 = (x * (y / z));
}
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 | 5.9 |
|---|---|
| Target | 6.2 |
| Herbie | 0.3 |
if (* x y) < -3.2208625570158223e+267Initial program 41.3
rmApplied associate-/l*0.3
if -3.2208625570158223e+267 < (* x y) < -1.0997189614113739e-228 or 5.0223574014577535e-307 < (* x y) < 2.879159164095071e+171Initial program 0.2
if -1.0997189614113739e-228 < (* x y) < 5.0223574014577535e-307Initial program 14.1
rmApplied *-commutative14.1
Applied associate-/l*0.2
if 2.879159164095071e+171 < (* x y) Initial program 21.5
rmApplied div-inv21.5
rmApplied associate-*l*1.7
Simplified1.6
Final simplification0.3
herbie shell --seed 2020071 +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))