Average Error: 11.0 → 2.6
Time: 20.5s
Precision: 64
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} = -\infty:\\ \;\;\;\;\frac{a2 \cdot \frac{a1}{b1}}{b2}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -3.378626986605869 \cdot 10^{-297}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -0.0:\\ \;\;\;\;\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}} \cdot \frac{a1}{\frac{b1}{\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}} \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}}}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 6.0388420886701275 \cdot 10^{+293}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{a1}{\frac{b1}{\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}}} \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}\right) \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}\\ \end{array}\]
\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
\mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} = -\infty:\\
\;\;\;\;\frac{a2 \cdot \frac{a1}{b1}}{b2}\\

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

\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -0.0:\\
\;\;\;\;\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}} \cdot \frac{a1}{\frac{b1}{\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}} \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}}}\\

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

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

\end{array}
double f(double a1, double a2, double b1, double b2) {
        double r6842677 = a1;
        double r6842678 = a2;
        double r6842679 = r6842677 * r6842678;
        double r6842680 = b1;
        double r6842681 = b2;
        double r6842682 = r6842680 * r6842681;
        double r6842683 = r6842679 / r6842682;
        return r6842683;
}

double f(double a1, double a2, double b1, double b2) {
        double r6842684 = a1;
        double r6842685 = a2;
        double r6842686 = r6842684 * r6842685;
        double r6842687 = b1;
        double r6842688 = b2;
        double r6842689 = r6842687 * r6842688;
        double r6842690 = r6842686 / r6842689;
        double r6842691 = -inf.0;
        bool r6842692 = r6842690 <= r6842691;
        double r6842693 = r6842684 / r6842687;
        double r6842694 = r6842685 * r6842693;
        double r6842695 = r6842694 / r6842688;
        double r6842696 = -3.378626986605869e-297;
        bool r6842697 = r6842690 <= r6842696;
        double r6842698 = -0.0;
        bool r6842699 = r6842690 <= r6842698;
        double r6842700 = cbrt(r6842685);
        double r6842701 = cbrt(r6842688);
        double r6842702 = r6842700 / r6842701;
        double r6842703 = r6842702 * r6842702;
        double r6842704 = r6842687 / r6842703;
        double r6842705 = r6842684 / r6842704;
        double r6842706 = r6842702 * r6842705;
        double r6842707 = 6.0388420886701275e+293;
        bool r6842708 = r6842690 <= r6842707;
        double r6842709 = r6842687 / r6842702;
        double r6842710 = r6842684 / r6842709;
        double r6842711 = r6842710 * r6842702;
        double r6842712 = r6842711 * r6842702;
        double r6842713 = r6842708 ? r6842690 : r6842712;
        double r6842714 = r6842699 ? r6842706 : r6842713;
        double r6842715 = r6842697 ? r6842690 : r6842714;
        double r6842716 = r6842692 ? r6842695 : r6842715;
        return r6842716;
}

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.0
Target11.1
Herbie2.6
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 4 regimes
  2. if (/ (* a1 a2) (* b1 b2)) < -inf.0

    1. Initial program 59.9

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

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

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

    if -inf.0 < (/ (* a1 a2) (* b1 b2)) < -3.378626986605869e-297 or -0.0 < (/ (* a1 a2) (* b1 b2)) < 6.0388420886701275e+293

    1. Initial program 0.9

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]

    if -3.378626986605869e-297 < (/ (* a1 a2) (* b1 b2)) < -0.0

    1. Initial program 14.1

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

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

      \[\leadsto \frac{a1}{b1} \cdot \frac{a2}{\color{blue}{\left(\sqrt[3]{b2} \cdot \sqrt[3]{b2}\right) \cdot \sqrt[3]{b2}}}\]
    6. Applied add-cube-cbrt3.0

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

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

      \[\leadsto \color{blue}{\left(\frac{a1}{b1} \cdot \frac{\sqrt[3]{a2} \cdot \sqrt[3]{a2}}{\sqrt[3]{b2} \cdot \sqrt[3]{b2}}\right) \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}}\]
    9. Simplified3.4

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

    if 6.0388420886701275e+293 < (/ (* a1 a2) (* b1 b2))

    1. Initial program 57.0

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

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

      \[\leadsto \frac{a1}{b1} \cdot \frac{a2}{\color{blue}{\left(\sqrt[3]{b2} \cdot \sqrt[3]{b2}\right) \cdot \sqrt[3]{b2}}}\]
    6. Applied add-cube-cbrt8.8

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

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

      \[\leadsto \color{blue}{\left(\frac{a1}{b1} \cdot \frac{\sqrt[3]{a2} \cdot \sqrt[3]{a2}}{\sqrt[3]{b2} \cdot \sqrt[3]{b2}}\right) \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}}\]
    9. Simplified11.8

      \[\leadsto \color{blue}{\frac{a1}{\frac{b1}{\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}} \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}}}} \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}\]
    10. Using strategy rm
    11. Applied *-un-lft-identity11.8

      \[\leadsto \frac{a1}{\frac{\color{blue}{1 \cdot b1}}{\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}} \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}}} \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}\]
    12. Applied times-frac11.3

      \[\leadsto \frac{a1}{\color{blue}{\frac{1}{\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}} \cdot \frac{b1}{\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}}}} \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}\]
    13. Applied *-un-lft-identity11.3

      \[\leadsto \frac{\color{blue}{1 \cdot a1}}{\frac{1}{\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}} \cdot \frac{b1}{\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}}} \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}\]
    14. Applied times-frac7.5

      \[\leadsto \color{blue}{\left(\frac{1}{\frac{1}{\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}}} \cdot \frac{a1}{\frac{b1}{\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}}}\right)} \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}\]
    15. Simplified7.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} = -\infty:\\ \;\;\;\;\frac{a2 \cdot \frac{a1}{b1}}{b2}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -3.378626986605869 \cdot 10^{-297}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -0.0:\\ \;\;\;\;\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}} \cdot \frac{a1}{\frac{b1}{\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}} \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}}}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 6.0388420886701275 \cdot 10^{+293}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{a1}{\frac{b1}{\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}}} \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}\right) \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}\\ \end{array}\]

Reproduce

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

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

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