Average Error: 0.0 → 0.0
Time: 9.5s
Precision: 64
\[\sqrt{x - 1} + \sqrt{\left(\frac{x}{2} - 1\right) + \frac{x}{2}}\]
\[\sqrt{x - 1} + \sqrt{\frac{x}{2} + \left(\frac{x}{2} - 1\right)}\]
\sqrt{x - 1} + \sqrt{\left(\frac{x}{2} - 1\right) + \frac{x}{2}}
\sqrt{x - 1} + \sqrt{\frac{x}{2} + \left(\frac{x}{2} - 1\right)}
double f(double x) {
        double r58380241 = x;
        double r58380242 = 1.0;
        double r58380243 = r58380241 - r58380242;
        double r58380244 = sqrt(r58380243);
        double r58380245 = 2.0;
        double r58380246 = r58380241 / r58380245;
        double r58380247 = r58380246 - r58380242;
        double r58380248 = r58380247 + r58380246;
        double r58380249 = sqrt(r58380248);
        double r58380250 = r58380244 + r58380249;
        return r58380250;
}

double f(double x) {
        double r58380251 = x;
        double r58380252 = 1.0;
        double r58380253 = r58380251 - r58380252;
        double r58380254 = sqrt(r58380253);
        double r58380255 = 2.0;
        double r58380256 = r58380251 / r58380255;
        double r58380257 = r58380256 - r58380252;
        double r58380258 = r58380256 + r58380257;
        double r58380259 = sqrt(r58380258);
        double r58380260 = r58380254 + r58380259;
        return r58380260;
}

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{\left(\frac{x}{2} - 1\right) + \frac{x}{2}}\]
  2. Final simplification0.0

    \[\leadsto \sqrt{x - 1} + \sqrt{\frac{x}{2} + \left(\frac{x}{2} - 1\right)}\]

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "sqrt(x-1) + sqrt(x/2 -1 + x/2)"
  (+ (sqrt (- x 1.0)) (sqrt (+ (- (/ x 2.0) 1.0) (/ x 2.0)))))