Average Error: 39.2 → 33.0
Time: 43.8s
Precision: 64
$\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{{s1}^{2}}{n1} - \frac{{s2}^{2}}{n2}}}$
$\begin{array}{l} \mathbf{if}\;s1 \le 1.51393508557752545347158014792210854056 \cdot 10^{96}:\\ \;\;\;\;\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{{\left(\sqrt[3]{s1} \cdot \sqrt[3]{s1}\right)}^{2}}{\sqrt[3]{n1} \cdot \sqrt[3]{n1}} \cdot \frac{{\left(\sqrt[3]{s1}\right)}^{2}}{\sqrt[3]{n1}} - \frac{{s2}^{\left(\frac{2}{2}\right)}}{\frac{n2}{{s2}^{\left(\frac{2}{2}\right)}}}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{\frac{m1}{n1} - \frac{m2}{n2}} \cdot \sqrt[3]{\frac{m1}{n1} - \frac{m2}{n2}}}{\sqrt{\frac{{\left(\sqrt{s1}\right)}^{2}}{\sqrt{n1}} + \sqrt{\frac{{s2}^{2}}{n2}}}} \cdot \frac{\sqrt[3]{\frac{m1}{n1} - \frac{m2}{n2}}}{\sqrt{\frac{{\left(\sqrt{s1}\right)}^{2}}{\sqrt{n1}} - \sqrt{\frac{{s2}^{2}}{n2}}}}\\ \end{array}$
\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{{s1}^{2}}{n1} - \frac{{s2}^{2}}{n2}}}
\begin{array}{l}
\mathbf{if}\;s1 \le 1.51393508557752545347158014792210854056 \cdot 10^{96}:\\
\;\;\;\;\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{{\left(\sqrt[3]{s1} \cdot \sqrt[3]{s1}\right)}^{2}}{\sqrt[3]{n1} \cdot \sqrt[3]{n1}} \cdot \frac{{\left(\sqrt[3]{s1}\right)}^{2}}{\sqrt[3]{n1}} - \frac{{s2}^{\left(\frac{2}{2}\right)}}{\frac{n2}{{s2}^{\left(\frac{2}{2}\right)}}}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{\frac{m1}{n1} - \frac{m2}{n2}} \cdot \sqrt[3]{\frac{m1}{n1} - \frac{m2}{n2}}}{\sqrt{\frac{{\left(\sqrt{s1}\right)}^{2}}{\sqrt{n1}} + \sqrt{\frac{{s2}^{2}}{n2}}}} \cdot \frac{\sqrt[3]{\frac{m1}{n1} - \frac{m2}{n2}}}{\sqrt{\frac{{\left(\sqrt{s1}\right)}^{2}}{\sqrt{n1}} - \sqrt{\frac{{s2}^{2}}{n2}}}}\\

\end{array}
double f(double m1, double n1, double m2, double n2, double s1, double s2) {
double r122766 = m1;
double r122767 = n1;
double r122768 = r122766 / r122767;
double r122769 = m2;
double r122770 = n2;
double r122771 = r122769 / r122770;
double r122772 = r122768 - r122771;
double r122773 = s1;
double r122774 = 2.0;
double r122775 = pow(r122773, r122774);
double r122776 = r122775 / r122767;
double r122777 = s2;
double r122778 = pow(r122777, r122774);
double r122779 = r122778 / r122770;
double r122780 = r122776 - r122779;
double r122781 = sqrt(r122780);
double r122782 = r122772 / r122781;
return r122782;
}


double f(double m1, double n1, double m2, double n2, double s1, double s2) {
double r122783 = s1;
double r122784 = 1.5139350855775255e+96;
bool r122785 = r122783 <= r122784;
double r122786 = m1;
double r122787 = n1;
double r122788 = r122786 / r122787;
double r122789 = m2;
double r122790 = n2;
double r122791 = r122789 / r122790;
double r122792 = r122788 - r122791;
double r122793 = cbrt(r122783);
double r122794 = r122793 * r122793;
double r122795 = 2.0;
double r122796 = pow(r122794, r122795);
double r122797 = cbrt(r122787);
double r122798 = r122797 * r122797;
double r122799 = r122796 / r122798;
double r122800 = pow(r122793, r122795);
double r122801 = r122800 / r122797;
double r122802 = r122799 * r122801;
double r122803 = s2;
double r122804 = 2.0;
double r122805 = r122795 / r122804;
double r122806 = pow(r122803, r122805);
double r122807 = r122790 / r122806;
double r122808 = r122806 / r122807;
double r122809 = r122802 - r122808;
double r122810 = sqrt(r122809);
double r122811 = r122792 / r122810;
double r122812 = cbrt(r122792);
double r122813 = r122812 * r122812;
double r122814 = sqrt(r122783);
double r122815 = pow(r122814, r122795);
double r122816 = sqrt(r122787);
double r122817 = r122815 / r122816;
double r122818 = pow(r122803, r122795);
double r122819 = r122818 / r122790;
double r122820 = sqrt(r122819);
double r122821 = r122817 + r122820;
double r122822 = sqrt(r122821);
double r122823 = r122813 / r122822;
double r122824 = r122817 - r122820;
double r122825 = sqrt(r122824);
double r122826 = r122812 / r122825;
double r122827 = r122823 * r122826;
double r122828 = r122785 ? r122811 : r122827;
return r122828;
}



# 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 s1 < 1.5139350855775255e+96

1. Initial program 36.4

$\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{{s1}^{2}}{n1} - \frac{{s2}^{2}}{n2}}}$
2. Using strategy rm
3. Applied sqr-pow36.4

$\leadsto \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{{s1}^{2}}{n1} - \frac{\color{blue}{{s2}^{\left(\frac{2}{2}\right)} \cdot {s2}^{\left(\frac{2}{2}\right)}}}{n2}}}$
4. Applied associate-/l*32.5

$\leadsto \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{{s1}^{2}}{n1} - \color{blue}{\frac{{s2}^{\left(\frac{2}{2}\right)}}{\frac{n2}{{s2}^{\left(\frac{2}{2}\right)}}}}}}$
5. Using strategy rm
6. Applied add-cube-cbrt32.6

$\leadsto \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{{s1}^{2}}{\color{blue}{\left(\sqrt[3]{n1} \cdot \sqrt[3]{n1}\right) \cdot \sqrt[3]{n1}}} - \frac{{s2}^{\left(\frac{2}{2}\right)}}{\frac{n2}{{s2}^{\left(\frac{2}{2}\right)}}}}}$
7. Applied add-cube-cbrt32.7

$\leadsto \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{{\color{blue}{\left(\left(\sqrt[3]{s1} \cdot \sqrt[3]{s1}\right) \cdot \sqrt[3]{s1}\right)}}^{2}}{\left(\sqrt[3]{n1} \cdot \sqrt[3]{n1}\right) \cdot \sqrt[3]{n1}} - \frac{{s2}^{\left(\frac{2}{2}\right)}}{\frac{n2}{{s2}^{\left(\frac{2}{2}\right)}}}}}$
8. Applied unpow-prod-down32.7

$\leadsto \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{\color{blue}{{\left(\sqrt[3]{s1} \cdot \sqrt[3]{s1}\right)}^{2} \cdot {\left(\sqrt[3]{s1}\right)}^{2}}}{\left(\sqrt[3]{n1} \cdot \sqrt[3]{n1}\right) \cdot \sqrt[3]{n1}} - \frac{{s2}^{\left(\frac{2}{2}\right)}}{\frac{n2}{{s2}^{\left(\frac{2}{2}\right)}}}}}$
9. Applied times-frac30.8

$\leadsto \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\color{blue}{\frac{{\left(\sqrt[3]{s1} \cdot \sqrt[3]{s1}\right)}^{2}}{\sqrt[3]{n1} \cdot \sqrt[3]{n1}} \cdot \frac{{\left(\sqrt[3]{s1}\right)}^{2}}{\sqrt[3]{n1}}} - \frac{{s2}^{\left(\frac{2}{2}\right)}}{\frac{n2}{{s2}^{\left(\frac{2}{2}\right)}}}}}$

## if 1.5139350855775255e+96 < s1

1. Initial program 50.6

$\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{{s1}^{2}}{n1} - \frac{{s2}^{2}}{n2}}}$
2. Using strategy rm
3. Applied add-sqr-sqrt55.8

$\leadsto \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{{s1}^{2}}{n1} - \color{blue}{\sqrt{\frac{{s2}^{2}}{n2}} \cdot \sqrt{\frac{{s2}^{2}}{n2}}}}}$
4. Applied add-sqr-sqrt55.8

$\leadsto \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{{s1}^{2}}{\color{blue}{\sqrt{n1} \cdot \sqrt{n1}}} - \sqrt{\frac{{s2}^{2}}{n2}} \cdot \sqrt{\frac{{s2}^{2}}{n2}}}}$
5. Applied add-sqr-sqrt55.8

$\leadsto \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{{\color{blue}{\left(\sqrt{s1} \cdot \sqrt{s1}\right)}}^{2}}{\sqrt{n1} \cdot \sqrt{n1}} - \sqrt{\frac{{s2}^{2}}{n2}} \cdot \sqrt{\frac{{s2}^{2}}{n2}}}}$
6. Applied unpow-prod-down55.8

$\leadsto \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{\color{blue}{{\left(\sqrt{s1}\right)}^{2} \cdot {\left(\sqrt{s1}\right)}^{2}}}{\sqrt{n1} \cdot \sqrt{n1}} - \sqrt{\frac{{s2}^{2}}{n2}} \cdot \sqrt{\frac{{s2}^{2}}{n2}}}}$
7. Applied times-frac51.6

$\leadsto \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\color{blue}{\frac{{\left(\sqrt{s1}\right)}^{2}}{\sqrt{n1}} \cdot \frac{{\left(\sqrt{s1}\right)}^{2}}{\sqrt{n1}}} - \sqrt{\frac{{s2}^{2}}{n2}} \cdot \sqrt{\frac{{s2}^{2}}{n2}}}}$
8. Applied difference-of-squares51.7

$\leadsto \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\color{blue}{\left(\frac{{\left(\sqrt{s1}\right)}^{2}}{\sqrt{n1}} + \sqrt{\frac{{s2}^{2}}{n2}}\right) \cdot \left(\frac{{\left(\sqrt{s1}\right)}^{2}}{\sqrt{n1}} - \sqrt{\frac{{s2}^{2}}{n2}}\right)}}}$
9. Applied sqrt-prod41.9

$\leadsto \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\color{blue}{\sqrt{\frac{{\left(\sqrt{s1}\right)}^{2}}{\sqrt{n1}} + \sqrt{\frac{{s2}^{2}}{n2}}} \cdot \sqrt{\frac{{\left(\sqrt{s1}\right)}^{2}}{\sqrt{n1}} - \sqrt{\frac{{s2}^{2}}{n2}}}}}$
10. Applied add-cube-cbrt42.1

$\leadsto \frac{\color{blue}{\left(\sqrt[3]{\frac{m1}{n1} - \frac{m2}{n2}} \cdot \sqrt[3]{\frac{m1}{n1} - \frac{m2}{n2}}\right) \cdot \sqrt[3]{\frac{m1}{n1} - \frac{m2}{n2}}}}{\sqrt{\frac{{\left(\sqrt{s1}\right)}^{2}}{\sqrt{n1}} + \sqrt{\frac{{s2}^{2}}{n2}}} \cdot \sqrt{\frac{{\left(\sqrt{s1}\right)}^{2}}{\sqrt{n1}} - \sqrt{\frac{{s2}^{2}}{n2}}}}$
11. Applied times-frac42.1

$\leadsto \color{blue}{\frac{\sqrt[3]{\frac{m1}{n1} - \frac{m2}{n2}} \cdot \sqrt[3]{\frac{m1}{n1} - \frac{m2}{n2}}}{\sqrt{\frac{{\left(\sqrt{s1}\right)}^{2}}{\sqrt{n1}} + \sqrt{\frac{{s2}^{2}}{n2}}}} \cdot \frac{\sqrt[3]{\frac{m1}{n1} - \frac{m2}{n2}}}{\sqrt{\frac{{\left(\sqrt{s1}\right)}^{2}}{\sqrt{n1}} - \sqrt{\frac{{s2}^{2}}{n2}}}}}$
3. Recombined 2 regimes into one program.
4. Final simplification33.0

$\leadsto \begin{array}{l} \mathbf{if}\;s1 \le 1.51393508557752545347158014792210854056 \cdot 10^{96}:\\ \;\;\;\;\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{{\left(\sqrt[3]{s1} \cdot \sqrt[3]{s1}\right)}^{2}}{\sqrt[3]{n1} \cdot \sqrt[3]{n1}} \cdot \frac{{\left(\sqrt[3]{s1}\right)}^{2}}{\sqrt[3]{n1}} - \frac{{s2}^{\left(\frac{2}{2}\right)}}{\frac{n2}{{s2}^{\left(\frac{2}{2}\right)}}}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{\frac{m1}{n1} - \frac{m2}{n2}} \cdot \sqrt[3]{\frac{m1}{n1} - \frac{m2}{n2}}}{\sqrt{\frac{{\left(\sqrt{s1}\right)}^{2}}{\sqrt{n1}} + \sqrt{\frac{{s2}^{2}}{n2}}}} \cdot \frac{\sqrt[3]{\frac{m1}{n1} - \frac{m2}{n2}}}{\sqrt{\frac{{\left(\sqrt{s1}\right)}^{2}}{\sqrt{n1}} - \sqrt{\frac{{s2}^{2}}{n2}}}}\\ \end{array}$

# Reproduce

herbie shell --seed 1
(FPCore (m1 n1 m2 n2 s1 s2)
:name "(m1/n1 - m2/n2) / sqrt( pow(s1, 2)/n1 - pow(s2, 2)/n2)"
:precision binary64
(/ (- (/ m1 n1) (/ m2 n2)) (sqrt (- (/ (pow s1 2) n1) (/ (pow s2 2) n2)))))