Average Error: 10.9 → 5.0
Time: 17.8s
Precision: 64
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -1.2127685659922545 \cdot 10^{+214}:\\ \;\;\;\;a1 \cdot \frac{\frac{a2}{b1}}{b2}\\ \mathbf{elif}\;a1 \cdot a2 \le -4.4979291324398776 \cdot 10^{-178}:\\ \;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b2 \cdot b1}\\ \mathbf{elif}\;a1 \cdot a2 \le 7.052034947412487 \cdot 10^{-111}:\\ \;\;\;\;\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}} \cdot \frac{\frac{a1}{b1}}{\frac{\sqrt[3]{b2}}{\sqrt[3]{a2}} \cdot \frac{\sqrt[3]{b2}}{\sqrt[3]{a2}}}\\ \mathbf{elif}\;a1 \cdot a2 \le 1.7096244212057329 \cdot 10^{+267}:\\ \;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b2 \cdot b1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}} \cdot \frac{\frac{a1}{b1}}{\frac{\sqrt[3]{b2}}{\sqrt[3]{a2}} \cdot \frac{\sqrt[3]{b2}}{\sqrt[3]{a2}}}\\ \end{array}\]
\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
\mathbf{if}\;a1 \cdot a2 \le -1.2127685659922545 \cdot 10^{+214}:\\
\;\;\;\;a1 \cdot \frac{\frac{a2}{b1}}{b2}\\

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

\mathbf{elif}\;a1 \cdot a2 \le 7.052034947412487 \cdot 10^{-111}:\\
\;\;\;\;\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}} \cdot \frac{\frac{a1}{b1}}{\frac{\sqrt[3]{b2}}{\sqrt[3]{a2}} \cdot \frac{\sqrt[3]{b2}}{\sqrt[3]{a2}}}\\

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

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

\end{array}
double f(double a1, double a2, double b1, double b2) {
        double r5691379 = a1;
        double r5691380 = a2;
        double r5691381 = r5691379 * r5691380;
        double r5691382 = b1;
        double r5691383 = b2;
        double r5691384 = r5691382 * r5691383;
        double r5691385 = r5691381 / r5691384;
        return r5691385;
}

double f(double a1, double a2, double b1, double b2) {
        double r5691386 = a1;
        double r5691387 = a2;
        double r5691388 = r5691386 * r5691387;
        double r5691389 = -1.2127685659922545e+214;
        bool r5691390 = r5691388 <= r5691389;
        double r5691391 = b1;
        double r5691392 = r5691387 / r5691391;
        double r5691393 = b2;
        double r5691394 = r5691392 / r5691393;
        double r5691395 = r5691386 * r5691394;
        double r5691396 = -4.4979291324398776e-178;
        bool r5691397 = r5691388 <= r5691396;
        double r5691398 = 1.0;
        double r5691399 = r5691393 * r5691391;
        double r5691400 = r5691398 / r5691399;
        double r5691401 = r5691388 * r5691400;
        double r5691402 = 7.052034947412487e-111;
        bool r5691403 = r5691388 <= r5691402;
        double r5691404 = cbrt(r5691387);
        double r5691405 = cbrt(r5691393);
        double r5691406 = r5691404 / r5691405;
        double r5691407 = r5691386 / r5691391;
        double r5691408 = r5691405 / r5691404;
        double r5691409 = r5691408 * r5691408;
        double r5691410 = r5691407 / r5691409;
        double r5691411 = r5691406 * r5691410;
        double r5691412 = 1.7096244212057329e+267;
        bool r5691413 = r5691388 <= r5691412;
        double r5691414 = r5691413 ? r5691401 : r5691411;
        double r5691415 = r5691403 ? r5691411 : r5691414;
        double r5691416 = r5691397 ? r5691401 : r5691415;
        double r5691417 = r5691390 ? r5691395 : r5691416;
        return r5691417;
}

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

Original10.9
Target11.0
Herbie5.0
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 3 regimes
  2. if (* a1 a2) < -1.2127685659922545e+214

    1. Initial program 33.2

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

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

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

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

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

    if -1.2127685659922545e+214 < (* a1 a2) < -4.4979291324398776e-178 or 7.052034947412487e-111 < (* a1 a2) < 1.7096244212057329e+267

    1. Initial program 4.7

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

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

    if -4.4979291324398776e-178 < (* a1 a2) < 7.052034947412487e-111 or 1.7096244212057329e+267 < (* a1 a2)

    1. Initial program 15.9

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

      \[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
    4. Using strategy rm
    5. Applied add-cube-cbrt6.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-cbrt7.1

      \[\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-frac7.1

      \[\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*4.5

      \[\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. Simplified4.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -1.2127685659922545 \cdot 10^{+214}:\\ \;\;\;\;a1 \cdot \frac{\frac{a2}{b1}}{b2}\\ \mathbf{elif}\;a1 \cdot a2 \le -4.4979291324398776 \cdot 10^{-178}:\\ \;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b2 \cdot b1}\\ \mathbf{elif}\;a1 \cdot a2 \le 7.052034947412487 \cdot 10^{-111}:\\ \;\;\;\;\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}} \cdot \frac{\frac{a1}{b1}}{\frac{\sqrt[3]{b2}}{\sqrt[3]{a2}} \cdot \frac{\sqrt[3]{b2}}{\sqrt[3]{a2}}}\\ \mathbf{elif}\;a1 \cdot a2 \le 1.7096244212057329 \cdot 10^{+267}:\\ \;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b2 \cdot b1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{a2}}{\sqrt[3]{b2}} \cdot \frac{\frac{a1}{b1}}{\frac{\sqrt[3]{b2}}{\sqrt[3]{a2}} \cdot \frac{\sqrt[3]{b2}}{\sqrt[3]{a2}}}\\ \end{array}\]

Reproduce

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

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

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