\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 -8.400079601776277 \cdot 10^{-290}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\left(\sqrt[3]{a1} \cdot \sqrt[3]{a1}\right) \cdot \left(\left(\frac{\sqrt[3]{a1}}{b1} \cdot \left(\sqrt[3]{a2} \cdot \sqrt[3]{a2}\right)\right) \cdot \frac{\sqrt[3]{a2}}{b2}\right)\\
\mathbf{elif}\;t_0 \leq 3.589237135653206 \cdot 10^{+299}:\\
\;\;\;\;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 -8.400079601776277e-290)
t_0
(if (<= t_0 0.0)
(*
(* (cbrt a1) (cbrt a1))
(* (* (/ (cbrt a1) b1) (* (cbrt a2) (cbrt a2))) (/ (cbrt a2) b2)))
(if (<= t_0 3.589237135653206e+299) 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 <= -8.400079601776277e-290) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = (cbrt(a1) * cbrt(a1)) * (((cbrt(a1) / b1) * (cbrt(a2) * cbrt(a2))) * (cbrt(a2) / b2));
} else if (t_0 <= 3.589237135653206e+299) {
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 | 11.6 |
| Herbie | 2.5 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0 or 3.58923713565320618e299 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 62.5
Applied times-frac_binary648.3
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -8.4000796017762771e-290 or -0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 3.58923713565320618e299Initial program 0.9
if -8.4000796017762771e-290 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -0.0Initial program 13.1
Applied times-frac_binary642.7
Applied *-un-lft-identity_binary642.7
Applied add-cube-cbrt_binary642.9
Applied times-frac_binary642.9
Applied associate-*l*_binary643.8
Applied *-un-lft-identity_binary643.8
Applied add-cube-cbrt_binary643.8
Applied times-frac_binary643.8
Applied associate-*r*_binary643.4
Simplified3.4
Final simplification2.5
herbie shell --seed 2022081
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))