\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
t_0 := \frac{a1 \cdot a2}{b1 \cdot b2}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;\frac{a2}{\frac{b2}{\frac{a1}{b1}}}\\
\mathbf{elif}\;t_0 \leq -1.6 \cdot 10^{-322}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\frac{\frac{a1}{\sqrt[3]{b1} \cdot \sqrt[3]{b1}}}{\sqrt[3]{b2} \cdot \sqrt[3]{b2}} \cdot \frac{\frac{a2}{\sqrt[3]{b1}}}{\sqrt[3]{b2}}\\
\mathbf{elif}\;t_0 \leq 8.976436028657778 \cdot 10^{+264}:\\
\;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{\frac{1}{b1}}{b2}\\
\mathbf{else}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\
\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 (- INFINITY))
(/ a2 (/ b2 (/ a1 b1)))
(if (<= t_0 -1.6e-322)
t_0
(if (<= t_0 0.0)
(*
(/ (/ a1 (* (cbrt b1) (cbrt b1))) (* (cbrt b2) (cbrt b2)))
(/ (/ a2 (cbrt b1)) (cbrt b2)))
(if (<= t_0 8.976436028657778e+264)
(* (* a1 a2) (/ (/ 1.0 b1) b2))
(* (/ a1 b1) (/ a2 b2))))))))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 <= -((double) INFINITY)) {
tmp = a2 / (b2 / (a1 / b1));
} else if (t_0 <= -1.6e-322) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = ((a1 / (cbrt(b1) * cbrt(b1))) / (cbrt(b2) * cbrt(b2))) * ((a2 / cbrt(b1)) / cbrt(b2));
} else if (t_0 <= 8.976436028657778e+264) {
tmp = (a1 * a2) * ((1.0 / b1) / b2);
} else {
tmp = (a1 / b1) * (a2 / b2);
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.4 |
|---|---|
| Target | 11.5 |
| Herbie | 2.6 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0Initial program 64.0
Applied associate-/r*_binary6432.7
Simplified19.1
Applied associate-/l*_binary6417.3
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -1.58101e-322Initial program 0.8
Applied associate-/r*_binary648.8
Taylor expanded in a1 around 0 0.8
if -1.58101e-322 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -0.0Initial program 14.4
Applied associate-/r*_binary646.9
Applied add-cube-cbrt_binary647.1
Applied add-cube-cbrt_binary647.1
Applied times-frac_binary643.8
Applied times-frac_binary642.1
if -0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 8.97643602865777766e264Initial program 0.8
Applied associate-/r*_binary647.3
Applied *-un-lft-identity_binary647.3
Applied div-inv_binary647.4
Applied times-frac_binary641.2
if 8.97643602865777766e264 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 53.5
Applied times-frac_binary649.3
Final simplification2.6
herbie shell --seed 2022067
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))