Average Error: 0.5 → 0.0
Time: 2.3s
Precision: 64
\[\sqrt{x - 1} \cdot \sqrt{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le 67840.3960161231953:\\ \;\;\;\;\sqrt{\left(x - 1\right) \cdot x}\\ \mathbf{else}:\\ \;\;\;\;x - \left(0.5 + 0.125 \cdot \frac{1}{x}\right)\\ \end{array}\]
\sqrt{x - 1} \cdot \sqrt{x}
\begin{array}{l}
\mathbf{if}\;x \le 67840.3960161231953:\\
\;\;\;\;\sqrt{\left(x - 1\right) \cdot x}\\

\mathbf{else}:\\
\;\;\;\;x - \left(0.5 + 0.125 \cdot \frac{1}{x}\right)\\

\end{array}
double code(double x) {
	return (sqrt((x - 1.0)) * sqrt(x));
}
double code(double x) {
	double VAR;
	if ((x <= 67840.3960161232)) {
		VAR = sqrt(((x - 1.0) * x));
	} else {
		VAR = (x - (0.5 + (0.125 * (1.0 / x))));
	}
	return VAR;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < 67840.3960161232

    1. Initial program 0.3

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

      \[\leadsto \color{blue}{\sqrt{\left(x - 1\right) \cdot x}}\]

    if 67840.3960161232 < x

    1. Initial program 0.5

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

      \[\leadsto \color{blue}{x - \left(0.5 + 0.125 \cdot \frac{1}{x}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 67840.3960161231953:\\ \;\;\;\;\sqrt{\left(x - 1\right) \cdot x}\\ \mathbf{else}:\\ \;\;\;\;x - \left(0.5 + 0.125 \cdot \frac{1}{x}\right)\\ \end{array}\]

Reproduce

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