\frac{x \cdot y}{z}
\begin{array}{l}
t_0 := \frac{x}{\frac{z}{y}}\\
\mathbf{if}\;x \cdot y \leq -9.542298578082682 \cdot 10^{+195}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \frac{x \cdot y}{z}\\
\mathbf{if}\;x \cdot y \leq -3.896175260889643 \cdot 10^{-209}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 3.456872220211211 \cdot 10^{-262}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;x \cdot y \leq 6.549991231650657 \cdot 10^{+206}:\\
\;\;\;\;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) -9.542298578082682e+195)
t_0
(let* ((t_1 (/ (* x y) z)))
(if (<= (* x y) -3.896175260889643e-209)
t_1
(if (<= (* x y) 3.456872220211211e-262)
(* x (/ y z))
(if (<= (* x y) 6.549991231650657e+206) 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) <= -9.542298578082682e+195) {
tmp = t_0;
} else {
double t_1 = (x * y) / z;
double tmp_1;
if ((x * y) <= -3.896175260889643e-209) {
tmp_1 = t_1;
} else if ((x * y) <= 3.456872220211211e-262) {
tmp_1 = x * (y / z);
} else if ((x * y) <= 6.549991231650657e+206) {
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.0 |
|---|---|
| Target | 6.2 |
| Herbie | 0.3 |
if (*.f64 x y) < -9.542298578082682e195 or 6.5499912316506572e206 < (*.f64 x y) Initial program 26.5
Applied associate-/l*_binary640.9
if -9.542298578082682e195 < (*.f64 x y) < -3.8961752608896429e-209 or 3.4568722202112109e-262 < (*.f64 x y) < 6.5499912316506572e206Initial program 0.2
Applied clear-num_binary640.5
Applied associate-/r*_binary649.7
Applied *-un-lft-identity_binary649.7
Applied *-un-lft-identity_binary649.7
Applied *-un-lft-identity_binary649.7
Applied times-frac_binary649.7
Applied times-frac_binary649.7
Applied add-cube-cbrt_binary649.7
Applied times-frac_binary649.7
Simplified9.7
Simplified0.2
if -3.8961752608896429e-209 < (*.f64 x y) < 3.4568722202112109e-262Initial program 11.9
Applied *-un-lft-identity_binary6411.9
Applied times-frac_binary640.3
Final simplification0.3
herbie shell --seed 2022081
(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))