Average Error: 11.2 → 5.0
Time: 42.6s
Precision: 64
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;b1 \cdot b2 \le -1.8654071526797647 \cdot 10^{+191}:\\ \;\;\;\;\left(a2 \cdot \frac{a1}{b1}\right) \cdot \frac{1}{b2}\\ \mathbf{elif}\;b1 \cdot b2 \le -1.0176507098003041 \cdot 10^{-184}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{elif}\;b1 \cdot b2 \le 2.105160204145219 \cdot 10^{-202}:\\ \;\;\;\;\left(\frac{a1}{b1} \cdot \left(\sqrt[3]{a2} \cdot \sqrt[3]{a2}\right)\right) \cdot \frac{\sqrt[3]{a2}}{b2}\\ \mathbf{elif}\;b1 \cdot b2 \le 3.692200814826821 \cdot 10^{+161}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{else}:\\ \;\;\;\;\left(a2 \cdot \frac{a1}{b1}\right) \cdot \frac{1}{b2}\\ \end{array}\]
\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
\mathbf{if}\;b1 \cdot b2 \le -1.8654071526797647 \cdot 10^{+191}:\\
\;\;\;\;\left(a2 \cdot \frac{a1}{b1}\right) \cdot \frac{1}{b2}\\

\mathbf{elif}\;b1 \cdot b2 \le -1.0176507098003041 \cdot 10^{-184}:\\
\;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\

\mathbf{elif}\;b1 \cdot b2 \le 2.105160204145219 \cdot 10^{-202}:\\
\;\;\;\;\left(\frac{a1}{b1} \cdot \left(\sqrt[3]{a2} \cdot \sqrt[3]{a2}\right)\right) \cdot \frac{\sqrt[3]{a2}}{b2}\\

\mathbf{elif}\;b1 \cdot b2 \le 3.692200814826821 \cdot 10^{+161}:\\
\;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\

\mathbf{else}:\\
\;\;\;\;\left(a2 \cdot \frac{a1}{b1}\right) \cdot \frac{1}{b2}\\

\end{array}
double f(double a1, double a2, double b1, double b2) {
        double r17993607 = a1;
        double r17993608 = a2;
        double r17993609 = r17993607 * r17993608;
        double r17993610 = b1;
        double r17993611 = b2;
        double r17993612 = r17993610 * r17993611;
        double r17993613 = r17993609 / r17993612;
        return r17993613;
}

double f(double a1, double a2, double b1, double b2) {
        double r17993614 = b1;
        double r17993615 = b2;
        double r17993616 = r17993614 * r17993615;
        double r17993617 = -1.8654071526797647e+191;
        bool r17993618 = r17993616 <= r17993617;
        double r17993619 = a2;
        double r17993620 = a1;
        double r17993621 = r17993620 / r17993614;
        double r17993622 = r17993619 * r17993621;
        double r17993623 = 1.0;
        double r17993624 = r17993623 / r17993615;
        double r17993625 = r17993622 * r17993624;
        double r17993626 = -1.0176507098003041e-184;
        bool r17993627 = r17993616 <= r17993626;
        double r17993628 = r17993616 / r17993619;
        double r17993629 = r17993620 / r17993628;
        double r17993630 = 2.105160204145219e-202;
        bool r17993631 = r17993616 <= r17993630;
        double r17993632 = cbrt(r17993619);
        double r17993633 = r17993632 * r17993632;
        double r17993634 = r17993621 * r17993633;
        double r17993635 = r17993632 / r17993615;
        double r17993636 = r17993634 * r17993635;
        double r17993637 = 3.692200814826821e+161;
        bool r17993638 = r17993616 <= r17993637;
        double r17993639 = r17993638 ? r17993629 : r17993625;
        double r17993640 = r17993631 ? r17993636 : r17993639;
        double r17993641 = r17993627 ? r17993629 : r17993640;
        double r17993642 = r17993618 ? r17993625 : r17993641;
        return r17993642;
}

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original11.2
Target11.1
Herbie5.0
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 3 regimes
  2. if (* b1 b2) < -1.8654071526797647e+191 or 3.692200814826821e+161 < (* b1 b2)

    1. Initial program 14.2

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Using strategy rm
    3. Applied times-frac4.9

      \[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
    4. Using strategy rm
    5. Applied div-inv5.0

      \[\leadsto \frac{a1}{b1} \cdot \color{blue}{\left(a2 \cdot \frac{1}{b2}\right)}\]
    6. Applied associate-*r*5.1

      \[\leadsto \color{blue}{\left(\frac{a1}{b1} \cdot a2\right) \cdot \frac{1}{b2}}\]

    if -1.8654071526797647e+191 < (* b1 b2) < -1.0176507098003041e-184 or 2.105160204145219e-202 < (* b1 b2) < 3.692200814826821e+161

    1. Initial program 4.2

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Using strategy rm
    3. Applied associate-/l*4.1

      \[\leadsto \color{blue}{\frac{a1}{\frac{b1 \cdot b2}{a2}}}\]

    if -1.0176507098003041e-184 < (* b1 b2) < 2.105160204145219e-202

    1. Initial program 31.8

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Using strategy rm
    3. Applied times-frac8.8

      \[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity8.8

      \[\leadsto \frac{a1}{b1} \cdot \frac{a2}{\color{blue}{1 \cdot b2}}\]
    6. Applied add-cube-cbrt9.8

      \[\leadsto \frac{a1}{b1} \cdot \frac{\color{blue}{\left(\sqrt[3]{a2} \cdot \sqrt[3]{a2}\right) \cdot \sqrt[3]{a2}}}{1 \cdot b2}\]
    7. Applied times-frac9.8

      \[\leadsto \frac{a1}{b1} \cdot \color{blue}{\left(\frac{\sqrt[3]{a2} \cdot \sqrt[3]{a2}}{1} \cdot \frac{\sqrt[3]{a2}}{b2}\right)}\]
    8. Applied associate-*r*8.5

      \[\leadsto \color{blue}{\left(\frac{a1}{b1} \cdot \frac{\sqrt[3]{a2} \cdot \sqrt[3]{a2}}{1}\right) \cdot \frac{\sqrt[3]{a2}}{b2}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification5.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;b1 \cdot b2 \le -1.8654071526797647 \cdot 10^{+191}:\\ \;\;\;\;\left(a2 \cdot \frac{a1}{b1}\right) \cdot \frac{1}{b2}\\ \mathbf{elif}\;b1 \cdot b2 \le -1.0176507098003041 \cdot 10^{-184}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{elif}\;b1 \cdot b2 \le 2.105160204145219 \cdot 10^{-202}:\\ \;\;\;\;\left(\frac{a1}{b1} \cdot \left(\sqrt[3]{a2} \cdot \sqrt[3]{a2}\right)\right) \cdot \frac{\sqrt[3]{a2}}{b2}\\ \mathbf{elif}\;b1 \cdot b2 \le 3.692200814826821 \cdot 10^{+161}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{else}:\\ \;\;\;\;\left(a2 \cdot \frac{a1}{b1}\right) \cdot \frac{1}{b2}\\ \end{array}\]

Reproduce

herbie shell --seed 2019112 
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

  :herbie-target
  (* (/ a1 b1) (/ a2 b2))

  (/ (* a1 a2) (* b1 b2)))