\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
t_0 := \frac{a2}{\sqrt[3]{b1}}\\
t_1 := \frac{a1 \cdot a2}{b1 \cdot b2}\\
t_2 := \frac{a1}{\sqrt[3]{b1} \cdot \sqrt[3]{b1}}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\frac{t_2}{\sqrt[3]{b2} \cdot \sqrt[3]{b2}} \cdot \frac{t_0}{\sqrt[3]{b2}}\\
\mathbf{elif}\;t_1 \leq -1.8818987516754908 \cdot 10^{-272}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;t_2 \cdot \frac{t_0}{b2}\\
\mathbf{elif}\;t_1 \leq 6.223294763088865 \cdot 10^{+283}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a2}{\frac{b2}{a1}}}{b1}\\
\end{array}
(FPCore (a1 a2 b1 b2) :precision binary64 (/ (* a1 a2) (* b1 b2)))
(FPCore (a1 a2 b1 b2)
:precision binary64
(let* ((t_0 (/ a2 (cbrt b1)))
(t_1 (/ (* a1 a2) (* b1 b2)))
(t_2 (/ a1 (* (cbrt b1) (cbrt b1)))))
(if (<= t_1 (- INFINITY))
(* (/ t_2 (* (cbrt b2) (cbrt b2))) (/ t_0 (cbrt b2)))
(if (<= t_1 -1.8818987516754908e-272)
t_1
(if (<= t_1 0.0)
(* t_2 (/ t_0 b2))
(if (<= t_1 6.223294763088865e+283) t_1 (/ (/ a2 (/ b2 a1)) 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 = a2 / cbrt(b1);
double t_1 = (a1 * a2) / (b1 * b2);
double t_2 = a1 / (cbrt(b1) * cbrt(b1));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (t_2 / (cbrt(b2) * cbrt(b2))) * (t_0 / cbrt(b2));
} else if (t_1 <= -1.8818987516754908e-272) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = t_2 * (t_0 / b2);
} else if (t_1 <= 6.223294763088865e+283) {
tmp = t_1;
} else {
tmp = (a2 / (b2 / a1)) / b1;
}
return tmp;
}




Bits error versus a1




Bits error versus a2




Bits error versus b1




Bits error versus b2
Results
| Original | 11.0 |
|---|---|
| Target | 11.1 |
| Herbie | 2.9 |
if (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -inf.0Initial program 64.0
Applied associate-/r*_binary6435.5
Applied add-cube-cbrt_binary6436.1
Applied add-cube-cbrt_binary6436.2
Applied times-frac_binary6418.7
Applied times-frac_binary6410.0
if -inf.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -1.881898751675491e-272 or -0.0 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < 6.22329476308886536e283Initial program 0.9
Applied associate-/r*_binary647.8
Applied clear-num_binary648.1
Applied *-un-lft-identity_binary648.1
Applied *-un-lft-identity_binary648.1
Applied times-frac_binary648.1
Applied add-cube-cbrt_binary648.1
Applied times-frac_binary648.1
Simplified8.1
Simplified0.9
if -1.881898751675491e-272 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) < -0.0Initial program 12.5
Applied associate-/r*_binary646.6
Applied *-un-lft-identity_binary646.6
Applied add-cube-cbrt_binary646.8
Applied times-frac_binary643.8
Applied times-frac_binary642.7
Simplified2.7
if 6.22329476308886536e283 < (/.f64 (*.f64 a1 a2) (*.f64 b1 b2)) Initial program 57.8
Applied associate-/r*_binary6444.9
Applied clear-num_binary6444.9
Applied associate-/r/_binary6446.0
Applied associate-/r*_binary6446.0
Simplified15.8
Final simplification2.9
herbie shell --seed 2022039
(FPCore (a1 a2 b1 b2)
:name "Quotient of products"
:precision binary64
:herbie-target
(* (/ a1 b1) (/ a2 b2))
(/ (* a1 a2) (* b1 b2)))