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

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Alternatives

Alternative 1
Error0.6
Cost192
\[x - 0.5\]
Alternative 2
Error1.4
Cost64
\[x\]

Error

Time

Derivation

  1. Initial program 0.5

    \[\sqrt{x - 1} \cdot \sqrt{x}\]
  2. Using strategy rm
  3. Applied pow1_binary640.5

    \[\leadsto \sqrt{x - 1} \cdot \color{blue}{{\left(\sqrt{x}\right)}^{1}}\]
  4. Applied pow1_binary640.5

    \[\leadsto \color{blue}{{\left(\sqrt{x - 1}\right)}^{1}} \cdot {\left(\sqrt{x}\right)}^{1}\]
  5. Applied pow-prod-down_binary640.5

    \[\leadsto \color{blue}{{\left(\sqrt{x - 1} \cdot \sqrt{x}\right)}^{1}}\]
  6. Taylor expanded around inf 0.4

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

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

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

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

Reproduce

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