Average Error: 11.6 → 2.0
Time: 3.9s
Precision: binary64
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -\infty:\\ \;\;\;\;\left(\frac{a1}{b1} \cdot \left(\sqrt[3]{a2} \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2} \cdot \sqrt[3]{b2}}\right)\right) \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -1.4278497164812 \cdot 10^{-321} \lor \neg \left(\frac{a1 \cdot a2}{b1 \cdot b2} \leq -0\right) \land \frac{a1 \cdot a2}{b1 \cdot b2} \leq 7.914732966838874 \cdot 10^{+288}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \end{array}\]
\frac{a1 \cdot a2}{b1 \cdot b2}
\begin{array}{l}
\mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -\infty:\\
\;\;\;\;\left(\frac{a1}{b1} \cdot \left(\sqrt[3]{a2} \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2} \cdot \sqrt[3]{b2}}\right)\right) \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}\\

\mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -1.4278497164812 \cdot 10^{-321} \lor \neg \left(\frac{a1 \cdot a2}{b1 \cdot b2} \leq -0\right) \land \frac{a1 \cdot a2}{b1 \cdot b2} \leq 7.914732966838874 \cdot 10^{+288}:\\
\;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\

\mathbf{else}:\\
\;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\

\end{array}
double code(double a1, double a2, double b1, double b2) {
	return (((double) (a1 * a2)) / ((double) (b1 * b2)));
}
double code(double a1, double a2, double b1, double b2) {
	double VAR;
	if (((((double) (a1 * a2)) / ((double) (b1 * b2))) <= ((double) -(((double) INFINITY))))) {
		VAR = ((double) (((double) ((a1 / b1) * ((double) (((double) cbrt(a2)) * (((double) cbrt(a2)) / ((double) (((double) cbrt(b2)) * ((double) cbrt(b2))))))))) * (((double) cbrt(a2)) / ((double) cbrt(b2)))));
	} else {
		double VAR_1;
		if ((((((double) (a1 * a2)) / ((double) (b1 * b2))) <= -1.4278497164812e-321) || (!((((double) (a1 * a2)) / ((double) (b1 * b2))) <= -0.0) && ((((double) (a1 * a2)) / ((double) (b1 * b2))) <= 7.914732966838874e+288)))) {
			VAR_1 = (((double) (a1 * a2)) / ((double) (b1 * b2)));
		} else {
			VAR_1 = ((double) ((a1 / b1) * (a2 / b2)));
		}
		VAR = VAR_1;
	}
	return VAR;
}

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

Derivation

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

    1. Initial program 64.0

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Simplified28.4

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

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

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

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

      \[\leadsto \color{blue}{\frac{a1}{b1}} \cdot \frac{a2}{b2}\]
    8. Using strategy rm
    9. Applied add-cube-cbrt11.3

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

      \[\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}}\]
    11. Applied times-frac11.6

      \[\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)}\]
    12. Applied associate-*r*7.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}}}\]
    13. Simplified7.5

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

    if -inf.0 < (/ (* a1 a2) (* b1 b2)) < -1.42785e-321 or -0.0 < (/ (* a1 a2) (* b1 b2)) < 7.9147329668388741e288

    1. Initial program 0.8

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

    if -1.42785e-321 < (/ (* a1 a2) (* b1 b2)) < -0.0 or 7.9147329668388741e288 < (/ (* a1 a2) (* b1 b2))

    1. Initial program 23.2

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Simplified15.3

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

      \[\leadsto a1 \cdot \frac{\color{blue}{1 \cdot a2}}{b1 \cdot b2}\]
    5. Applied times-frac5.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -\infty:\\ \;\;\;\;\left(\frac{a1}{b1} \cdot \left(\sqrt[3]{a2} \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2} \cdot \sqrt[3]{b2}}\right)\right) \cdot \frac{\sqrt[3]{a2}}{\sqrt[3]{b2}}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \leq -1.4278497164812 \cdot 10^{-321} \lor \neg \left(\frac{a1 \cdot a2}{b1 \cdot b2} \leq -0\right) \land \frac{a1 \cdot a2}{b1 \cdot b2} \leq 7.914732966838874 \cdot 10^{+288}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \end{array}\]

Reproduce

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

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

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