Average Error: 0.0 → 0.0
Time: 9.0s
Precision: 64
\[\sqrt{x - 1} + \sqrt{x}\]
\[\sqrt{x - 1} + \sqrt{x}\]
\sqrt{x - 1} + \sqrt{x}
\sqrt{x - 1} + \sqrt{x}
double f(double x) {
        double r906615 = x;
        double r906616 = 1.0;
        double r906617 = r906615 - r906616;
        double r906618 = sqrt(r906617);
        double r906619 = sqrt(r906615);
        double r906620 = r906618 + r906619;
        return r906620;
}

double f(double x) {
        double r906621 = x;
        double r906622 = 1.0;
        double r906623 = r906621 - r906622;
        double r906624 = sqrt(r906623);
        double r906625 = sqrt(r906621);
        double r906626 = r906624 + r906625;
        return r906626;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[\sqrt{x - 1} + \sqrt{x}\]
  2. Final simplification0.0

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

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "sqrt(x-1) + sqrt(x)"
  :precision binary64
  (+ (sqrt (- x 1)) (sqrt x)))