\frac{x \cdot y}{z}
\begin{array}{l}
t_0 := x \cdot \left(y \cdot \frac{1}{z}\right)\\
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \frac{x \cdot y}{z}\\
\mathbf{if}\;x \cdot y \leq -1.8163180963152013 \cdot 10^{-294}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 7.786274374292473 \cdot 10^{-152}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \cdot y \leq 1.8431651856544696 \cdot 10^{+230}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* x y) z))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* y (/ 1.0 z)))))
(if (<= (* x y) (- INFINITY))
t_0
(let* ((t_1 (/ (* x y) z)))
(if (<= (* x y) -1.8163180963152013e-294)
t_1
(if (<= (* x y) 7.786274374292473e-152)
t_0
(if (<= (* x y) 1.8431651856544696e+230) t_1 (* x (/ y z)))))))))double code(double x, double y, double z) {
return (x * y) / z;
}
double code(double x, double y, double z) {
double t_0 = x * (y * (1.0 / z));
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = t_0;
} else {
double t_1 = (x * y) / z;
double tmp_1;
if ((x * y) <= -1.8163180963152013e-294) {
tmp_1 = t_1;
} else if ((x * y) <= 7.786274374292473e-152) {
tmp_1 = t_0;
} else if ((x * y) <= 1.8431651856544696e+230) {
tmp_1 = t_1;
} else {
tmp_1 = x * (y / z);
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 6.4 |
|---|---|
| Target | 6.1 |
| Herbie | 0.4 |
if (*.f64 x y) < -inf.0 or -1.81631809631520133e-294 < (*.f64 x y) < 7.7862743742924726e-152Initial program 15.9
Applied div-inv_binary6415.9
Applied associate-*l*_binary640.7
if -inf.0 < (*.f64 x y) < -1.81631809631520133e-294 or 7.7862743742924726e-152 < (*.f64 x y) < 1.84316518565446964e230Initial program 0.2
if 1.84316518565446964e230 < (*.f64 x y) Initial program 32.7
Applied *-un-lft-identity_binary6432.7
Applied times-frac_binary640.7
Simplified0.7
Final simplification0.4
herbie shell --seed 2021313
(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))