Average Error: 20.8 → 20.9
Time: 19.0s
Precision: 64
\[\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}} \le -2.543307597846895326146720250603550142887 \cdot 10^{-232}:\\ \;\;\;\;\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}}\\ \mathbf{elif}\;\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}} \le -0.0:\\ \;\;\;\;\frac{1}{\sqrt{\frac{\sqrt{s1}}{\sqrt{n1}} + \sqrt{\frac{s2}{n2}}}} \cdot \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{\sqrt{s1}}{\sqrt{n1}} - \sqrt{\frac{s2}{n2}}}}\\ \mathbf{elif}\;\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}} \le 1.121393464149468110830442865620781181305 \cdot 10^{261}:\\ \;\;\;\;\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{m1 \cdot n2 - n1 \cdot m2}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}} \cdot \left(n1 \cdot n2\right)}\\ \end{array}\]
\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}}
\begin{array}{l}
\mathbf{if}\;\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}} \le -2.543307597846895326146720250603550142887 \cdot 10^{-232}:\\
\;\;\;\;\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}}\\

\mathbf{elif}\;\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}} \le -0.0:\\
\;\;\;\;\frac{1}{\sqrt{\frac{\sqrt{s1}}{\sqrt{n1}} + \sqrt{\frac{s2}{n2}}}} \cdot \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{\sqrt{s1}}{\sqrt{n1}} - \sqrt{\frac{s2}{n2}}}}\\

\mathbf{elif}\;\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}} \le 1.121393464149468110830442865620781181305 \cdot 10^{261}:\\
\;\;\;\;\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{m1 \cdot n2 - n1 \cdot m2}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}} \cdot \left(n1 \cdot n2\right)}\\

\end{array}
double f(double m1, double n1, double m2, double n2, double s1, double s2) {
        double r134441 = m1;
        double r134442 = n1;
        double r134443 = r134441 / r134442;
        double r134444 = m2;
        double r134445 = n2;
        double r134446 = r134444 / r134445;
        double r134447 = r134443 - r134446;
        double r134448 = s1;
        double r134449 = r134448 / r134442;
        double r134450 = s2;
        double r134451 = r134450 / r134445;
        double r134452 = r134449 - r134451;
        double r134453 = sqrt(r134452);
        double r134454 = r134447 / r134453;
        return r134454;
}

double f(double m1, double n1, double m2, double n2, double s1, double s2) {
        double r134455 = m1;
        double r134456 = n1;
        double r134457 = r134455 / r134456;
        double r134458 = m2;
        double r134459 = n2;
        double r134460 = r134458 / r134459;
        double r134461 = r134457 - r134460;
        double r134462 = s1;
        double r134463 = r134462 / r134456;
        double r134464 = s2;
        double r134465 = r134464 / r134459;
        double r134466 = r134463 - r134465;
        double r134467 = sqrt(r134466);
        double r134468 = r134461 / r134467;
        double r134469 = -2.5433075978468953e-232;
        bool r134470 = r134468 <= r134469;
        double r134471 = -0.0;
        bool r134472 = r134468 <= r134471;
        double r134473 = 1.0;
        double r134474 = sqrt(r134462);
        double r134475 = sqrt(r134456);
        double r134476 = r134474 / r134475;
        double r134477 = sqrt(r134465);
        double r134478 = r134476 + r134477;
        double r134479 = sqrt(r134478);
        double r134480 = r134473 / r134479;
        double r134481 = r134476 - r134477;
        double r134482 = sqrt(r134481);
        double r134483 = r134461 / r134482;
        double r134484 = r134480 * r134483;
        double r134485 = 1.1213934641494681e+261;
        bool r134486 = r134468 <= r134485;
        double r134487 = r134455 * r134459;
        double r134488 = r134456 * r134458;
        double r134489 = r134487 - r134488;
        double r134490 = r134456 * r134459;
        double r134491 = r134467 * r134490;
        double r134492 = r134489 / r134491;
        double r134493 = r134486 ? r134468 : r134492;
        double r134494 = r134472 ? r134484 : r134493;
        double r134495 = r134470 ? r134468 : r134494;
        return r134495;
}

Error

Bits error versus m1

Bits error versus n1

Bits error versus m2

Bits error versus n2

Bits error versus s1

Bits error versus s2

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if (/ (- (/ m1 n1) (/ m2 n2)) (sqrt (- (/ s1 n1) (/ s2 n2)))) < -2.5433075978468953e-232 or -0.0 < (/ (- (/ m1 n1) (/ m2 n2)) (sqrt (- (/ s1 n1) (/ s2 n2)))) < 1.1213934641494681e+261

    1. Initial program 9.7

      \[\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity9.7

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

    if -2.5433075978468953e-232 < (/ (- (/ m1 n1) (/ m2 n2)) (sqrt (- (/ s1 n1) (/ s2 n2)))) < -0.0

    1. Initial program 47.1

      \[\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt58.7

      \[\leadsto \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \color{blue}{\sqrt{\frac{s2}{n2}} \cdot \sqrt{\frac{s2}{n2}}}}}\]
    4. Applied add-sqr-sqrt61.2

      \[\leadsto \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{\color{blue}{\sqrt{n1} \cdot \sqrt{n1}}} - \sqrt{\frac{s2}{n2}} \cdot \sqrt{\frac{s2}{n2}}}}\]
    5. Applied add-sqr-sqrt61.2

      \[\leadsto \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{\color{blue}{\sqrt{s1} \cdot \sqrt{s1}}}{\sqrt{n1} \cdot \sqrt{n1}} - \sqrt{\frac{s2}{n2}} \cdot \sqrt{\frac{s2}{n2}}}}\]
    6. Applied times-frac61.2

      \[\leadsto \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\color{blue}{\frac{\sqrt{s1}}{\sqrt{n1}} \cdot \frac{\sqrt{s1}}{\sqrt{n1}}} - \sqrt{\frac{s2}{n2}} \cdot \sqrt{\frac{s2}{n2}}}}\]
    7. Applied difference-of-squares61.2

      \[\leadsto \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\color{blue}{\left(\frac{\sqrt{s1}}{\sqrt{n1}} + \sqrt{\frac{s2}{n2}}\right) \cdot \left(\frac{\sqrt{s1}}{\sqrt{n1}} - \sqrt{\frac{s2}{n2}}\right)}}}\]
    8. Applied sqrt-prod54.4

      \[\leadsto \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\color{blue}{\sqrt{\frac{\sqrt{s1}}{\sqrt{n1}} + \sqrt{\frac{s2}{n2}}} \cdot \sqrt{\frac{\sqrt{s1}}{\sqrt{n1}} - \sqrt{\frac{s2}{n2}}}}}\]
    9. Applied *-un-lft-identity54.4

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\frac{m1}{n1} - \frac{m2}{n2}\right)}}{\sqrt{\frac{\sqrt{s1}}{\sqrt{n1}} + \sqrt{\frac{s2}{n2}}} \cdot \sqrt{\frac{\sqrt{s1}}{\sqrt{n1}} - \sqrt{\frac{s2}{n2}}}}\]
    10. Applied times-frac54.4

      \[\leadsto \color{blue}{\frac{1}{\sqrt{\frac{\sqrt{s1}}{\sqrt{n1}} + \sqrt{\frac{s2}{n2}}}} \cdot \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{\sqrt{s1}}{\sqrt{n1}} - \sqrt{\frac{s2}{n2}}}}}\]

    if 1.1213934641494681e+261 < (/ (- (/ m1 n1) (/ m2 n2)) (sqrt (- (/ s1 n1) (/ s2 n2))))

    1. Initial program 58.7

      \[\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}}\]
    2. Using strategy rm
    3. Applied frac-sub61.2

      \[\leadsto \frac{\color{blue}{\frac{m1 \cdot n2 - n1 \cdot m2}{n1 \cdot n2}}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}}\]
    4. Applied associate-/l/54.3

      \[\leadsto \color{blue}{\frac{m1 \cdot n2 - n1 \cdot m2}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}} \cdot \left(n1 \cdot n2\right)}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification20.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}} \le -2.543307597846895326146720250603550142887 \cdot 10^{-232}:\\ \;\;\;\;\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}}\\ \mathbf{elif}\;\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}} \le -0.0:\\ \;\;\;\;\frac{1}{\sqrt{\frac{\sqrt{s1}}{\sqrt{n1}} + \sqrt{\frac{s2}{n2}}}} \cdot \frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{\sqrt{s1}}{\sqrt{n1}} - \sqrt{\frac{s2}{n2}}}}\\ \mathbf{elif}\;\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}} \le 1.121393464149468110830442865620781181305 \cdot 10^{261}:\\ \;\;\;\;\frac{\frac{m1}{n1} - \frac{m2}{n2}}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{m1 \cdot n2 - n1 \cdot m2}{\sqrt{\frac{s1}{n1} - \frac{s2}{n2}} \cdot \left(n1 \cdot n2\right)}\\ \end{array}\]

Reproduce

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