\frac{x \cdot y}{z}
\begin{array}{l}
t_0 := \frac{x}{\frac{z}{y}}\\
\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 -7.01133933954049 \cdot 10^{-133}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 4.6898775201 \cdot 10^{-313}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;x \cdot y \leq 6.9663080033419285 \cdot 10^{+134}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* x y) z))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ x (/ z y))))
(if (<= (* x y) (- INFINITY))
t_0
(let* ((t_1 (/ (* x y) z)))
(if (<= (* x y) -7.01133933954049e-133)
t_1
(if (<= (* x y) 4.6898775201e-313)
(* y (/ x z))
(if (<= (* x y) 6.9663080033419285e+134) t_1 t_0)))))))double code(double x, double y, double z) {
return (x * y) / z;
}
double code(double x, double y, double z) {
double t_0 = x / (z / y);
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = t_0;
} else {
double t_1 = (x * y) / z;
double tmp_1;
if ((x * y) <= -7.01133933954049e-133) {
tmp_1 = t_1;
} else if ((x * y) <= 4.6898775201e-313) {
tmp_1 = y * (x / z);
} else if ((x * y) <= 6.9663080033419285e+134) {
tmp_1 = t_1;
} else {
tmp_1 = t_0;
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 6.4 |
|---|---|
| Target | 6.3 |
| Herbie | 0.8 |
if (*.f64 x y) < -inf.0 or 6.9663080033419285e134 < (*.f64 x y) Initial program 27.8
Applied associate-/l*_binary642.6
if -inf.0 < (*.f64 x y) < -7.01133933954049005e-133 or 4.68987752008e-313 < (*.f64 x y) < 6.9663080033419285e134Initial program 0.2
Applied add-cube-cbrt_binary641.3
Applied times-frac_binary647.5
Taylor expanded in x around 0 0.2
if -7.01133933954049005e-133 < (*.f64 x y) < 4.68987752008e-313Initial program 11.2
Applied add-cube-cbrt_binary6411.6
Applied times-frac_binary641.0
Taylor expanded in x around 0 11.2
Applied *-un-lft-identity_binary6411.2
Applied times-frac_binary641.1
Final simplification0.8
herbie shell --seed 2022077
(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))