\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
t_0 := \frac{a1 \cdot a2}{b1 \cdot b2}\\
t_1 := \frac{a1}{b1} \cdot \frac{a2}{b2}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq -1.7956579752851291 \cdot 10^{-292}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 4.1253792486547885 \cdot 10^{+274}:\\
\;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{\frac{1}{b2}}{b1}\\
\mathbf{else}:\\
\;\;\;\;\frac{a1}{\sqrt{b2}} \cdot \frac{\frac{a2}{\sqrt{b2}}}{b1}\\
\end{array}
(FPCore (a1 a2 b1 b2) :precision binary64 (/ (* a1 a2) (* b1 b2)))
(FPCore (a1 a2 b1 b2)
:precision binary64
(let* ((t_0 (/ (* a1 a2) (* b1 b2))) (t_1 (* (/ a1 b1) (/ a2 b2))))
(if (<= t_0 (- INFINITY))
t_1
(if (<= t_0 -1.7956579752851291e-292)
t_0
(if (<= t_0 0.0)
t_1
(if (<= t_0 4.1253792486547885e+274)
(* (* a1 a2) (/ (/ 1.0 b2) b1))
(* (/ a1 (sqrt b2)) (/ (/ a2 (sqrt b2)) b1))))))))double code(double a1, double a2, double b1, double b2) {
return (a1 * a2) / (b1 * b2);
}
double code(double a1, double a2, double b1, double b2) {
double t_0 = (a1 * a2) / (b1 * b2);
double t_1 = (a1 / b1) * (a2 / b2);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_0 <= -1.7956579752851291e-292) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 4.1253792486547885e+274) {
tmp = (a1 * a2) * ((1.0 / b2) / b1);
} else {
tmp = (a1 / sqrt(b2)) * ((a2 / sqrt(b2)) / b1);
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.4 |
|---|---|
| Target | 11.3 |
| Herbie | 3.7 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0 or -1.79565797528512915e-292 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 0.0Initial program 18.4
rmApplied times-frac_binary643.6
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -1.79565797528512915e-292Initial program 0.9
if 0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 4.1253792486547885e274Initial program 0.8
rmApplied div-inv_binary641.2
Simplified1.2
rmApplied associate-/r*_binary641.2
if 4.1253792486547885e274 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 54.8
rmApplied div-inv_binary6455.2
Simplified55.2
rmApplied *-un-lft-identity_binary6455.2
Applied times-frac_binary6455.2
Applied associate-*r*_binary6445.0
Simplified45.0
rmApplied add-sqr-sqrt_binary6448.8
Applied times-frac_binary6423.2
Applied associate-*l*_binary6422.7
Simplified22.7
Final simplification3.7
herbie shell --seed 2021202
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))