\frac{x \cdot y}{z}
\begin{array}{l}
t_0 := \frac{x \cdot y}{z}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;t_0 \leq -1.1047486872844918 \cdot 10^{-289}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;t_0 \leq 6.439721645607079 \cdot 10^{+300}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\frac{z}{y}}{x}}\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* x y) z))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* x y) z)))
(if (<= t_0 (- INFINITY))
(* x (/ y z))
(if (<= t_0 -1.1047486872844918e-289)
t_0
(if (<= t_0 0.0)
(* y (/ x z))
(if (<= t_0 6.439721645607079e+300) t_0 (/ 1.0 (/ (/ z y) x))))))))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) / z;
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = x * (y / z);
} else if (t_0 <= -1.1047486872844918e-289) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = y * (x / z);
} else if (t_0 <= 6.439721645607079e+300) {
tmp = t_0;
} else {
tmp = 1.0 / ((z / y) / x);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 6.4 |
|---|---|
| Target | 6.2 |
| Herbie | 0.6 |
if (/.f64 (*.f64 x y) z) < -inf.0Initial program 64.0
Applied *-un-lft-identity_binary6464.0
Applied times-frac_binary640.3
Simplified0.3
if -inf.0 < (/.f64 (*.f64 x y) z) < -1.1047486872844918e-289 or -0.0 < (/.f64 (*.f64 x y) z) < 6.43972164560707933e300Initial program 0.5
if -1.1047486872844918e-289 < (/.f64 (*.f64 x y) z) < -0.0Initial program 11.8
Applied associate-/l*_binary640.9
Applied associate-/r/_binary640.7
if 6.43972164560707933e300 < (/.f64 (*.f64 x y) z) Initial program 58.2
Applied associate-/l*_binary641.8
Applied clear-num_binary641.8
Final simplification0.6
herbie shell --seed 2022020
(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))