Average Error: 19.9 → 20.0
Time: 27.9s
Precision: 64
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
\[\sqrt{\frac{\sqrt{x + 1} \cdot 1 - \sqrt{x} \cdot 1}{\sqrt{\sqrt{x + 1} \cdot \sqrt{x}} \cdot \sqrt{\sqrt{x + 1} \cdot \sqrt{x}}}} \cdot \sqrt{\frac{\sqrt{x + 1} \cdot 1 - \sqrt{x} \cdot 1}{\sqrt{x + 1} \cdot \sqrt{x}}}\]
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\sqrt{\frac{\sqrt{x + 1} \cdot 1 - \sqrt{x} \cdot 1}{\sqrt{\sqrt{x + 1} \cdot \sqrt{x}} \cdot \sqrt{\sqrt{x + 1} \cdot \sqrt{x}}}} \cdot \sqrt{\frac{\sqrt{x + 1} \cdot 1 - \sqrt{x} \cdot 1}{\sqrt{x + 1} \cdot \sqrt{x}}}
double f(double x) {
        double r7308006 = 1.0;
        double r7308007 = x;
        double r7308008 = sqrt(r7308007);
        double r7308009 = r7308006 / r7308008;
        double r7308010 = r7308007 + r7308006;
        double r7308011 = sqrt(r7308010);
        double r7308012 = r7308006 / r7308011;
        double r7308013 = r7308009 - r7308012;
        return r7308013;
}

double f(double x) {
        double r7308014 = x;
        double r7308015 = 1.0;
        double r7308016 = r7308014 + r7308015;
        double r7308017 = sqrt(r7308016);
        double r7308018 = r7308017 * r7308015;
        double r7308019 = sqrt(r7308014);
        double r7308020 = r7308019 * r7308015;
        double r7308021 = r7308018 - r7308020;
        double r7308022 = r7308017 * r7308019;
        double r7308023 = sqrt(r7308022);
        double r7308024 = r7308023 * r7308023;
        double r7308025 = r7308021 / r7308024;
        double r7308026 = sqrt(r7308025);
        double r7308027 = r7308021 / r7308022;
        double r7308028 = sqrt(r7308027);
        double r7308029 = r7308026 * r7308028;
        return r7308029;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original19.9
Target0.6
Herbie20.0
\[\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}}\]

Derivation

  1. Initial program 19.9

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
  2. Using strategy rm
  3. Applied frac-sub19.9

    \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}}\]
  4. Using strategy rm
  5. Applied add-sqr-sqrt20.0

    \[\leadsto \color{blue}{\sqrt{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \cdot \sqrt{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}}}\]
  6. Using strategy rm
  7. Applied add-sqr-sqrt20.0

    \[\leadsto \sqrt{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\color{blue}{\sqrt{\sqrt{x} \cdot \sqrt{x + 1}} \cdot \sqrt{\sqrt{x} \cdot \sqrt{x + 1}}}}} \cdot \sqrt{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}}\]
  8. Final simplification20.0

    \[\leadsto \sqrt{\frac{\sqrt{x + 1} \cdot 1 - \sqrt{x} \cdot 1}{\sqrt{\sqrt{x + 1} \cdot \sqrt{x}} \cdot \sqrt{\sqrt{x + 1} \cdot \sqrt{x}}}} \cdot \sqrt{\frac{\sqrt{x + 1} \cdot 1 - \sqrt{x} \cdot 1}{\sqrt{x + 1} \cdot \sqrt{x}}}\]

Reproduce

herbie shell --seed 2019168 
(FPCore (x)
  :name "2isqrt (example 3.6)"

  :herbie-target
  (/ 1.0 (+ (* (+ x 1.0) (sqrt x)) (* x (sqrt (+ x 1.0)))))

  (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))