Average Error: 31.1 → 20.7
Time: 15.8s
Precision: 64
\[\sqrt{\sqrt{{x}^{2} + 1}} - \sqrt{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le 3.605250175103418 \cdot 10^{+76}:\\ \;\;\;\;\sqrt{\sqrt[3]{\sqrt{1 + x \cdot x}} \cdot \left(\sqrt[3]{\sqrt{1 + x \cdot x}} \cdot \sqrt[3]{\sqrt{\sqrt{1 + x \cdot x}} \cdot \sqrt{\sqrt{1 + x \cdot x}}}\right)} - \sqrt{x}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(\frac{\frac{1}{2}}{x} + x\right) - \frac{\frac{\frac{\frac{1}{8}}{x}}{x}}{x}} - \sqrt{x}\\ \end{array}\]
\sqrt{\sqrt{{x}^{2} + 1}} - \sqrt{x}
\begin{array}{l}
\mathbf{if}\;x \le 3.605250175103418 \cdot 10^{+76}:\\
\;\;\;\;\sqrt{\sqrt[3]{\sqrt{1 + x \cdot x}} \cdot \left(\sqrt[3]{\sqrt{1 + x \cdot x}} \cdot \sqrt[3]{\sqrt{\sqrt{1 + x \cdot x}} \cdot \sqrt{\sqrt{1 + x \cdot x}}}\right)} - \sqrt{x}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\left(\frac{\frac{1}{2}}{x} + x\right) - \frac{\frac{\frac{\frac{1}{8}}{x}}{x}}{x}} - \sqrt{x}\\

\end{array}
double f(double x) {
        double r4474580 = x;
        double r4474581 = 2.0;
        double r4474582 = pow(r4474580, r4474581);
        double r4474583 = 1.0;
        double r4474584 = r4474582 + r4474583;
        double r4474585 = sqrt(r4474584);
        double r4474586 = sqrt(r4474585);
        double r4474587 = sqrt(r4474580);
        double r4474588 = r4474586 - r4474587;
        return r4474588;
}

double f(double x) {
        double r4474589 = x;
        double r4474590 = 3.605250175103418e+76;
        bool r4474591 = r4474589 <= r4474590;
        double r4474592 = 1.0;
        double r4474593 = r4474589 * r4474589;
        double r4474594 = r4474592 + r4474593;
        double r4474595 = sqrt(r4474594);
        double r4474596 = cbrt(r4474595);
        double r4474597 = sqrt(r4474595);
        double r4474598 = r4474597 * r4474597;
        double r4474599 = cbrt(r4474598);
        double r4474600 = r4474596 * r4474599;
        double r4474601 = r4474596 * r4474600;
        double r4474602 = sqrt(r4474601);
        double r4474603 = sqrt(r4474589);
        double r4474604 = r4474602 - r4474603;
        double r4474605 = 0.5;
        double r4474606 = r4474605 / r4474589;
        double r4474607 = r4474606 + r4474589;
        double r4474608 = 0.125;
        double r4474609 = r4474608 / r4474589;
        double r4474610 = r4474609 / r4474589;
        double r4474611 = r4474610 / r4474589;
        double r4474612 = r4474607 - r4474611;
        double r4474613 = sqrt(r4474612);
        double r4474614 = r4474613 - r4474603;
        double r4474615 = r4474591 ? r4474604 : r4474614;
        return r4474615;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < 3.605250175103418e+76

    1. Initial program 11.9

      \[\sqrt{\sqrt{{x}^{2} + 1}} - \sqrt{x}\]
    2. Simplified11.9

      \[\leadsto \color{blue}{\sqrt{\sqrt{1 + x \cdot x}} - \sqrt{x}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt11.8

      \[\leadsto \sqrt{\color{blue}{\left(\sqrt[3]{\sqrt{1 + x \cdot x}} \cdot \sqrt[3]{\sqrt{1 + x \cdot x}}\right) \cdot \sqrt[3]{\sqrt{1 + x \cdot x}}}} - \sqrt{x}\]
    5. Using strategy rm
    6. Applied add-sqr-sqrt11.8

      \[\leadsto \sqrt{\left(\sqrt[3]{\sqrt{\color{blue}{\sqrt{1 + x \cdot x} \cdot \sqrt{1 + x \cdot x}}}} \cdot \sqrt[3]{\sqrt{1 + x \cdot x}}\right) \cdot \sqrt[3]{\sqrt{1 + x \cdot x}}} - \sqrt{x}\]
    7. Applied sqrt-prod11.8

      \[\leadsto \sqrt{\left(\sqrt[3]{\color{blue}{\sqrt{\sqrt{1 + x \cdot x}} \cdot \sqrt{\sqrt{1 + x \cdot x}}}} \cdot \sqrt[3]{\sqrt{1 + x \cdot x}}\right) \cdot \sqrt[3]{\sqrt{1 + x \cdot x}}} - \sqrt{x}\]

    if 3.605250175103418e+76 < x

    1. Initial program 62.2

      \[\sqrt{\sqrt{{x}^{2} + 1}} - \sqrt{x}\]
    2. Simplified62.2

      \[\leadsto \color{blue}{\sqrt{\sqrt{1 + x \cdot x}} - \sqrt{x}}\]
    3. Taylor expanded around inf 35.2

      \[\leadsto \sqrt{\color{blue}{\left(\frac{1}{2} \cdot \frac{1}{x} + x\right) - \frac{1}{8} \cdot \frac{1}{{x}^{3}}}} - \sqrt{x}\]
    4. Simplified35.2

      \[\leadsto \sqrt{\color{blue}{\left(\frac{\frac{1}{2}}{x} + x\right) - \frac{\frac{\frac{\frac{1}{8}}{x}}{x}}{x}}} - \sqrt{x}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification20.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 3.605250175103418 \cdot 10^{+76}:\\ \;\;\;\;\sqrt{\sqrt[3]{\sqrt{1 + x \cdot x}} \cdot \left(\sqrt[3]{\sqrt{1 + x \cdot x}} \cdot \sqrt[3]{\sqrt{\sqrt{1 + x \cdot x}} \cdot \sqrt{\sqrt{1 + x \cdot x}}}\right)} - \sqrt{x}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(\frac{\frac{1}{2}}{x} + x\right) - \frac{\frac{\frac{\frac{1}{8}}{x}}{x}}{x}} - \sqrt{x}\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "sqrt(sqrt(x^2+1)) - sqrt(x)"
  (- (sqrt (sqrt (+ (pow x 2) 1))) (sqrt x)))