Average Error: 0.5 → 0.4
Time: 13.3s
Precision: 64
\[\sqrt{x - 1} \cdot \sqrt{x}\]
\[\left(x - 0.5\right) - \frac{0.125}{x}\]
\sqrt{x - 1} \cdot \sqrt{x}
\left(x - 0.5\right) - \frac{0.125}{x}
double f(double x) {
        double r27247540 = x;
        double r27247541 = 1.0;
        double r27247542 = r27247540 - r27247541;
        double r27247543 = sqrt(r27247542);
        double r27247544 = sqrt(r27247540);
        double r27247545 = r27247543 * r27247544;
        return r27247545;
}

double f(double x) {
        double r27247546 = x;
        double r27247547 = 0.5;
        double r27247548 = r27247546 - r27247547;
        double r27247549 = 0.125;
        double r27247550 = r27247549 / r27247546;
        double r27247551 = r27247548 - r27247550;
        return r27247551;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.5

    \[\sqrt{x - 1} \cdot \sqrt{x}\]
  2. Taylor expanded around inf 0.4

    \[\leadsto \color{blue}{x - \left(0.125 \cdot \frac{1}{x} + 0.5\right)}\]
  3. Simplified0.4

    \[\leadsto \color{blue}{\left(x - 0.5\right) - \frac{0.125}{x}}\]
  4. Final simplification0.4

    \[\leadsto \left(x - 0.5\right) - \frac{0.125}{x}\]

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "sqrt(x-1) * sqrt(x)"
  (* (sqrt (- x 1.0)) (sqrt x)))