Average Error: 28.9 → 0.1
Time: 8.8s
Precision: 64
\[\left(\left(1 + x\right) - x\right) + \sqrt{\frac{1}{x}}\]
\[\sqrt{\frac{1}{x}} + 1\]
\left(\left(1 + x\right) - x\right) + \sqrt{\frac{1}{x}}
\sqrt{\frac{1}{x}} + 1
double f(double x) {
        double r3468310 = 1.0;
        double r3468311 = x;
        double r3468312 = r3468310 + r3468311;
        double r3468313 = r3468312 - r3468311;
        double r3468314 = r3468310 / r3468311;
        double r3468315 = sqrt(r3468314);
        double r3468316 = r3468313 + r3468315;
        return r3468316;
}

double f(double x) {
        double r3468317 = 1.0;
        double r3468318 = x;
        double r3468319 = r3468317 / r3468318;
        double r3468320 = sqrt(r3468319);
        double r3468321 = r3468320 + r3468317;
        return r3468321;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 28.9

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

    \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} + 1}\]
  3. Final simplification0.1

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

Reproduce

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