Average Error: 0.5 → 0.4
Time: 1.9s
Precision: 64
\[\sqrt{x - 1} \cdot \sqrt{x}\]
\[x - \left(0.5 + 0.125 \cdot \frac{1}{x}\right)\]
\sqrt{x - 1} \cdot \sqrt{x}
x - \left(0.5 + 0.125 \cdot \frac{1}{x}\right)
double code(double x) {
	return (sqrt((x - 1.0)) * sqrt(x));
}
double code(double x) {
	return (x - (0.5 + (0.125 * (1.0 / x))));
}

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.5 + 0.125 \cdot \frac{1}{x}\right)}\]
  3. Final simplification0.4

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

Reproduce

herbie shell --seed 2020057 
(FPCore (x)
  :name "sqrt times"
  :precision binary64
  (* (sqrt (- x 1)) (sqrt x)))