Average Error: 29.3 → 0.2
Time: 13.7s
Precision: 64
\[\sqrt{y \cdot y + x} - y\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.3383281141144088 \cdot 10^{+154}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{x}{y} - \left(y + y\right)\\ \mathbf{elif}\;y \le 1.8195525692887086 \cdot 10^{-116}:\\ \;\;\;\;\sqrt{x + y \cdot y} - y\\ \mathbf{elif}\;y \le 9.850187538651427 \cdot 10^{+117}:\\ \;\;\;\;\frac{x}{y + \sqrt{x + y \cdot y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(\frac{1}{2} \cdot \frac{x}{y} + y\right) + y}\\ \end{array}\]
\sqrt{y \cdot y + x} - y
\begin{array}{l}
\mathbf{if}\;y \le -1.3383281141144088 \cdot 10^{+154}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{x}{y} - \left(y + y\right)\\

\mathbf{elif}\;y \le 1.8195525692887086 \cdot 10^{-116}:\\
\;\;\;\;\sqrt{x + y \cdot y} - y\\

\mathbf{elif}\;y \le 9.850187538651427 \cdot 10^{+117}:\\
\;\;\;\;\frac{x}{y + \sqrt{x + y \cdot y}}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(\frac{1}{2} \cdot \frac{x}{y} + y\right) + y}\\

\end{array}
double f(double y, double x) {
        double r45714349 = y;
        double r45714350 = r45714349 * r45714349;
        double r45714351 = x;
        double r45714352 = r45714350 + r45714351;
        double r45714353 = sqrt(r45714352);
        double r45714354 = r45714353 - r45714349;
        return r45714354;
}

double f(double y, double x) {
        double r45714355 = y;
        double r45714356 = -1.3383281141144088e+154;
        bool r45714357 = r45714355 <= r45714356;
        double r45714358 = -0.5;
        double r45714359 = x;
        double r45714360 = r45714359 / r45714355;
        double r45714361 = r45714358 * r45714360;
        double r45714362 = r45714355 + r45714355;
        double r45714363 = r45714361 - r45714362;
        double r45714364 = 1.8195525692887086e-116;
        bool r45714365 = r45714355 <= r45714364;
        double r45714366 = r45714355 * r45714355;
        double r45714367 = r45714359 + r45714366;
        double r45714368 = sqrt(r45714367);
        double r45714369 = r45714368 - r45714355;
        double r45714370 = 9.850187538651427e+117;
        bool r45714371 = r45714355 <= r45714370;
        double r45714372 = r45714355 + r45714368;
        double r45714373 = r45714359 / r45714372;
        double r45714374 = 0.5;
        double r45714375 = r45714374 * r45714360;
        double r45714376 = r45714375 + r45714355;
        double r45714377 = r45714376 + r45714355;
        double r45714378 = r45714359 / r45714377;
        double r45714379 = r45714371 ? r45714373 : r45714378;
        double r45714380 = r45714365 ? r45714369 : r45714379;
        double r45714381 = r45714357 ? r45714363 : r45714380;
        return r45714381;
}

Error

Bits error versus y

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if y < -1.3383281141144088e+154

    1. Initial program 59.5

      \[\sqrt{y \cdot y + x} - y\]
    2. Taylor expanded around -inf 0

      \[\leadsto \color{blue}{-\left(2 \cdot y + \frac{1}{2} \cdot \frac{x}{y}\right)}\]
    3. Simplified0

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{x}{y} - \left(y + y\right)}\]

    if -1.3383281141144088e+154 < y < 1.8195525692887086e-116

    1. Initial program 0.3

      \[\sqrt{y \cdot y + x} - y\]

    if 1.8195525692887086e-116 < y < 9.850187538651427e+117

    1. Initial program 36.5

      \[\sqrt{y \cdot y + x} - y\]
    2. Using strategy rm
    3. Applied flip--36.6

      \[\leadsto \color{blue}{\frac{\sqrt{y \cdot y + x} \cdot \sqrt{y \cdot y + x} - y \cdot y}{\sqrt{y \cdot y + x} + y}}\]
    4. Simplified0.2

      \[\leadsto \frac{\color{blue}{x}}{\sqrt{y \cdot y + x} + y}\]

    if 9.850187538651427e+117 < y

    1. Initial program 59.1

      \[\sqrt{y \cdot y + x} - y\]
    2. Using strategy rm
    3. Applied flip--59.1

      \[\leadsto \color{blue}{\frac{\sqrt{y \cdot y + x} \cdot \sqrt{y \cdot y + x} - y \cdot y}{\sqrt{y \cdot y + x} + y}}\]
    4. Simplified31.5

      \[\leadsto \frac{\color{blue}{x}}{\sqrt{y \cdot y + x} + y}\]
    5. Taylor expanded around inf 0.4

      \[\leadsto \frac{x}{\color{blue}{\left(y + \frac{1}{2} \cdot \frac{x}{y}\right)} + y}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification0.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.3383281141144088 \cdot 10^{+154}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{x}{y} - \left(y + y\right)\\ \mathbf{elif}\;y \le 1.8195525692887086 \cdot 10^{-116}:\\ \;\;\;\;\sqrt{x + y \cdot y} - y\\ \mathbf{elif}\;y \le 9.850187538651427 \cdot 10^{+117}:\\ \;\;\;\;\frac{x}{y + \sqrt{x + y \cdot y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(\frac{1}{2} \cdot \frac{x}{y} + y\right) + y}\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (y x)
  :name "sqrt(y*y+x)-y"
  (- (sqrt (+ (* y y) x)) y))