\frac{x \cdot y}{z}\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -9.045700272126931 \cdot 10^{+266}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;x \cdot y \leq -2.9445408273232094 \cdot 10^{-289}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;x \cdot y \leq 1.781848335493602 \cdot 10^{-255}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;x \cdot y \leq 5.856676942585101 \cdot 10^{+246}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\frac{z}{x}}{y}}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* x y) z))
(FPCore (x y z)
:precision binary64
(if (<= (* x y) -9.045700272126931e+266)
(* x (/ y z))
(if (<= (* x y) -2.9445408273232094e-289)
(/ (* x y) z)
(if (<= (* x y) 1.781848335493602e-255)
(* x (/ y z))
(if (<= (* x y) 5.856676942585101e+246)
(/ (* x y) z)
(/ 1.0 (/ (/ z x) y)))))))double code(double x, double y, double z) {
return (x * y) / z;
}
double code(double x, double y, double z) {
double tmp;
if ((x * y) <= -9.045700272126931e+266) {
tmp = x * (y / z);
} else if ((x * y) <= -2.9445408273232094e-289) {
tmp = (x * y) / z;
} else if ((x * y) <= 1.781848335493602e-255) {
tmp = x * (y / z);
} else if ((x * y) <= 5.856676942585101e+246) {
tmp = (x * y) / z;
} else {
tmp = 1.0 / ((z / x) / y);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 6.1 |
|---|---|
| Target | 6.3 |
| Herbie | 0.2 |
if (*.f64 x y) < -9.0457002721269307e266 or -2.9445408273232094e-289 < (*.f64 x y) < 1.781848335493602e-255Initial program 19.5
rmApplied *-un-lft-identity_binary6419.5
Applied times-frac_binary640.2
if -9.0457002721269307e266 < (*.f64 x y) < -2.9445408273232094e-289 or 1.781848335493602e-255 < (*.f64 x y) < 5.85667694258510118e246Initial program 0.2
rmApplied *-un-lft-identity_binary640.2
Applied associate-/r*_binary640.2
if 5.85667694258510118e246 < (*.f64 x y) Initial program 36.6
rmApplied add-cube-cbrt_binary6437.1
Applied associate-/r*_binary6437.1
Simplified9.3
rmApplied clear-num_binary649.3
Simplified0.5
Final simplification0.2
herbie shell --seed 2021110
(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))