Average Error: 39.7 → 30.6
Time: 26.1s
Precision: 64
\[\frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\frac{{x}^{2}}{n} - \frac{{y}^{2}}{m}}}\]
\[\begin{array}{l} \mathbf{if}\;x \le 5.69003762507141083127778083459341345523 \cdot 10^{220}:\\ \;\;\;\;\frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{{x}^{\left(\frac{2}{2}\right)} \cdot \frac{{x}^{\left(\frac{2}{2}\right)}}{n} - {y}^{\left(\frac{2}{2}\right)} \cdot \frac{{y}^{\left(\frac{2}{2}\right)}}{m}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\frac{{x}^{\left(\frac{2}{2}\right)}}{\sqrt{n}} + \sqrt{\frac{{y}^{2}}{m}}}}}{\sqrt{\frac{{x}^{\left(\frac{2}{2}\right)}}{\sqrt{n}} - \sqrt{\frac{{y}^{2}}{m}}}}\\ \end{array}\]
\frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\frac{{x}^{2}}{n} - \frac{{y}^{2}}{m}}}
\begin{array}{l}
\mathbf{if}\;x \le 5.69003762507141083127778083459341345523 \cdot 10^{220}:\\
\;\;\;\;\frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{{x}^{\left(\frac{2}{2}\right)} \cdot \frac{{x}^{\left(\frac{2}{2}\right)}}{n} - {y}^{\left(\frac{2}{2}\right)} \cdot \frac{{y}^{\left(\frac{2}{2}\right)}}{m}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\frac{{x}^{\left(\frac{2}{2}\right)}}{\sqrt{n}} + \sqrt{\frac{{y}^{2}}{m}}}}}{\sqrt{\frac{{x}^{\left(\frac{2}{2}\right)}}{\sqrt{n}} - \sqrt{\frac{{y}^{2}}{m}}}}\\

\end{array}
double f(double x, double n, double y, double m) {
        double r479627 = x;
        double r479628 = n;
        double r479629 = r479627 / r479628;
        double r479630 = y;
        double r479631 = m;
        double r479632 = r479630 / r479631;
        double r479633 = r479629 - r479632;
        double r479634 = 2.0;
        double r479635 = pow(r479627, r479634);
        double r479636 = r479635 / r479628;
        double r479637 = pow(r479630, r479634);
        double r479638 = r479637 / r479631;
        double r479639 = r479636 - r479638;
        double r479640 = sqrt(r479639);
        double r479641 = r479633 / r479640;
        return r479641;
}

double f(double x, double n, double y, double m) {
        double r479642 = x;
        double r479643 = 5.690037625071411e+220;
        bool r479644 = r479642 <= r479643;
        double r479645 = n;
        double r479646 = r479642 / r479645;
        double r479647 = y;
        double r479648 = m;
        double r479649 = r479647 / r479648;
        double r479650 = r479646 - r479649;
        double r479651 = 2.0;
        double r479652 = 2.0;
        double r479653 = r479651 / r479652;
        double r479654 = pow(r479642, r479653);
        double r479655 = r479654 / r479645;
        double r479656 = r479654 * r479655;
        double r479657 = pow(r479647, r479653);
        double r479658 = r479657 / r479648;
        double r479659 = r479657 * r479658;
        double r479660 = r479656 - r479659;
        double r479661 = sqrt(r479660);
        double r479662 = r479650 / r479661;
        double r479663 = sqrt(r479645);
        double r479664 = r479654 / r479663;
        double r479665 = pow(r479647, r479651);
        double r479666 = r479665 / r479648;
        double r479667 = sqrt(r479666);
        double r479668 = r479664 + r479667;
        double r479669 = sqrt(r479668);
        double r479670 = r479650 / r479669;
        double r479671 = r479664 - r479667;
        double r479672 = sqrt(r479671);
        double r479673 = r479670 / r479672;
        double r479674 = r479644 ? r479662 : r479673;
        return r479674;
}

Error

Bits error versus x

Bits error versus n

Bits error versus y

Bits error versus m

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < 5.690037625071411e+220

    1. Initial program 37.9

      \[\frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\frac{{x}^{2}}{n} - \frac{{y}^{2}}{m}}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity37.9

      \[\leadsto \frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\frac{{x}^{2}}{n} - \frac{{y}^{2}}{\color{blue}{1 \cdot m}}}}\]
    4. Applied sqr-pow37.9

      \[\leadsto \frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\frac{{x}^{2}}{n} - \frac{\color{blue}{{y}^{\left(\frac{2}{2}\right)} \cdot {y}^{\left(\frac{2}{2}\right)}}}{1 \cdot m}}}\]
    5. Applied times-frac33.7

      \[\leadsto \frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\frac{{x}^{2}}{n} - \color{blue}{\frac{{y}^{\left(\frac{2}{2}\right)}}{1} \cdot \frac{{y}^{\left(\frac{2}{2}\right)}}{m}}}}\]
    6. Simplified33.7

      \[\leadsto \frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\frac{{x}^{2}}{n} - \color{blue}{{y}^{\left(\frac{2}{2}\right)}} \cdot \frac{{y}^{\left(\frac{2}{2}\right)}}{m}}}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity33.7

      \[\leadsto \frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\frac{{x}^{2}}{\color{blue}{1 \cdot n}} - {y}^{\left(\frac{2}{2}\right)} \cdot \frac{{y}^{\left(\frac{2}{2}\right)}}{m}}}\]
    9. Applied sqr-pow33.7

      \[\leadsto \frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\frac{\color{blue}{{x}^{\left(\frac{2}{2}\right)} \cdot {x}^{\left(\frac{2}{2}\right)}}}{1 \cdot n} - {y}^{\left(\frac{2}{2}\right)} \cdot \frac{{y}^{\left(\frac{2}{2}\right)}}{m}}}\]
    10. Applied times-frac29.4

      \[\leadsto \frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\color{blue}{\frac{{x}^{\left(\frac{2}{2}\right)}}{1} \cdot \frac{{x}^{\left(\frac{2}{2}\right)}}{n}} - {y}^{\left(\frac{2}{2}\right)} \cdot \frac{{y}^{\left(\frac{2}{2}\right)}}{m}}}\]
    11. Simplified29.4

      \[\leadsto \frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\color{blue}{{x}^{\left(\frac{2}{2}\right)}} \cdot \frac{{x}^{\left(\frac{2}{2}\right)}}{n} - {y}^{\left(\frac{2}{2}\right)} \cdot \frac{{y}^{\left(\frac{2}{2}\right)}}{m}}}\]

    if 5.690037625071411e+220 < x

    1. Initial program 63.0

      \[\frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\frac{{x}^{2}}{n} - \frac{{y}^{2}}{m}}}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt63.4

      \[\leadsto \frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\frac{{x}^{2}}{n} - \color{blue}{\sqrt{\frac{{y}^{2}}{m}} \cdot \sqrt{\frac{{y}^{2}}{m}}}}}\]
    4. Applied add-sqr-sqrt63.4

      \[\leadsto \frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\frac{{x}^{2}}{\color{blue}{\sqrt{n} \cdot \sqrt{n}}} - \sqrt{\frac{{y}^{2}}{m}} \cdot \sqrt{\frac{{y}^{2}}{m}}}}\]
    5. Applied sqr-pow63.4

      \[\leadsto \frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\frac{\color{blue}{{x}^{\left(\frac{2}{2}\right)} \cdot {x}^{\left(\frac{2}{2}\right)}}}{\sqrt{n} \cdot \sqrt{n}} - \sqrt{\frac{{y}^{2}}{m}} \cdot \sqrt{\frac{{y}^{2}}{m}}}}\]
    6. Applied times-frac59.1

      \[\leadsto \frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\color{blue}{\frac{{x}^{\left(\frac{2}{2}\right)}}{\sqrt{n}} \cdot \frac{{x}^{\left(\frac{2}{2}\right)}}{\sqrt{n}}} - \sqrt{\frac{{y}^{2}}{m}} \cdot \sqrt{\frac{{y}^{2}}{m}}}}\]
    7. Applied difference-of-squares59.1

      \[\leadsto \frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\color{blue}{\left(\frac{{x}^{\left(\frac{2}{2}\right)}}{\sqrt{n}} + \sqrt{\frac{{y}^{2}}{m}}\right) \cdot \left(\frac{{x}^{\left(\frac{2}{2}\right)}}{\sqrt{n}} - \sqrt{\frac{{y}^{2}}{m}}\right)}}}\]
    8. Applied sqrt-prod46.8

      \[\leadsto \frac{\frac{x}{n} - \frac{y}{m}}{\color{blue}{\sqrt{\frac{{x}^{\left(\frac{2}{2}\right)}}{\sqrt{n}} + \sqrt{\frac{{y}^{2}}{m}}} \cdot \sqrt{\frac{{x}^{\left(\frac{2}{2}\right)}}{\sqrt{n}} - \sqrt{\frac{{y}^{2}}{m}}}}}\]
    9. Applied associate-/r*46.7

      \[\leadsto \color{blue}{\frac{\frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\frac{{x}^{\left(\frac{2}{2}\right)}}{\sqrt{n}} + \sqrt{\frac{{y}^{2}}{m}}}}}{\sqrt{\frac{{x}^{\left(\frac{2}{2}\right)}}{\sqrt{n}} - \sqrt{\frac{{y}^{2}}{m}}}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification30.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 5.69003762507141083127778083459341345523 \cdot 10^{220}:\\ \;\;\;\;\frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{{x}^{\left(\frac{2}{2}\right)} \cdot \frac{{x}^{\left(\frac{2}{2}\right)}}{n} - {y}^{\left(\frac{2}{2}\right)} \cdot \frac{{y}^{\left(\frac{2}{2}\right)}}{m}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{x}{n} - \frac{y}{m}}{\sqrt{\frac{{x}^{\left(\frac{2}{2}\right)}}{\sqrt{n}} + \sqrt{\frac{{y}^{2}}{m}}}}}{\sqrt{\frac{{x}^{\left(\frac{2}{2}\right)}}{\sqrt{n}} - \sqrt{\frac{{y}^{2}}{m}}}}\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (x n y m)
  :name "(x/n - y/m)/sqrt(x^2/n - y^2/m)"
  :precision binary64
  (/ (- (/ x n) (/ y m)) (sqrt (- (/ (pow x 2) n) (/ (pow y 2) m)))))