Average Error: 29.0 → 10.3
Time: 14.6s
Precision: 64
\[\sqrt{x + y \cdot y} - y\]
\[\begin{array}{l} \mathbf{if}\;y \le 3.3973180607339597 \cdot 10^{-161}:\\ \;\;\;\;\sqrt{x + y \cdot y} - y\\ \mathbf{elif}\;y \le 1.4077656668833082 \cdot 10^{+79}:\\ \;\;\;\;x \cdot \frac{1}{y + \sqrt{x + y \cdot y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y + y}\\ \end{array}\]
\sqrt{x + y \cdot y} - y
\begin{array}{l}
\mathbf{if}\;y \le 3.3973180607339597 \cdot 10^{-161}:\\
\;\;\;\;\sqrt{x + y \cdot y} - y\\

\mathbf{elif}\;y \le 1.4077656668833082 \cdot 10^{+79}:\\
\;\;\;\;x \cdot \frac{1}{y + \sqrt{x + y \cdot y}}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y + y}\\

\end{array}
double f(double x, double y) {
        double r45329677 = x;
        double r45329678 = y;
        double r45329679 = r45329678 * r45329678;
        double r45329680 = r45329677 + r45329679;
        double r45329681 = sqrt(r45329680);
        double r45329682 = r45329681 - r45329678;
        return r45329682;
}

double f(double x, double y) {
        double r45329683 = y;
        double r45329684 = 3.3973180607339597e-161;
        bool r45329685 = r45329683 <= r45329684;
        double r45329686 = x;
        double r45329687 = r45329683 * r45329683;
        double r45329688 = r45329686 + r45329687;
        double r45329689 = sqrt(r45329688);
        double r45329690 = r45329689 - r45329683;
        double r45329691 = 1.4077656668833082e+79;
        bool r45329692 = r45329683 <= r45329691;
        double r45329693 = 1.0;
        double r45329694 = r45329683 + r45329689;
        double r45329695 = r45329693 / r45329694;
        double r45329696 = r45329686 * r45329695;
        double r45329697 = r45329683 + r45329683;
        double r45329698 = r45329686 / r45329697;
        double r45329699 = r45329692 ? r45329696 : r45329698;
        double r45329700 = r45329685 ? r45329690 : r45329699;
        return r45329700;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if y < 3.3973180607339597e-161

    1. Initial program 17.1

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

    if 3.3973180607339597e-161 < y < 1.4077656668833082e+79

    1. Initial program 28.8

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

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

      \[\leadsto \frac{\color{blue}{x}}{\sqrt{x + y \cdot y} + y}\]
    5. Using strategy rm
    6. Applied div-inv0.4

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

    if 1.4077656668833082e+79 < y

    1. Initial program 56.9

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

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

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

      \[\leadsto \frac{x}{\color{blue}{y} + y}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification10.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le 3.3973180607339597 \cdot 10^{-161}:\\ \;\;\;\;\sqrt{x + y \cdot y} - y\\ \mathbf{elif}\;y \le 1.4077656668833082 \cdot 10^{+79}:\\ \;\;\;\;x \cdot \frac{1}{y + \sqrt{x + y \cdot y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y + y}\\ \end{array}\]

Reproduce

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