Average Error: 11.3 → 5.9
Time: 13.8s
Precision: 64
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;b1 \cdot b2 \le -4.9182133109132441 \cdot 10^{88}:\\ \;\;\;\;\frac{a1 \cdot \frac{a2}{b2}}{b1}\\ \mathbf{elif}\;b1 \cdot b2 \le -3.7720840321361484 \cdot 10^{-215}:\\ \;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\ \mathbf{elif}\;b1 \cdot b2 \le 2.02333864 \cdot 10^{-317}:\\ \;\;\;\;\frac{\frac{a1}{b1} \cdot a2}{b2}\\ \mathbf{elif}\;b1 \cdot b2 \le 3.785288238963702 \cdot 10^{229}:\\ \;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{\frac{a1}{b1}} \cdot \sqrt[3]{\frac{a1}{b1}}\right) \cdot \left(\sqrt[3]{\frac{a1}{b1}} \cdot \frac{a2}{b2}\right)\\ \end{array}\]
\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
\mathbf{if}\;b1 \cdot b2 \le -4.9182133109132441 \cdot 10^{88}:\\
\;\;\;\;\frac{a1 \cdot \frac{a2}{b2}}{b1}\\

\mathbf{elif}\;b1 \cdot b2 \le -3.7720840321361484 \cdot 10^{-215}:\\
\;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\

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

\mathbf{elif}\;b1 \cdot b2 \le 3.785288238963702 \cdot 10^{229}:\\
\;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\

\mathbf{else}:\\
\;\;\;\;\left(\sqrt[3]{\frac{a1}{b1}} \cdot \sqrt[3]{\frac{a1}{b1}}\right) \cdot \left(\sqrt[3]{\frac{a1}{b1}} \cdot \frac{a2}{b2}\right)\\

\end{array}
double f(double a1, double a2, double b1, double b2) {
        double r116619 = a1;
        double r116620 = a2;
        double r116621 = r116619 * r116620;
        double r116622 = b1;
        double r116623 = b2;
        double r116624 = r116622 * r116623;
        double r116625 = r116621 / r116624;
        return r116625;
}

double f(double a1, double a2, double b1, double b2) {
        double r116626 = b1;
        double r116627 = b2;
        double r116628 = r116626 * r116627;
        double r116629 = -4.918213310913244e+88;
        bool r116630 = r116628 <= r116629;
        double r116631 = a1;
        double r116632 = a2;
        double r116633 = r116632 / r116627;
        double r116634 = r116631 * r116633;
        double r116635 = r116634 / r116626;
        double r116636 = -3.7720840321361484e-215;
        bool r116637 = r116628 <= r116636;
        double r116638 = r116631 * r116632;
        double r116639 = 1.0;
        double r116640 = r116639 / r116628;
        double r116641 = r116638 * r116640;
        double r116642 = 2.0233386402977e-317;
        bool r116643 = r116628 <= r116642;
        double r116644 = r116631 / r116626;
        double r116645 = r116644 * r116632;
        double r116646 = r116645 / r116627;
        double r116647 = 3.785288238963702e+229;
        bool r116648 = r116628 <= r116647;
        double r116649 = cbrt(r116644);
        double r116650 = r116649 * r116649;
        double r116651 = r116649 * r116633;
        double r116652 = r116650 * r116651;
        double r116653 = r116648 ? r116641 : r116652;
        double r116654 = r116643 ? r116646 : r116653;
        double r116655 = r116637 ? r116641 : r116654;
        double r116656 = r116630 ? r116635 : r116655;
        return r116656;
}

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.3
Target11.8
Herbie5.9
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 4 regimes
  2. if (* b1 b2) < -4.918213310913244e+88

    1. Initial program 12.1

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

      \[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
    4. Using strategy rm
    5. Applied associate-*l/7.9

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

    if -4.918213310913244e+88 < (* b1 b2) < -3.7720840321361484e-215 or 2.0233386402977e-317 < (* b1 b2) < 3.785288238963702e+229

    1. Initial program 4.6

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

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

    if -3.7720840321361484e-215 < (* b1 b2) < 2.0233386402977e-317

    1. Initial program 44.2

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

      \[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
    4. Using strategy rm
    5. Applied associate-*r/9.8

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

    if 3.785288238963702e+229 < (* b1 b2)

    1. Initial program 16.9

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

      \[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
    4. Using strategy rm
    5. Applied add-cube-cbrt4.3

      \[\leadsto \color{blue}{\left(\left(\sqrt[3]{\frac{a1}{b1}} \cdot \sqrt[3]{\frac{a1}{b1}}\right) \cdot \sqrt[3]{\frac{a1}{b1}}\right)} \cdot \frac{a2}{b2}\]
    6. Applied associate-*l*4.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b1 \cdot b2 \le -4.9182133109132441 \cdot 10^{88}:\\ \;\;\;\;\frac{a1 \cdot \frac{a2}{b2}}{b1}\\ \mathbf{elif}\;b1 \cdot b2 \le -3.7720840321361484 \cdot 10^{-215}:\\ \;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\ \mathbf{elif}\;b1 \cdot b2 \le 2.02333864 \cdot 10^{-317}:\\ \;\;\;\;\frac{\frac{a1}{b1} \cdot a2}{b2}\\ \mathbf{elif}\;b1 \cdot b2 \le 3.785288238963702 \cdot 10^{229}:\\ \;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{\frac{a1}{b1}} \cdot \sqrt[3]{\frac{a1}{b1}}\right) \cdot \left(\sqrt[3]{\frac{a1}{b1}} \cdot \frac{a2}{b2}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019199 +o rules:numerics
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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