\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
t_0 := \frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{if}\;t_0 \leq -9.070334479927686 \cdot 10^{+287}:\\
\;\;\;\;\frac{1}{\frac{b1}{a1}} \cdot \frac{1}{\frac{b2}{a2}}\\
\mathbf{elif}\;t_0 \leq -1.2861353814587239 \cdot 10^{-303}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\frac{\sqrt[3]{a2} \cdot \sqrt[3]{a2}}{\frac{b1}{\sqrt[3]{a1} \cdot \sqrt[3]{a1}}} \cdot \frac{\sqrt[3]{a2}}{\frac{b2}{\sqrt[3]{a1}}}\\
\mathbf{elif}\;t_0 \leq 8.508576472122102 \cdot 10^{+294}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a2}{b2}}{\frac{b1}{a1}}\\
\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))))
(if (<= t_0 -9.070334479927686e+287)
(* (/ 1.0 (/ b1 a1)) (/ 1.0 (/ b2 a2)))
(if (<= t_0 -1.2861353814587239e-303)
t_0
(if (<= t_0 0.0)
(*
(/ (* (cbrt a2) (cbrt a2)) (/ b1 (* (cbrt a1) (cbrt a1))))
(/ (cbrt a2) (/ b2 (cbrt a1))))
(if (<= t_0 8.508576472122102e+294) t_0 (/ (/ a2 b2) (/ b1 a1))))))))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 tmp;
if (t_0 <= -9.070334479927686e+287) {
tmp = (1.0 / (b1 / a1)) * (1.0 / (b2 / a2));
} else if (t_0 <= -1.2861353814587239e-303) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = ((cbrt(a2) * cbrt(a2)) / (b1 / (cbrt(a1) * cbrt(a1)))) * (cbrt(a2) / (b2 / cbrt(a1)));
} else if (t_0 <= 8.508576472122102e+294) {
tmp = t_0;
} else {
tmp = (a2 / b2) / (b1 / a1);
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.3 |
|---|---|
| Target | 11.4 |
| Herbie | 2.1 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -9.07033447992768629e287Initial program 54.0
Applied clear-num_binary6454.0
Applied times-frac_binary6413.5
Applied *-un-lft-identity_binary6413.5
Applied times-frac_binary6414.3
if -9.07033447992768629e287 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -1.2861353814587239e-303 or 0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 8.5085764721221019e294Initial program 0.7
if -1.2861353814587239e-303 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 0.0Initial program 13.3
Applied clear-num_binary6413.7
Applied associate-/r*_binary648.2
Applied add-cube-cbrt_binary648.3
Applied add-cube-cbrt_binary648.3
Applied times-frac_binary645.0
Applied times-frac_binary643.2
Applied add-cube-cbrt_binary643.2
Applied times-frac_binary642.5
Simplified2.4
Simplified2.4
if 8.5085764721221019e294 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 61.2
Applied clear-num_binary6461.2
Applied associate-/r*_binary6448.0
Taylor expanded in b1 around 0 61.2
Simplified48.0
Applied *-un-lft-identity_binary6448.0
Applied times-frac_binary6412.7
Applied associate-/r*_binary645.4
Simplified5.4
Final simplification2.1
herbie shell --seed 2022125
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))