Average Error: 11.2 → 5.0
Time: 47.2s
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 r22479787 = a1;
        double r22479788 = a2;
        double r22479789 = r22479787 * r22479788;
        double r22479790 = b1;
        double r22479791 = b2;
        double r22479792 = r22479790 * r22479791;
        double r22479793 = r22479789 / r22479792;
        return r22479793;
}

double f(double a1, double a2, double b1, double b2) {
        double r22479794 = b1;
        double r22479795 = b2;
        double r22479796 = r22479794 * r22479795;
        double r22479797 = -1.8654071526797647e+191;
        bool r22479798 = r22479796 <= r22479797;
        double r22479799 = a2;
        double r22479800 = a1;
        double r22479801 = r22479800 / r22479794;
        double r22479802 = r22479799 * r22479801;
        double r22479803 = 1.0;
        double r22479804 = r22479803 / r22479795;
        double r22479805 = r22479802 * r22479804;
        double r22479806 = -1.0176507098003041e-184;
        bool r22479807 = r22479796 <= r22479806;
        double r22479808 = r22479796 / r22479799;
        double r22479809 = r22479800 / r22479808;
        double r22479810 = 2.105160204145219e-202;
        bool r22479811 = r22479796 <= r22479810;
        double r22479812 = cbrt(r22479799);
        double r22479813 = r22479812 * r22479812;
        double r22479814 = r22479801 * r22479813;
        double r22479815 = r22479812 / r22479795;
        double r22479816 = r22479814 * r22479815;
        double r22479817 = 3.692200814826821e+161;
        bool r22479818 = r22479796 <= r22479817;
        double r22479819 = r22479818 ? r22479809 : r22479805;
        double r22479820 = r22479811 ? r22479816 : r22479819;
        double r22479821 = r22479807 ? r22479809 : r22479820;
        double r22479822 = r22479798 ? r22479805 : r22479821;
        return r22479822;
}

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 +o rules:numerics
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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