\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.9759413487806496 \cdot 10^{-286}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 3.004346289623228 \cdot 10^{-194}:\\
\;\;\;\;\left(\frac{a1}{b1} \cdot \frac{\sqrt[3]{a2} \cdot \sqrt[3]{a2}}{\sqrt[3]{b2} \cdot \sqrt[3]{b2}}\right) \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}\\
\mathbf{elif}\;t_0 \leq 3.667731104533553 \cdot 10^{+305}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\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.9759413487806496e-286)
t_0
(if (<= t_0 3.004346289623228e-194)
(*
(* (/ a1 b1) (/ (* (cbrt a2) (cbrt a2)) (* (cbrt b2) (cbrt b2))))
(/ (cbrt a2) (cbrt b2)))
(if (<= t_0 3.667731104533553e+305) t_0 t_1))))))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.9759413487806496e-286) {
tmp = t_0;
} else if (t_0 <= 3.004346289623228e-194) {
tmp = ((a1 / b1) * ((cbrt(a2) * cbrt(a2)) / (cbrt(b2) * cbrt(b2)))) * (cbrt(a2) / cbrt(b2));
} else if (t_0 <= 3.667731104533553e+305) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.4 |
|---|---|
| Target | 10.9 |
| Herbie | 2.3 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0 or 3.6677311045335531e305 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 63.8
Applied times-frac_binary647.4
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -1.97594134878064955e-286 or 3.0043462896232282e-194 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 3.6677311045335531e305Initial program 0.8
Applied times-frac_binary6416.1
Taylor expanded in a1 around 0 0.8
if -1.97594134878064955e-286 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 3.0043462896232282e-194Initial program 11.8
Applied times-frac_binary644.8
Applied add-cube-cbrt_binary645.0
Applied add-cube-cbrt_binary645.1
Applied times-frac_binary645.1
Applied associate-*r*_binary643.1
Final simplification2.3
herbie shell --seed 2022160
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))