Average Error: 11.2 → 3.7
Time: 6.5s
Precision: 64
$\frac{a \cdot b}{c \cdot d}$
$\begin{array}{l} \mathbf{if}\;\frac{a \cdot b}{c \cdot d} \le -2.470328229206232720882843964341106861825 \cdot 10^{-323} \lor \neg \left(\frac{a \cdot b}{c \cdot d} \le 0.0\right) \land \frac{a \cdot b}{c \cdot d} \le 1.285516351998473648174898475561354752804 \cdot 10^{292}:\\ \;\;\;\;\frac{a \cdot b}{c \cdot d}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c} \cdot \frac{b}{d}\\ \end{array}$
\frac{a \cdot b}{c \cdot d}
\begin{array}{l}
\mathbf{if}\;\frac{a \cdot b}{c \cdot d} \le -2.470328229206232720882843964341106861825 \cdot 10^{-323} \lor \neg \left(\frac{a \cdot b}{c \cdot d} \le 0.0\right) \land \frac{a \cdot b}{c \cdot d} \le 1.285516351998473648174898475561354752804 \cdot 10^{292}:\\
\;\;\;\;\frac{a \cdot b}{c \cdot d}\\

\mathbf{else}:\\
\;\;\;\;\frac{a}{c} \cdot \frac{b}{d}\\

\end{array}
double f(double a, double b, double c, double d) {
double r235893 = a;
double r235894 = b;
double r235895 = r235893 * r235894;
double r235896 = c;
double r235897 = d;
double r235898 = r235896 * r235897;
double r235899 = r235895 / r235898;
return r235899;
}


double f(double a, double b, double c, double d) {
double r235900 = a;
double r235901 = b;
double r235902 = r235900 * r235901;
double r235903 = c;
double r235904 = d;
double r235905 = r235903 * r235904;
double r235906 = r235902 / r235905;
double r235907 = -2.4703282292062e-323;
bool r235908 = r235906 <= r235907;
double r235909 = 0.0;
bool r235910 = r235906 <= r235909;
double r235911 = !r235910;
double r235912 = 1.2855163519984736e+292;
bool r235913 = r235906 <= r235912;
bool r235914 = r235911 && r235913;
bool r235915 = r235908 || r235914;
double r235916 = r235900 / r235903;
double r235917 = r235901 / r235904;
double r235918 = r235916 * r235917;
double r235919 = r235915 ? r235906 : r235918;
return r235919;
}



Try it out

Your Program's Arguments

Results

 In Out
Enter valid numbers for all inputs

Derivation

1. Split input into 2 regimes
2. if (/ (* a b) (* c d)) < -2.4703282292062e-323 or 0.0 < (/ (* a b) (* c d)) < 1.2855163519984736e+292

1. Initial program 5.8

$\frac{a \cdot b}{c \cdot d}$

if -2.4703282292062e-323 < (/ (* a b) (* c d)) < 0.0 or 1.2855163519984736e+292 < (/ (* a b) (* c d))

1. Initial program 29.4

$\frac{a \cdot b}{c \cdot d}$
2. Using strategy rm
3. Applied times-frac4.1

$\leadsto \color{blue}{\frac{a}{c} \cdot \frac{b}{d}}$
3. Recombined 2 regimes into one program.
4. Final simplification3.7

$\leadsto \begin{array}{l} \mathbf{if}\;\frac{a \cdot b}{c \cdot d} \le -2.470328229206232720882843964341106861825 \cdot 10^{-323} \lor \neg \left(\frac{a \cdot b}{c \cdot d} \le 0.0\right) \land \frac{a \cdot b}{c \cdot d} \le 1.285516351998473648174898475561354752804 \cdot 10^{292}:\\ \;\;\;\;\frac{a \cdot b}{c \cdot d}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c} \cdot \frac{b}{d}\\ \end{array}$

Reproduce

herbie shell --seed 1
(FPCore (a b c d)
:name "a * b / (c * d)"
:precision binary64
(/ (* a b) (* c d)))