2isqrt (example 3.6)

Percentage Accurate: 69.4% → 99.8%
Time: 14.7s
Alternatives: 13
Speedup: 1.9×

Specification

?
\[\begin{array}{l} \\ \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \end{array} \]
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
double code(double x) {
	return (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (1.0d0 / sqrt(x)) - (1.0d0 / sqrt((x + 1.0d0)))
end function
public static double code(double x) {
	return (1.0 / Math.sqrt(x)) - (1.0 / Math.sqrt((x + 1.0)));
}
def code(x):
	return (1.0 / math.sqrt(x)) - (1.0 / math.sqrt((x + 1.0)))
function code(x)
	return Float64(Float64(1.0 / sqrt(x)) - Float64(1.0 / sqrt(Float64(x + 1.0))))
end
function tmp = code(x)
	tmp = (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
end
code[x_] := N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 13 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 69.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \end{array} \]
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
double code(double x) {
	return (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (1.0d0 / sqrt(x)) - (1.0d0 / sqrt((x + 1.0d0)))
end function
public static double code(double x) {
	return (1.0 / Math.sqrt(x)) - (1.0 / Math.sqrt((x + 1.0)));
}
def code(x):
	return (1.0 / math.sqrt(x)) - (1.0 / math.sqrt((x + 1.0)))
function code(x)
	return Float64(Float64(1.0 / sqrt(x)) - Float64(1.0 / sqrt(Float64(x + 1.0))))
end
function tmp = code(x)
	tmp = (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
end
code[x_] := N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\end{array}

Alternative 1: 99.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 10^{+81}:\\ \;\;\;\;\frac{{x}^{-0.5}}{1 + \left(x + \sqrt{\mathsf{fma}\left(x, x, x\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\sqrt{x}}}{x + x}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 1e+81)
   (/ (pow x -0.5) (+ 1.0 (+ x (sqrt (fma x x x)))))
   (/ (/ 1.0 (sqrt x)) (+ x x))))
double code(double x) {
	double tmp;
	if (x <= 1e+81) {
		tmp = pow(x, -0.5) / (1.0 + (x + sqrt(fma(x, x, x))));
	} else {
		tmp = (1.0 / sqrt(x)) / (x + x);
	}
	return tmp;
}
function code(x)
	tmp = 0.0
	if (x <= 1e+81)
		tmp = Float64((x ^ -0.5) / Float64(1.0 + Float64(x + sqrt(fma(x, x, x)))));
	else
		tmp = Float64(Float64(1.0 / sqrt(x)) / Float64(x + x));
	end
	return tmp
end
code[x_] := If[LessEqual[x, 1e+81], N[(N[Power[x, -0.5], $MachinePrecision] / N[(1.0 + N[(x + N[Sqrt[N[(x * x + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / N[(x + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{+81}:\\
\;\;\;\;\frac{{x}^{-0.5}}{1 + \left(x + \sqrt{\mathsf{fma}\left(x, x, x\right)}\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\sqrt{x}}}{x + x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 9.99999999999999921e80

    1. Initial program 82.9%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. frac-sub82.9%

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      2. associate-/r*82.9%

        \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
      3. div-inv82.9%

        \[\leadsto \frac{\color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x}}}}{\sqrt{x + 1}} \]
      4. associate-*r/82.9%

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
      5. flip--83.5%

        \[\leadsto \color{blue}{\frac{\left(1 \cdot \sqrt{x + 1}\right) \cdot \left(1 \cdot \sqrt{x + 1}\right) - \left(\sqrt{x} \cdot 1\right) \cdot \left(\sqrt{x} \cdot 1\right)}{1 \cdot \sqrt{x + 1} + \sqrt{x} \cdot 1}} \cdot \frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}} \]
      6. frac-times83.5%

        \[\leadsto \color{blue}{\frac{\left(\left(1 \cdot \sqrt{x + 1}\right) \cdot \left(1 \cdot \sqrt{x + 1}\right) - \left(\sqrt{x} \cdot 1\right) \cdot \left(\sqrt{x} \cdot 1\right)\right) \cdot \frac{1}{\sqrt{x}}}{\left(1 \cdot \sqrt{x + 1} + \sqrt{x} \cdot 1\right) \cdot \sqrt{x + 1}}} \]
    3. Applied egg-rr85.6%

      \[\leadsto \color{blue}{\frac{\left(\left(1 + x\right) - x\right) \cdot {x}^{-0.5}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}} \]
    4. Step-by-step derivation
      1. associate-/l*85.5%

        \[\leadsto \color{blue}{\frac{\left(1 + x\right) - x}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}}} \]
      2. associate--l+99.6%

        \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      3. +-inverses99.6%

        \[\leadsto \frac{1 + \color{blue}{0}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      4. metadata-eval99.6%

        \[\leadsto \frac{\color{blue}{1}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      5. associate-/l*99.8%

        \[\leadsto \color{blue}{\frac{1 \cdot {x}^{-0.5}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}} \]
      6. *-lft-identity99.8%

        \[\leadsto \frac{\color{blue}{{x}^{-0.5}}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}} \]
      7. *-commutative99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)}} \]
      8. +-commutative99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\sqrt{1 + x} \cdot \color{blue}{\left(\sqrt{1 + x} + \sqrt{x}\right)}} \]
      9. distribute-lft-in99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot \sqrt{1 + x} + \sqrt{1 + x} \cdot \sqrt{x}}} \]
      10. rem-square-sqrt99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(1 + x\right)} + \sqrt{1 + x} \cdot \sqrt{x}} \]
    5. Simplified99.8%

      \[\leadsto \color{blue}{\frac{{x}^{-0.5}}{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}}} \]
    6. Step-by-step derivation
      1. add-sqr-sqrt_binary6499.6%

        \[\leadsto \color{blue}{\frac{{x}^{-0.5}}{\sqrt{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}} \cdot \sqrt{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}}}} \]
    7. Applied rewrite-once99.6%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}} \cdot \sqrt{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}}}} \]
    8. Step-by-step derivation
      1. rem-square-sqrt99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}}} \]
      2. associate-+l+99.9%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{1 + \left(x + \sqrt{1 + x} \cdot \sqrt{x}\right)}} \]
      3. +-commutative99.9%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(x + \sqrt{1 + x} \cdot \sqrt{x}\right) + 1}} \]
      4. sqrt-prod99.9%

        \[\leadsto \frac{{x}^{-0.5}}{\left(x + \color{blue}{\sqrt{\left(1 + x\right) \cdot x}}\right) + 1} \]
      5. +-commutative99.9%

        \[\leadsto \frac{{x}^{-0.5}}{\left(x + \sqrt{\color{blue}{\left(x + 1\right)} \cdot x}\right) + 1} \]
      6. distribute-lft1-in99.9%

        \[\leadsto \frac{{x}^{-0.5}}{\left(x + \sqrt{\color{blue}{x \cdot x + x}}\right) + 1} \]
      7. fma-udef99.9%

        \[\leadsto \frac{{x}^{-0.5}}{\left(x + \sqrt{\color{blue}{\mathsf{fma}\left(x, x, x\right)}}\right) + 1} \]
    9. Applied egg-rr99.9%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(x + \sqrt{\mathsf{fma}\left(x, x, x\right)}\right) + 1}} \]

    if 9.99999999999999921e80 < x

    1. Initial program 48.4%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. frac-sub48.4%

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      2. associate-/r*48.4%

        \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
      3. div-inv48.4%

        \[\leadsto \frac{\color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x}}}}{\sqrt{x + 1}} \]
      4. associate-*r/48.4%

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
      5. flip--48.4%

        \[\leadsto \color{blue}{\frac{\left(1 \cdot \sqrt{x + 1}\right) \cdot \left(1 \cdot \sqrt{x + 1}\right) - \left(\sqrt{x} \cdot 1\right) \cdot \left(\sqrt{x} \cdot 1\right)}{1 \cdot \sqrt{x + 1} + \sqrt{x} \cdot 1}} \cdot \frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}} \]
      6. frac-times48.4%

        \[\leadsto \color{blue}{\frac{\left(\left(1 \cdot \sqrt{x + 1}\right) \cdot \left(1 \cdot \sqrt{x + 1}\right) - \left(\sqrt{x} \cdot 1\right) \cdot \left(\sqrt{x} \cdot 1\right)\right) \cdot \frac{1}{\sqrt{x}}}{\left(1 \cdot \sqrt{x + 1} + \sqrt{x} \cdot 1\right) \cdot \sqrt{x + 1}}} \]
    3. Applied egg-rr48.4%

      \[\leadsto \color{blue}{\frac{\left(\left(1 + x\right) - x\right) \cdot {x}^{-0.5}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}} \]
    4. Step-by-step derivation
      1. associate-/l*48.4%

        \[\leadsto \color{blue}{\frac{\left(1 + x\right) - x}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}}} \]
      2. associate--l+96.7%

        \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      3. +-inverses96.7%

        \[\leadsto \frac{1 + \color{blue}{0}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      4. metadata-eval96.7%

        \[\leadsto \frac{\color{blue}{1}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      5. associate-/l*99.6%

        \[\leadsto \color{blue}{\frac{1 \cdot {x}^{-0.5}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}} \]
      6. *-lft-identity99.6%

        \[\leadsto \frac{\color{blue}{{x}^{-0.5}}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}} \]
      7. *-commutative99.6%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)}} \]
      8. +-commutative99.6%

        \[\leadsto \frac{{x}^{-0.5}}{\sqrt{1 + x} \cdot \color{blue}{\left(\sqrt{1 + x} + \sqrt{x}\right)}} \]
      9. distribute-lft-in99.6%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot \sqrt{1 + x} + \sqrt{1 + x} \cdot \sqrt{x}}} \]
      10. rem-square-sqrt99.7%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(1 + x\right)} + \sqrt{1 + x} \cdot \sqrt{x}} \]
    5. Simplified99.7%

      \[\leadsto \color{blue}{\frac{{x}^{-0.5}}{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}}} \]
    6. Step-by-step derivation
      1. clear-num96.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}}{{x}^{-0.5}}}} \]
      2. frac-2neg96.8%

        \[\leadsto \color{blue}{\frac{-1}{-\frac{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}}{{x}^{-0.5}}}} \]
      3. div-inv96.8%

        \[\leadsto \color{blue}{\left(-1\right) \cdot \frac{1}{-\frac{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}}{{x}^{-0.5}}}} \]
      4. metadata-eval96.8%

        \[\leadsto \color{blue}{-1} \cdot \frac{1}{-\frac{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}}{{x}^{-0.5}}} \]
      5. metadata-eval96.8%

        \[\leadsto -1 \cdot \frac{1}{-\frac{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}}{{x}^{\color{blue}{\left(-0.5\right)}}}} \]
      6. pow-flip96.7%

        \[\leadsto -1 \cdot \frac{1}{-\frac{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}}{\color{blue}{\frac{1}{{x}^{0.5}}}}} \]
      7. pow1/296.7%

        \[\leadsto -1 \cdot \frac{1}{-\frac{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}}{\frac{1}{\color{blue}{\sqrt{x}}}}} \]
      8. div-inv96.8%

        \[\leadsto -1 \cdot \frac{1}{-\color{blue}{\left(\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}\right) \cdot \frac{1}{\frac{1}{\sqrt{x}}}}} \]
      9. remove-double-div96.8%

        \[\leadsto -1 \cdot \frac{1}{-\left(\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}\right) \cdot \color{blue}{\sqrt{x}}} \]
      10. *-commutative96.8%

        \[\leadsto -1 \cdot \frac{1}{-\color{blue}{\sqrt{x} \cdot \left(\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}\right)}} \]
      11. associate-+l+96.8%

        \[\leadsto -1 \cdot \frac{1}{-\sqrt{x} \cdot \color{blue}{\left(1 + \left(x + \sqrt{1 + x} \cdot \sqrt{x}\right)\right)}} \]
      12. sqrt-unprod69.6%

        \[\leadsto -1 \cdot \frac{1}{-\sqrt{x} \cdot \left(1 + \left(x + \color{blue}{\sqrt{\left(1 + x\right) \cdot x}}\right)\right)} \]
      13. +-commutative69.6%

        \[\leadsto -1 \cdot \frac{1}{-\sqrt{x} \cdot \left(1 + \left(x + \sqrt{\color{blue}{\left(x + 1\right)} \cdot x}\right)\right)} \]
      14. distribute-lft1-in69.6%

        \[\leadsto -1 \cdot \frac{1}{-\sqrt{x} \cdot \left(1 + \left(x + \sqrt{\color{blue}{x \cdot x + x}}\right)\right)} \]
      15. fma-def69.6%

        \[\leadsto -1 \cdot \frac{1}{-\sqrt{x} \cdot \left(1 + \left(x + \sqrt{\color{blue}{\mathsf{fma}\left(x, x, x\right)}}\right)\right)} \]
    7. Applied egg-rr69.6%

      \[\leadsto \color{blue}{-1 \cdot \frac{1}{-\sqrt{x} \cdot \left(1 + \left(x + \sqrt{\mathsf{fma}\left(x, x, x\right)}\right)\right)}} \]
    8. Step-by-step derivation
      1. associate-*r/69.6%

        \[\leadsto \color{blue}{\frac{-1 \cdot 1}{-\sqrt{x} \cdot \left(1 + \left(x + \sqrt{\mathsf{fma}\left(x, x, x\right)}\right)\right)}} \]
      2. metadata-eval69.6%

        \[\leadsto \frac{\color{blue}{-1}}{-\sqrt{x} \cdot \left(1 + \left(x + \sqrt{\mathsf{fma}\left(x, x, x\right)}\right)\right)} \]
      3. neg-mul-169.6%

        \[\leadsto \frac{-1}{\color{blue}{-1 \cdot \left(\sqrt{x} \cdot \left(1 + \left(x + \sqrt{\mathsf{fma}\left(x, x, x\right)}\right)\right)\right)}} \]
      4. associate-/r*69.6%

        \[\leadsto \color{blue}{\frac{\frac{-1}{-1}}{\sqrt{x} \cdot \left(1 + \left(x + \sqrt{\mathsf{fma}\left(x, x, x\right)}\right)\right)}} \]
      5. metadata-eval69.6%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{x} \cdot \left(1 + \left(x + \sqrt{\mathsf{fma}\left(x, x, x\right)}\right)\right)} \]
      6. associate-/r*69.6%

        \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x}}}{1 + \left(x + \sqrt{\mathsf{fma}\left(x, x, x\right)}\right)}} \]
      7. associate-+r+69.6%

        \[\leadsto \frac{\frac{1}{\sqrt{x}}}{\color{blue}{\left(1 + x\right) + \sqrt{\mathsf{fma}\left(x, x, x\right)}}} \]
      8. +-commutative69.6%

        \[\leadsto \frac{\frac{1}{\sqrt{x}}}{\color{blue}{\left(x + 1\right)} + \sqrt{\mathsf{fma}\left(x, x, x\right)}} \]
      9. associate-+r+69.6%

        \[\leadsto \frac{\frac{1}{\sqrt{x}}}{\color{blue}{x + \left(1 + \sqrt{\mathsf{fma}\left(x, x, x\right)}\right)}} \]
    9. Simplified69.6%

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x}}}{x + \left(1 + \sqrt{\mathsf{fma}\left(x, x, x\right)}\right)}} \]
    10. Taylor expanded in x around inf 99.8%

      \[\leadsto \frac{\frac{1}{\sqrt{x}}}{x + \left(1 + \color{blue}{x}\right)} \]
    11. Taylor expanded in x around inf 99.8%

      \[\leadsto \frac{\frac{1}{\sqrt{x}}}{\color{blue}{2 \cdot x}} \]
    12. Step-by-step derivation
      1. count-299.8%

        \[\leadsto \frac{\frac{1}{\sqrt{x}}}{\color{blue}{x + x}} \]
    13. Simplified99.8%

      \[\leadsto \frac{\frac{1}{\sqrt{x}}}{\color{blue}{x + x}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 10^{+81}:\\ \;\;\;\;\frac{{x}^{-0.5}}{1 + \left(x + \sqrt{\mathsf{fma}\left(x, x, x\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\sqrt{x}}}{x + x}\\ \end{array} \]

Alternative 2: 99.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \frac{{x}^{-0.5}}{\left(x + 1\right) + \sqrt{x + 1} \cdot \sqrt{x}} \end{array} \]
(FPCore (x)
 :precision binary64
 (/ (pow x -0.5) (+ (+ x 1.0) (* (sqrt (+ x 1.0)) (sqrt x)))))
double code(double x) {
	return pow(x, -0.5) / ((x + 1.0) + (sqrt((x + 1.0)) * sqrt(x)));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (x ** (-0.5d0)) / ((x + 1.0d0) + (sqrt((x + 1.0d0)) * sqrt(x)))
end function
public static double code(double x) {
	return Math.pow(x, -0.5) / ((x + 1.0) + (Math.sqrt((x + 1.0)) * Math.sqrt(x)));
}
def code(x):
	return math.pow(x, -0.5) / ((x + 1.0) + (math.sqrt((x + 1.0)) * math.sqrt(x)))
function code(x)
	return Float64((x ^ -0.5) / Float64(Float64(x + 1.0) + Float64(sqrt(Float64(x + 1.0)) * sqrt(x))))
end
function tmp = code(x)
	tmp = (x ^ -0.5) / ((x + 1.0) + (sqrt((x + 1.0)) * sqrt(x)));
end
code[x_] := N[(N[Power[x, -0.5], $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] + N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{{x}^{-0.5}}{\left(x + 1\right) + \sqrt{x + 1} \cdot \sqrt{x}}
\end{array}
Derivation
  1. Initial program 70.2%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Step-by-step derivation
    1. frac-sub70.3%

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. associate-/r*70.2%

      \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
    3. div-inv70.3%

      \[\leadsto \frac{\color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x}}}}{\sqrt{x + 1}} \]
    4. associate-*r/70.3%

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
    5. flip--70.6%

      \[\leadsto \color{blue}{\frac{\left(1 \cdot \sqrt{x + 1}\right) \cdot \left(1 \cdot \sqrt{x + 1}\right) - \left(\sqrt{x} \cdot 1\right) \cdot \left(\sqrt{x} \cdot 1\right)}{1 \cdot \sqrt{x + 1} + \sqrt{x} \cdot 1}} \cdot \frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}} \]
    6. frac-times70.6%

      \[\leadsto \color{blue}{\frac{\left(\left(1 \cdot \sqrt{x + 1}\right) \cdot \left(1 \cdot \sqrt{x + 1}\right) - \left(\sqrt{x} \cdot 1\right) \cdot \left(\sqrt{x} \cdot 1\right)\right) \cdot \frac{1}{\sqrt{x}}}{\left(1 \cdot \sqrt{x + 1} + \sqrt{x} \cdot 1\right) \cdot \sqrt{x + 1}}} \]
  3. Applied egg-rr72.0%

    \[\leadsto \color{blue}{\frac{\left(\left(1 + x\right) - x\right) \cdot {x}^{-0.5}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}} \]
  4. Step-by-step derivation
    1. associate-/l*71.9%

      \[\leadsto \color{blue}{\frac{\left(1 + x\right) - x}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}}} \]
    2. associate--l+98.5%

      \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
    3. +-inverses98.5%

      \[\leadsto \frac{1 + \color{blue}{0}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
    4. metadata-eval98.5%

      \[\leadsto \frac{\color{blue}{1}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
    5. associate-/l*99.7%

      \[\leadsto \color{blue}{\frac{1 \cdot {x}^{-0.5}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}} \]
    6. *-lft-identity99.7%

      \[\leadsto \frac{\color{blue}{{x}^{-0.5}}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}} \]
    7. *-commutative99.7%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)}} \]
    8. +-commutative99.7%

      \[\leadsto \frac{{x}^{-0.5}}{\sqrt{1 + x} \cdot \color{blue}{\left(\sqrt{1 + x} + \sqrt{x}\right)}} \]
    9. distribute-lft-in99.7%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot \sqrt{1 + x} + \sqrt{1 + x} \cdot \sqrt{x}}} \]
    10. rem-square-sqrt99.8%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(1 + x\right)} + \sqrt{1 + x} \cdot \sqrt{x}} \]
  5. Simplified99.8%

    \[\leadsto \color{blue}{\frac{{x}^{-0.5}}{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}}} \]
  6. Final simplification99.8%

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

Alternative 3: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 650:\\ \;\;\;\;{x}^{-0.5} - {\left(x + 1\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{-0.5}}{\frac{-0.125 + \frac{0.0625}{x}}{x} + \left(1.5 - x \cdot -2\right)}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 650.0)
   (- (pow x -0.5) (pow (+ x 1.0) -0.5))
   (/ (pow x -0.5) (+ (/ (+ -0.125 (/ 0.0625 x)) x) (- 1.5 (* x -2.0))))))
double code(double x) {
	double tmp;
	if (x <= 650.0) {
		tmp = pow(x, -0.5) - pow((x + 1.0), -0.5);
	} else {
		tmp = pow(x, -0.5) / (((-0.125 + (0.0625 / x)) / x) + (1.5 - (x * -2.0)));
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 650.0d0) then
        tmp = (x ** (-0.5d0)) - ((x + 1.0d0) ** (-0.5d0))
    else
        tmp = (x ** (-0.5d0)) / ((((-0.125d0) + (0.0625d0 / x)) / x) + (1.5d0 - (x * (-2.0d0))))
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 650.0) {
		tmp = Math.pow(x, -0.5) - Math.pow((x + 1.0), -0.5);
	} else {
		tmp = Math.pow(x, -0.5) / (((-0.125 + (0.0625 / x)) / x) + (1.5 - (x * -2.0)));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 650.0:
		tmp = math.pow(x, -0.5) - math.pow((x + 1.0), -0.5)
	else:
		tmp = math.pow(x, -0.5) / (((-0.125 + (0.0625 / x)) / x) + (1.5 - (x * -2.0)))
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 650.0)
		tmp = Float64((x ^ -0.5) - (Float64(x + 1.0) ^ -0.5));
	else
		tmp = Float64((x ^ -0.5) / Float64(Float64(Float64(-0.125 + Float64(0.0625 / x)) / x) + Float64(1.5 - Float64(x * -2.0))));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 650.0)
		tmp = (x ^ -0.5) - ((x + 1.0) ^ -0.5);
	else
		tmp = (x ^ -0.5) / (((-0.125 + (0.0625 / x)) / x) + (1.5 - (x * -2.0)));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 650.0], N[(N[Power[x, -0.5], $MachinePrecision] - N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] / N[(N[(N[(-0.125 + N[(0.0625 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(1.5 - N[(x * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 650:\\
\;\;\;\;{x}^{-0.5} - {\left(x + 1\right)}^{-0.5}\\

\mathbf{else}:\\
\;\;\;\;\frac{{x}^{-0.5}}{\frac{-0.125 + \frac{0.0625}{x}}{x} + \left(1.5 - x \cdot -2\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 650

    1. Initial program 99.6%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. sub-neg99.6%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} + \left(-\frac{1}{\sqrt{x + 1}}\right)} \]
      2. pow1/299.6%

        \[\leadsto \frac{1}{\color{blue}{{x}^{0.5}}} + \left(-\frac{1}{\sqrt{x + 1}}\right) \]
      3. pow-flip100.0%

        \[\leadsto \color{blue}{{x}^{\left(-0.5\right)}} + \left(-\frac{1}{\sqrt{x + 1}}\right) \]
      4. metadata-eval100.0%

        \[\leadsto {x}^{\color{blue}{-0.5}} + \left(-\frac{1}{\sqrt{x + 1}}\right) \]
      5. distribute-neg-frac100.0%

        \[\leadsto {x}^{-0.5} + \color{blue}{\frac{-1}{\sqrt{x + 1}}} \]
      6. metadata-eval100.0%

        \[\leadsto {x}^{-0.5} + \frac{\color{blue}{-1}}{\sqrt{x + 1}} \]
      7. +-commutative100.0%

        \[\leadsto {x}^{-0.5} + \frac{-1}{\sqrt{\color{blue}{1 + x}}} \]
    3. Applied egg-rr100.0%

      \[\leadsto \color{blue}{{x}^{-0.5} + \frac{-1}{\sqrt{1 + x}}} \]
    4. Step-by-step derivation
      1. remove-double-neg100.0%

        \[\leadsto {x}^{-0.5} + \color{blue}{\left(-\left(-\frac{-1}{\sqrt{1 + x}}\right)\right)} \]
      2. distribute-neg-frac100.0%

        \[\leadsto {x}^{-0.5} + \left(-\color{blue}{\frac{--1}{\sqrt{1 + x}}}\right) \]
      3. metadata-eval100.0%

        \[\leadsto {x}^{-0.5} + \left(-\frac{\color{blue}{1}}{\sqrt{1 + x}}\right) \]
      4. +-commutative100.0%

        \[\leadsto {x}^{-0.5} + \left(-\frac{1}{\sqrt{\color{blue}{x + 1}}}\right) \]
      5. rem-exp-log100.0%

        \[\leadsto {x}^{-0.5} + \left(-\color{blue}{e^{\log \left(\frac{1}{\sqrt{x + 1}}\right)}}\right) \]
      6. +-commutative100.0%

        \[\leadsto {x}^{-0.5} + \left(-e^{\log \left(\frac{1}{\sqrt{\color{blue}{1 + x}}}\right)}\right) \]
      7. unpow-1100.0%

        \[\leadsto {x}^{-0.5} + \left(-e^{\log \color{blue}{\left({\left(\sqrt{1 + x}\right)}^{-1}\right)}}\right) \]
      8. log-pow100.0%

        \[\leadsto {x}^{-0.5} + \left(-e^{\color{blue}{-1 \cdot \log \left(\sqrt{1 + x}\right)}}\right) \]
      9. unpow1/2100.0%

        \[\leadsto {x}^{-0.5} + \left(-e^{-1 \cdot \log \color{blue}{\left({\left(1 + x\right)}^{0.5}\right)}}\right) \]
      10. log-pow100.0%

        \[\leadsto {x}^{-0.5} + \left(-e^{-1 \cdot \color{blue}{\left(0.5 \cdot \log \left(1 + x\right)\right)}}\right) \]
      11. log1p-def100.0%

        \[\leadsto {x}^{-0.5} + \left(-e^{-1 \cdot \left(0.5 \cdot \color{blue}{\mathsf{log1p}\left(x\right)}\right)}\right) \]
      12. *-commutative100.0%

        \[\leadsto {x}^{-0.5} + \left(-e^{\color{blue}{\left(0.5 \cdot \mathsf{log1p}\left(x\right)\right) \cdot -1}}\right) \]
      13. *-commutative100.0%

        \[\leadsto {x}^{-0.5} + \left(-e^{\color{blue}{\left(\mathsf{log1p}\left(x\right) \cdot 0.5\right)} \cdot -1}\right) \]
      14. associate-*l*100.0%

        \[\leadsto {x}^{-0.5} + \left(-e^{\color{blue}{\mathsf{log1p}\left(x\right) \cdot \left(0.5 \cdot -1\right)}}\right) \]
      15. metadata-eval100.0%

        \[\leadsto {x}^{-0.5} + \left(-e^{\mathsf{log1p}\left(x\right) \cdot \color{blue}{-0.5}}\right) \]
      16. exp-prod100.0%

        \[\leadsto {x}^{-0.5} + \left(-\color{blue}{{\left(e^{\mathsf{log1p}\left(x\right)}\right)}^{-0.5}}\right) \]
    5. Simplified100.0%

      \[\leadsto \color{blue}{{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}} \]

    if 650 < x

    1. Initial program 40.5%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. frac-sub40.5%

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      2. associate-/r*40.5%

        \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
      3. div-inv40.5%

        \[\leadsto \frac{\color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x}}}}{\sqrt{x + 1}} \]
      4. associate-*r/40.5%

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
      5. flip--41.3%

        \[\leadsto \color{blue}{\frac{\left(1 \cdot \sqrt{x + 1}\right) \cdot \left(1 \cdot \sqrt{x + 1}\right) - \left(\sqrt{x} \cdot 1\right) \cdot \left(\sqrt{x} \cdot 1\right)}{1 \cdot \sqrt{x + 1} + \sqrt{x} \cdot 1}} \cdot \frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}} \]
      6. frac-times41.3%

        \[\leadsto \color{blue}{\frac{\left(\left(1 \cdot \sqrt{x + 1}\right) \cdot \left(1 \cdot \sqrt{x + 1}\right) - \left(\sqrt{x} \cdot 1\right) \cdot \left(\sqrt{x} \cdot 1\right)\right) \cdot \frac{1}{\sqrt{x}}}{\left(1 \cdot \sqrt{x + 1} + \sqrt{x} \cdot 1\right) \cdot \sqrt{x + 1}}} \]
    3. Applied egg-rr43.6%

      \[\leadsto \color{blue}{\frac{\left(\left(1 + x\right) - x\right) \cdot {x}^{-0.5}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}} \]
    4. Step-by-step derivation
      1. associate-/l*43.6%

        \[\leadsto \color{blue}{\frac{\left(1 + x\right) - x}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}}} \]
      2. associate--l+97.3%

        \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      3. +-inverses97.3%

        \[\leadsto \frac{1 + \color{blue}{0}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      4. metadata-eval97.3%

        \[\leadsto \frac{\color{blue}{1}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      5. associate-/l*99.5%

        \[\leadsto \color{blue}{\frac{1 \cdot {x}^{-0.5}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}} \]
      6. *-lft-identity99.5%

        \[\leadsto \frac{\color{blue}{{x}^{-0.5}}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}} \]
      7. *-commutative99.5%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)}} \]
      8. +-commutative99.5%

        \[\leadsto \frac{{x}^{-0.5}}{\sqrt{1 + x} \cdot \color{blue}{\left(\sqrt{1 + x} + \sqrt{x}\right)}} \]
      9. distribute-lft-in99.5%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot \sqrt{1 + x} + \sqrt{1 + x} \cdot \sqrt{x}}} \]
      10. rem-square-sqrt99.6%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(1 + x\right)} + \sqrt{1 + x} \cdot \sqrt{x}} \]
    5. Simplified99.6%

      \[\leadsto \color{blue}{\frac{{x}^{-0.5}}{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}}} \]
    6. Taylor expanded in x around -inf 0.0%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{1.5 + \left(-1 \cdot \left(x \cdot \left({\left(\sqrt{-1}\right)}^{2} - 1\right)\right) + \left(0.0625 \cdot \frac{1}{{x}^{2} \cdot {\left(\sqrt{-1}\right)}^{4}} + 0.125 \cdot \frac{1}{x \cdot {\left(\sqrt{-1}\right)}^{2}}\right)\right)}} \]
    7. Step-by-step derivation
      1. associate-+r+0.0%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(1.5 + -1 \cdot \left(x \cdot \left({\left(\sqrt{-1}\right)}^{2} - 1\right)\right)\right) + \left(0.0625 \cdot \frac{1}{{x}^{2} \cdot {\left(\sqrt{-1}\right)}^{4}} + 0.125 \cdot \frac{1}{x \cdot {\left(\sqrt{-1}\right)}^{2}}\right)}} \]
      2. +-commutative0.0%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(0.0625 \cdot \frac{1}{{x}^{2} \cdot {\left(\sqrt{-1}\right)}^{4}} + 0.125 \cdot \frac{1}{x \cdot {\left(\sqrt{-1}\right)}^{2}}\right) + \left(1.5 + -1 \cdot \left(x \cdot \left({\left(\sqrt{-1}\right)}^{2} - 1\right)\right)\right)}} \]
    8. Simplified99.8%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right) + \left(1.5 - x \cdot -2\right)}} \]
    9. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(1.5 - x \cdot -2\right) + \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)}} \]
      2. associate-+l-99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{1.5 - \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}} \]
      3. flip--77.4%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\frac{1.5 \cdot 1.5 - \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right) \cdot \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}{1.5 + \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}}} \]
      4. metadata-eval77.4%

        \[\leadsto \frac{{x}^{-0.5}}{\frac{\color{blue}{2.25} - \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right) \cdot \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}{1.5 + \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}} \]
    10. Applied egg-rr77.4%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\frac{2.25 - \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right) \cdot \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}{1.5 + \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}}} \]
    11. Step-by-step derivation
      1. associate--r+77.4%

        \[\leadsto \frac{{x}^{-0.5}}{\frac{2.25 - \color{blue}{\left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{\frac{0.0625}{x}}{x}\right)} \cdot \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}{1.5 + \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}} \]
      2. associate-/l/77.4%

        \[\leadsto \frac{{x}^{-0.5}}{\frac{2.25 - \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \color{blue}{\frac{0.0625}{x \cdot x}}\right) \cdot \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}{1.5 + \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}} \]
      3. associate--r+77.4%

        \[\leadsto \frac{{x}^{-0.5}}{\frac{2.25 - \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right) \cdot \color{blue}{\left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{\frac{0.0625}{x}}{x}\right)}}{1.5 + \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}} \]
      4. associate-/l/77.4%

        \[\leadsto \frac{{x}^{-0.5}}{\frac{2.25 - \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right) \cdot \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \color{blue}{\frac{0.0625}{x \cdot x}}\right)}{1.5 + \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}} \]
      5. associate--r+77.4%

        \[\leadsto \frac{{x}^{-0.5}}{\frac{2.25 - \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right) \cdot \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right)}{1.5 + \color{blue}{\left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{\frac{0.0625}{x}}{x}\right)}}} \]
      6. associate-/l/77.4%

        \[\leadsto \frac{{x}^{-0.5}}{\frac{2.25 - \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right) \cdot \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right)}{1.5 + \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \color{blue}{\frac{0.0625}{x \cdot x}}\right)}} \]
    12. Simplified77.4%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\frac{2.25 - \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right) \cdot \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right)}{1.5 + \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right)}}} \]
    13. Step-by-step derivation
      1. metadata-eval77.4%

        \[\leadsto \frac{{x}^{-0.5}}{\frac{\color{blue}{1.5 \cdot 1.5} - \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right) \cdot \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right)}{1.5 + \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right)}} \]
      2. flip--99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{1.5 - \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right)}} \]
      3. associate--l-99.8%

        \[\leadsto \frac{{x}^{-0.5}}{1.5 - \color{blue}{\left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{0.0625}{x \cdot x}\right)\right)}} \]
      4. associate--r-99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(1.5 - x \cdot -2\right) + \left(\frac{-0.125}{x} + \frac{0.0625}{x \cdot x}\right)}} \]
      5. associate-/r*99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\left(1.5 - x \cdot -2\right) + \left(\frac{-0.125}{x} + \color{blue}{\frac{\frac{0.0625}{x}}{x}}\right)} \]
      6. div-inv99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\left(1.5 - x \cdot -2\right) + \left(\color{blue}{-0.125 \cdot \frac{1}{x}} + \frac{\frac{0.0625}{x}}{x}\right)} \]
      7. div-inv99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\left(1.5 - x \cdot -2\right) + \left(-0.125 \cdot \frac{1}{x} + \color{blue}{\frac{0.0625}{x} \cdot \frac{1}{x}}\right)} \]
      8. distribute-rgt-in99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\left(1.5 - x \cdot -2\right) + \color{blue}{\frac{1}{x} \cdot \left(-0.125 + \frac{0.0625}{x}\right)}} \]
      9. +-commutative99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\frac{1}{x} \cdot \left(-0.125 + \frac{0.0625}{x}\right) + \left(1.5 - x \cdot -2\right)}} \]
      10. associate-*l/99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\frac{1 \cdot \left(-0.125 + \frac{0.0625}{x}\right)}{x}} + \left(1.5 - x \cdot -2\right)} \]
      11. *-lft-identity99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\frac{\color{blue}{-0.125 + \frac{0.0625}{x}}}{x} + \left(1.5 - x \cdot -2\right)} \]
    14. Applied egg-rr99.8%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\frac{-0.125 + \frac{0.0625}{x}}{x} + \left(1.5 - x \cdot -2\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 650:\\ \;\;\;\;{x}^{-0.5} - {\left(x + 1\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{-0.5}}{\frac{-0.125 + \frac{0.0625}{x}}{x} + \left(1.5 - x \cdot -2\right)}\\ \end{array} \]

Alternative 4: 99.3% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.44:\\ \;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{-0.5}}{\frac{-0.125 + \frac{0.0625}{x}}{x} + \left(1.5 - x \cdot -2\right)}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 0.44)
   (+ (+ (pow x -0.5) (* x 0.5)) -1.0)
   (/ (pow x -0.5) (+ (/ (+ -0.125 (/ 0.0625 x)) x) (- 1.5 (* x -2.0))))))
double code(double x) {
	double tmp;
	if (x <= 0.44) {
		tmp = (pow(x, -0.5) + (x * 0.5)) + -1.0;
	} else {
		tmp = pow(x, -0.5) / (((-0.125 + (0.0625 / x)) / x) + (1.5 - (x * -2.0)));
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 0.44d0) then
        tmp = ((x ** (-0.5d0)) + (x * 0.5d0)) + (-1.0d0)
    else
        tmp = (x ** (-0.5d0)) / ((((-0.125d0) + (0.0625d0 / x)) / x) + (1.5d0 - (x * (-2.0d0))))
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 0.44) {
		tmp = (Math.pow(x, -0.5) + (x * 0.5)) + -1.0;
	} else {
		tmp = Math.pow(x, -0.5) / (((-0.125 + (0.0625 / x)) / x) + (1.5 - (x * -2.0)));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 0.44:
		tmp = (math.pow(x, -0.5) + (x * 0.5)) + -1.0
	else:
		tmp = math.pow(x, -0.5) / (((-0.125 + (0.0625 / x)) / x) + (1.5 - (x * -2.0)))
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 0.44)
		tmp = Float64(Float64((x ^ -0.5) + Float64(x * 0.5)) + -1.0);
	else
		tmp = Float64((x ^ -0.5) / Float64(Float64(Float64(-0.125 + Float64(0.0625 / x)) / x) + Float64(1.5 - Float64(x * -2.0))));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 0.44)
		tmp = ((x ^ -0.5) + (x * 0.5)) + -1.0;
	else
		tmp = (x ^ -0.5) / (((-0.125 + (0.0625 / x)) / x) + (1.5 - (x * -2.0)));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 0.44], N[(N[(N[Power[x, -0.5], $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] / N[(N[(N[(-0.125 + N[(0.0625 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(1.5 - N[(x * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.44:\\
\;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\

\mathbf{else}:\\
\;\;\;\;\frac{{x}^{-0.5}}{\frac{-0.125 + \frac{0.0625}{x}}{x} + \left(1.5 - x \cdot -2\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 0.440000000000000002

    1. Initial program 99.6%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. inv-pow99.6%

        \[\leadsto \color{blue}{{\left(\sqrt{x}\right)}^{-1}} - \frac{1}{\sqrt{x + 1}} \]
      2. metadata-eval99.6%

        \[\leadsto {\left(\sqrt{x}\right)}^{\color{blue}{\left(-1\right)}} - \frac{1}{\sqrt{x + 1}} \]
      3. sqr-pow99.2%

        \[\leadsto \color{blue}{{\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)}} - \frac{1}{\sqrt{x + 1}} \]
      4. pow299.2%

        \[\leadsto \color{blue}{{\left({\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)}\right)}^{2}} - \frac{1}{\sqrt{x + 1}} \]
      5. sqrt-pow299.2%

        \[\leadsto {\color{blue}{\left({x}^{\left(\frac{\frac{-1}{2}}{2}\right)}\right)}}^{2} - \frac{1}{\sqrt{x + 1}} \]
      6. metadata-eval99.2%

        \[\leadsto {\left({x}^{\left(\frac{\frac{\color{blue}{-1}}{2}}{2}\right)}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
      7. metadata-eval99.2%

        \[\leadsto {\left({x}^{\left(\frac{\color{blue}{-0.5}}{2}\right)}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
      8. metadata-eval99.2%

        \[\leadsto {\left({x}^{\color{blue}{-0.25}}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
    3. Applied egg-rr99.2%

      \[\leadsto \color{blue}{{\left({x}^{-0.25}\right)}^{2}} - \frac{1}{\sqrt{x + 1}} \]
    4. Taylor expanded in x around 0 97.3%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{x}} + 0.5 \cdot x\right) - 1} \]
    5. Step-by-step derivation
      1. *-lft-identity97.3%

        \[\leadsto \left(\color{blue}{1 \cdot \sqrt{\frac{1}{x}}} + 0.5 \cdot x\right) - 1 \]
      2. fma-def97.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(1, \sqrt{\frac{1}{x}}, 0.5 \cdot x\right)} - 1 \]
      3. inv-pow97.3%

        \[\leadsto \mathsf{fma}\left(1, \sqrt{\color{blue}{{x}^{-1}}}, 0.5 \cdot x\right) - 1 \]
      4. metadata-eval97.3%

        \[\leadsto \mathsf{fma}\left(1, \sqrt{{x}^{\color{blue}{\left(-1\right)}}}, 0.5 \cdot x\right) - 1 \]
      5. sqrt-pow198.2%

        \[\leadsto \mathsf{fma}\left(1, \color{blue}{{x}^{\left(\frac{-1}{2}\right)}}, 0.5 \cdot x\right) - 1 \]
      6. metadata-eval98.2%

        \[\leadsto \mathsf{fma}\left(1, {x}^{\left(\frac{\color{blue}{-1}}{2}\right)}, 0.5 \cdot x\right) - 1 \]
      7. metadata-eval98.2%

        \[\leadsto \mathsf{fma}\left(1, {x}^{\color{blue}{-0.5}}, 0.5 \cdot x\right) - 1 \]
      8. *-commutative98.2%

        \[\leadsto \mathsf{fma}\left(1, {x}^{-0.5}, \color{blue}{x \cdot 0.5}\right) - 1 \]
    6. Applied egg-rr98.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(1, {x}^{-0.5}, x \cdot 0.5\right)} - 1 \]
    7. Step-by-step derivation
      1. fma-udef98.2%

        \[\leadsto \color{blue}{\left(1 \cdot {x}^{-0.5} + x \cdot 0.5\right)} - 1 \]
      2. *-lft-identity98.2%

        \[\leadsto \left(\color{blue}{{x}^{-0.5}} + x \cdot 0.5\right) - 1 \]
    8. Simplified98.2%

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

    if 0.440000000000000002 < x

    1. Initial program 40.5%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. frac-sub40.5%

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      2. associate-/r*40.5%

        \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
      3. div-inv40.5%

        \[\leadsto \frac{\color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x}}}}{\sqrt{x + 1}} \]
      4. associate-*r/40.5%

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
      5. flip--41.3%

        \[\leadsto \color{blue}{\frac{\left(1 \cdot \sqrt{x + 1}\right) \cdot \left(1 \cdot \sqrt{x + 1}\right) - \left(\sqrt{x} \cdot 1\right) \cdot \left(\sqrt{x} \cdot 1\right)}{1 \cdot \sqrt{x + 1} + \sqrt{x} \cdot 1}} \cdot \frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}} \]
      6. frac-times41.3%

        \[\leadsto \color{blue}{\frac{\left(\left(1 \cdot \sqrt{x + 1}\right) \cdot \left(1 \cdot \sqrt{x + 1}\right) - \left(\sqrt{x} \cdot 1\right) \cdot \left(\sqrt{x} \cdot 1\right)\right) \cdot \frac{1}{\sqrt{x}}}{\left(1 \cdot \sqrt{x + 1} + \sqrt{x} \cdot 1\right) \cdot \sqrt{x + 1}}} \]
    3. Applied egg-rr43.6%

      \[\leadsto \color{blue}{\frac{\left(\left(1 + x\right) - x\right) \cdot {x}^{-0.5}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}} \]
    4. Step-by-step derivation
      1. associate-/l*43.6%

        \[\leadsto \color{blue}{\frac{\left(1 + x\right) - x}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}}} \]
      2. associate--l+97.3%

        \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      3. +-inverses97.3%

        \[\leadsto \frac{1 + \color{blue}{0}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      4. metadata-eval97.3%

        \[\leadsto \frac{\color{blue}{1}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      5. associate-/l*99.5%

        \[\leadsto \color{blue}{\frac{1 \cdot {x}^{-0.5}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}} \]
      6. *-lft-identity99.5%

        \[\leadsto \frac{\color{blue}{{x}^{-0.5}}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}} \]
      7. *-commutative99.5%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)}} \]
      8. +-commutative99.5%

        \[\leadsto \frac{{x}^{-0.5}}{\sqrt{1 + x} \cdot \color{blue}{\left(\sqrt{1 + x} + \sqrt{x}\right)}} \]
      9. distribute-lft-in99.5%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot \sqrt{1 + x} + \sqrt{1 + x} \cdot \sqrt{x}}} \]
      10. rem-square-sqrt99.6%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(1 + x\right)} + \sqrt{1 + x} \cdot \sqrt{x}} \]
    5. Simplified99.6%

      \[\leadsto \color{blue}{\frac{{x}^{-0.5}}{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}}} \]
    6. Taylor expanded in x around -inf 0.0%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{1.5 + \left(-1 \cdot \left(x \cdot \left({\left(\sqrt{-1}\right)}^{2} - 1\right)\right) + \left(0.0625 \cdot \frac{1}{{x}^{2} \cdot {\left(\sqrt{-1}\right)}^{4}} + 0.125 \cdot \frac{1}{x \cdot {\left(\sqrt{-1}\right)}^{2}}\right)\right)}} \]
    7. Step-by-step derivation
      1. associate-+r+0.0%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(1.5 + -1 \cdot \left(x \cdot \left({\left(\sqrt{-1}\right)}^{2} - 1\right)\right)\right) + \left(0.0625 \cdot \frac{1}{{x}^{2} \cdot {\left(\sqrt{-1}\right)}^{4}} + 0.125 \cdot \frac{1}{x \cdot {\left(\sqrt{-1}\right)}^{2}}\right)}} \]
      2. +-commutative0.0%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(0.0625 \cdot \frac{1}{{x}^{2} \cdot {\left(\sqrt{-1}\right)}^{4}} + 0.125 \cdot \frac{1}{x \cdot {\left(\sqrt{-1}\right)}^{2}}\right) + \left(1.5 + -1 \cdot \left(x \cdot \left({\left(\sqrt{-1}\right)}^{2} - 1\right)\right)\right)}} \]
    8. Simplified99.8%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right) + \left(1.5 - x \cdot -2\right)}} \]
    9. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(1.5 - x \cdot -2\right) + \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)}} \]
      2. associate-+l-99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{1.5 - \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}} \]
      3. flip--77.4%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\frac{1.5 \cdot 1.5 - \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right) \cdot \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}{1.5 + \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}}} \]
      4. metadata-eval77.4%

        \[\leadsto \frac{{x}^{-0.5}}{\frac{\color{blue}{2.25} - \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right) \cdot \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}{1.5 + \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}} \]
    10. Applied egg-rr77.4%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\frac{2.25 - \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right) \cdot \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}{1.5 + \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}}} \]
    11. Step-by-step derivation
      1. associate--r+77.4%

        \[\leadsto \frac{{x}^{-0.5}}{\frac{2.25 - \color{blue}{\left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{\frac{0.0625}{x}}{x}\right)} \cdot \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}{1.5 + \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}} \]
      2. associate-/l/77.4%

        \[\leadsto \frac{{x}^{-0.5}}{\frac{2.25 - \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \color{blue}{\frac{0.0625}{x \cdot x}}\right) \cdot \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}{1.5 + \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}} \]
      3. associate--r+77.4%

        \[\leadsto \frac{{x}^{-0.5}}{\frac{2.25 - \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right) \cdot \color{blue}{\left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{\frac{0.0625}{x}}{x}\right)}}{1.5 + \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}} \]
      4. associate-/l/77.4%

        \[\leadsto \frac{{x}^{-0.5}}{\frac{2.25 - \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right) \cdot \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \color{blue}{\frac{0.0625}{x \cdot x}}\right)}{1.5 + \left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{\frac{0.0625}{x}}{x}\right)\right)}} \]
      5. associate--r+77.4%

        \[\leadsto \frac{{x}^{-0.5}}{\frac{2.25 - \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right) \cdot \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right)}{1.5 + \color{blue}{\left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{\frac{0.0625}{x}}{x}\right)}}} \]
      6. associate-/l/77.4%

        \[\leadsto \frac{{x}^{-0.5}}{\frac{2.25 - \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right) \cdot \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right)}{1.5 + \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \color{blue}{\frac{0.0625}{x \cdot x}}\right)}} \]
    12. Simplified77.4%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\frac{2.25 - \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right) \cdot \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right)}{1.5 + \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right)}}} \]
    13. Step-by-step derivation
      1. metadata-eval77.4%

        \[\leadsto \frac{{x}^{-0.5}}{\frac{\color{blue}{1.5 \cdot 1.5} - \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right) \cdot \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right)}{1.5 + \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right)}} \]
      2. flip--99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{1.5 - \left(\left(x \cdot -2 - \frac{-0.125}{x}\right) - \frac{0.0625}{x \cdot x}\right)}} \]
      3. associate--l-99.8%

        \[\leadsto \frac{{x}^{-0.5}}{1.5 - \color{blue}{\left(x \cdot -2 - \left(\frac{-0.125}{x} + \frac{0.0625}{x \cdot x}\right)\right)}} \]
      4. associate--r-99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(1.5 - x \cdot -2\right) + \left(\frac{-0.125}{x} + \frac{0.0625}{x \cdot x}\right)}} \]
      5. associate-/r*99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\left(1.5 - x \cdot -2\right) + \left(\frac{-0.125}{x} + \color{blue}{\frac{\frac{0.0625}{x}}{x}}\right)} \]
      6. div-inv99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\left(1.5 - x \cdot -2\right) + \left(\color{blue}{-0.125 \cdot \frac{1}{x}} + \frac{\frac{0.0625}{x}}{x}\right)} \]
      7. div-inv99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\left(1.5 - x \cdot -2\right) + \left(-0.125 \cdot \frac{1}{x} + \color{blue}{\frac{0.0625}{x} \cdot \frac{1}{x}}\right)} \]
      8. distribute-rgt-in99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\left(1.5 - x \cdot -2\right) + \color{blue}{\frac{1}{x} \cdot \left(-0.125 + \frac{0.0625}{x}\right)}} \]
      9. +-commutative99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\frac{1}{x} \cdot \left(-0.125 + \frac{0.0625}{x}\right) + \left(1.5 - x \cdot -2\right)}} \]
      10. associate-*l/99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\frac{1 \cdot \left(-0.125 + \frac{0.0625}{x}\right)}{x}} + \left(1.5 - x \cdot -2\right)} \]
      11. *-lft-identity99.8%

        \[\leadsto \frac{{x}^{-0.5}}{\frac{\color{blue}{-0.125 + \frac{0.0625}{x}}}{x} + \left(1.5 - x \cdot -2\right)} \]
    14. Applied egg-rr99.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.44:\\ \;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{-0.5}}{\frac{-0.125 + \frac{0.0625}{x}}{x} + \left(1.5 - x \cdot -2\right)}\\ \end{array} \]

Alternative 5: 99.2% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.42:\\ \;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{-0.5}}{\left(1.5 + x \cdot 2\right) - \frac{0.125}{x}}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 0.42)
   (+ (+ (pow x -0.5) (* x 0.5)) -1.0)
   (/ (pow x -0.5) (- (+ 1.5 (* x 2.0)) (/ 0.125 x)))))
double code(double x) {
	double tmp;
	if (x <= 0.42) {
		tmp = (pow(x, -0.5) + (x * 0.5)) + -1.0;
	} else {
		tmp = pow(x, -0.5) / ((1.5 + (x * 2.0)) - (0.125 / x));
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 0.42d0) then
        tmp = ((x ** (-0.5d0)) + (x * 0.5d0)) + (-1.0d0)
    else
        tmp = (x ** (-0.5d0)) / ((1.5d0 + (x * 2.0d0)) - (0.125d0 / x))
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 0.42) {
		tmp = (Math.pow(x, -0.5) + (x * 0.5)) + -1.0;
	} else {
		tmp = Math.pow(x, -0.5) / ((1.5 + (x * 2.0)) - (0.125 / x));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 0.42:
		tmp = (math.pow(x, -0.5) + (x * 0.5)) + -1.0
	else:
		tmp = math.pow(x, -0.5) / ((1.5 + (x * 2.0)) - (0.125 / x))
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 0.42)
		tmp = Float64(Float64((x ^ -0.5) + Float64(x * 0.5)) + -1.0);
	else
		tmp = Float64((x ^ -0.5) / Float64(Float64(1.5 + Float64(x * 2.0)) - Float64(0.125 / x)));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 0.42)
		tmp = ((x ^ -0.5) + (x * 0.5)) + -1.0;
	else
		tmp = (x ^ -0.5) / ((1.5 + (x * 2.0)) - (0.125 / x));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 0.42], N[(N[(N[Power[x, -0.5], $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] / N[(N[(1.5 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision] - N[(0.125 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.42:\\
\;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 0.419999999999999984

    1. Initial program 99.6%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. inv-pow99.6%

        \[\leadsto \color{blue}{{\left(\sqrt{x}\right)}^{-1}} - \frac{1}{\sqrt{x + 1}} \]
      2. metadata-eval99.6%

        \[\leadsto {\left(\sqrt{x}\right)}^{\color{blue}{\left(-1\right)}} - \frac{1}{\sqrt{x + 1}} \]
      3. sqr-pow99.2%

        \[\leadsto \color{blue}{{\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)}} - \frac{1}{\sqrt{x + 1}} \]
      4. pow299.2%

        \[\leadsto \color{blue}{{\left({\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)}\right)}^{2}} - \frac{1}{\sqrt{x + 1}} \]
      5. sqrt-pow299.2%

        \[\leadsto {\color{blue}{\left({x}^{\left(\frac{\frac{-1}{2}}{2}\right)}\right)}}^{2} - \frac{1}{\sqrt{x + 1}} \]
      6. metadata-eval99.2%

        \[\leadsto {\left({x}^{\left(\frac{\frac{\color{blue}{-1}}{2}}{2}\right)}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
      7. metadata-eval99.2%

        \[\leadsto {\left({x}^{\left(\frac{\color{blue}{-0.5}}{2}\right)}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
      8. metadata-eval99.2%

        \[\leadsto {\left({x}^{\color{blue}{-0.25}}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
    3. Applied egg-rr99.2%

      \[\leadsto \color{blue}{{\left({x}^{-0.25}\right)}^{2}} - \frac{1}{\sqrt{x + 1}} \]
    4. Taylor expanded in x around 0 97.3%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{x}} + 0.5 \cdot x\right) - 1} \]
    5. Step-by-step derivation
      1. *-lft-identity97.3%

        \[\leadsto \left(\color{blue}{1 \cdot \sqrt{\frac{1}{x}}} + 0.5 \cdot x\right) - 1 \]
      2. fma-def97.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(1, \sqrt{\frac{1}{x}}, 0.5 \cdot x\right)} - 1 \]
      3. inv-pow97.3%

        \[\leadsto \mathsf{fma}\left(1, \sqrt{\color{blue}{{x}^{-1}}}, 0.5 \cdot x\right) - 1 \]
      4. metadata-eval97.3%

        \[\leadsto \mathsf{fma}\left(1, \sqrt{{x}^{\color{blue}{\left(-1\right)}}}, 0.5 \cdot x\right) - 1 \]
      5. sqrt-pow198.2%

        \[\leadsto \mathsf{fma}\left(1, \color{blue}{{x}^{\left(\frac{-1}{2}\right)}}, 0.5 \cdot x\right) - 1 \]
      6. metadata-eval98.2%

        \[\leadsto \mathsf{fma}\left(1, {x}^{\left(\frac{\color{blue}{-1}}{2}\right)}, 0.5 \cdot x\right) - 1 \]
      7. metadata-eval98.2%

        \[\leadsto \mathsf{fma}\left(1, {x}^{\color{blue}{-0.5}}, 0.5 \cdot x\right) - 1 \]
      8. *-commutative98.2%

        \[\leadsto \mathsf{fma}\left(1, {x}^{-0.5}, \color{blue}{x \cdot 0.5}\right) - 1 \]
    6. Applied egg-rr98.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(1, {x}^{-0.5}, x \cdot 0.5\right)} - 1 \]
    7. Step-by-step derivation
      1. fma-udef98.2%

        \[\leadsto \color{blue}{\left(1 \cdot {x}^{-0.5} + x \cdot 0.5\right)} - 1 \]
      2. *-lft-identity98.2%

        \[\leadsto \left(\color{blue}{{x}^{-0.5}} + x \cdot 0.5\right) - 1 \]
    8. Simplified98.2%

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

    if 0.419999999999999984 < x

    1. Initial program 40.5%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. frac-sub40.5%

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      2. associate-/r*40.5%

        \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
      3. div-inv40.5%

        \[\leadsto \frac{\color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x}}}}{\sqrt{x + 1}} \]
      4. associate-*r/40.5%

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
      5. flip--41.3%

        \[\leadsto \color{blue}{\frac{\left(1 \cdot \sqrt{x + 1}\right) \cdot \left(1 \cdot \sqrt{x + 1}\right) - \left(\sqrt{x} \cdot 1\right) \cdot \left(\sqrt{x} \cdot 1\right)}{1 \cdot \sqrt{x + 1} + \sqrt{x} \cdot 1}} \cdot \frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}} \]
      6. frac-times41.3%

        \[\leadsto \color{blue}{\frac{\left(\left(1 \cdot \sqrt{x + 1}\right) \cdot \left(1 \cdot \sqrt{x + 1}\right) - \left(\sqrt{x} \cdot 1\right) \cdot \left(\sqrt{x} \cdot 1\right)\right) \cdot \frac{1}{\sqrt{x}}}{\left(1 \cdot \sqrt{x + 1} + \sqrt{x} \cdot 1\right) \cdot \sqrt{x + 1}}} \]
    3. Applied egg-rr43.6%

      \[\leadsto \color{blue}{\frac{\left(\left(1 + x\right) - x\right) \cdot {x}^{-0.5}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}} \]
    4. Step-by-step derivation
      1. associate-/l*43.6%

        \[\leadsto \color{blue}{\frac{\left(1 + x\right) - x}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}}} \]
      2. associate--l+97.3%

        \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      3. +-inverses97.3%

        \[\leadsto \frac{1 + \color{blue}{0}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      4. metadata-eval97.3%

        \[\leadsto \frac{\color{blue}{1}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      5. associate-/l*99.5%

        \[\leadsto \color{blue}{\frac{1 \cdot {x}^{-0.5}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}} \]
      6. *-lft-identity99.5%

        \[\leadsto \frac{\color{blue}{{x}^{-0.5}}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}} \]
      7. *-commutative99.5%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)}} \]
      8. +-commutative99.5%

        \[\leadsto \frac{{x}^{-0.5}}{\sqrt{1 + x} \cdot \color{blue}{\left(\sqrt{1 + x} + \sqrt{x}\right)}} \]
      9. distribute-lft-in99.5%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot \sqrt{1 + x} + \sqrt{1 + x} \cdot \sqrt{x}}} \]
      10. rem-square-sqrt99.6%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(1 + x\right)} + \sqrt{1 + x} \cdot \sqrt{x}} \]
    5. Simplified99.6%

      \[\leadsto \color{blue}{\frac{{x}^{-0.5}}{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}}} \]
    6. Taylor expanded in x around inf 99.6%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(1.5 + 2 \cdot x\right) - 0.125 \cdot \frac{1}{x}}} \]
    7. Step-by-step derivation
      1. +-commutative99.6%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(2 \cdot x + 1.5\right)} - 0.125 \cdot \frac{1}{x}} \]
      2. *-commutative99.6%

        \[\leadsto \frac{{x}^{-0.5}}{\left(\color{blue}{x \cdot 2} + 1.5\right) - 0.125 \cdot \frac{1}{x}} \]
      3. associate-*r/99.6%

        \[\leadsto \frac{{x}^{-0.5}}{\left(x \cdot 2 + 1.5\right) - \color{blue}{\frac{0.125 \cdot 1}{x}}} \]
      4. metadata-eval99.6%

        \[\leadsto \frac{{x}^{-0.5}}{\left(x \cdot 2 + 1.5\right) - \frac{\color{blue}{0.125}}{x}} \]
    8. Simplified99.6%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(x \cdot 2 + 1.5\right) - \frac{0.125}{x}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.42:\\ \;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{-0.5}}{\left(1.5 + x \cdot 2\right) - \frac{0.125}{x}}\\ \end{array} \]

Alternative 6: 98.5% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{-0.5}}{x \cdot 2}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 1.0)
   (+ (+ (pow x -0.5) (* x 0.5)) -1.0)
   (/ (pow x -0.5) (* x 2.0))))
double code(double x) {
	double tmp;
	if (x <= 1.0) {
		tmp = (pow(x, -0.5) + (x * 0.5)) + -1.0;
	} else {
		tmp = pow(x, -0.5) / (x * 2.0);
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 1.0d0) then
        tmp = ((x ** (-0.5d0)) + (x * 0.5d0)) + (-1.0d0)
    else
        tmp = (x ** (-0.5d0)) / (x * 2.0d0)
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 1.0) {
		tmp = (Math.pow(x, -0.5) + (x * 0.5)) + -1.0;
	} else {
		tmp = Math.pow(x, -0.5) / (x * 2.0);
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 1.0:
		tmp = (math.pow(x, -0.5) + (x * 0.5)) + -1.0
	else:
		tmp = math.pow(x, -0.5) / (x * 2.0)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 1.0)
		tmp = Float64(Float64((x ^ -0.5) + Float64(x * 0.5)) + -1.0);
	else
		tmp = Float64((x ^ -0.5) / Float64(x * 2.0));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 1.0)
		tmp = ((x ^ -0.5) + (x * 0.5)) + -1.0;
	else
		tmp = (x ^ -0.5) / (x * 2.0);
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 1.0], N[(N[(N[Power[x, -0.5], $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] / N[(x * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\

\mathbf{else}:\\
\;\;\;\;\frac{{x}^{-0.5}}{x \cdot 2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1

    1. Initial program 99.6%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. inv-pow99.6%

        \[\leadsto \color{blue}{{\left(\sqrt{x}\right)}^{-1}} - \frac{1}{\sqrt{x + 1}} \]
      2. metadata-eval99.6%

        \[\leadsto {\left(\sqrt{x}\right)}^{\color{blue}{\left(-1\right)}} - \frac{1}{\sqrt{x + 1}} \]
      3. sqr-pow99.2%

        \[\leadsto \color{blue}{{\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)}} - \frac{1}{\sqrt{x + 1}} \]
      4. pow299.2%

        \[\leadsto \color{blue}{{\left({\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)}\right)}^{2}} - \frac{1}{\sqrt{x + 1}} \]
      5. sqrt-pow299.2%

        \[\leadsto {\color{blue}{\left({x}^{\left(\frac{\frac{-1}{2}}{2}\right)}\right)}}^{2} - \frac{1}{\sqrt{x + 1}} \]
      6. metadata-eval99.2%

        \[\leadsto {\left({x}^{\left(\frac{\frac{\color{blue}{-1}}{2}}{2}\right)}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
      7. metadata-eval99.2%

        \[\leadsto {\left({x}^{\left(\frac{\color{blue}{-0.5}}{2}\right)}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
      8. metadata-eval99.2%

        \[\leadsto {\left({x}^{\color{blue}{-0.25}}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
    3. Applied egg-rr99.2%

      \[\leadsto \color{blue}{{\left({x}^{-0.25}\right)}^{2}} - \frac{1}{\sqrt{x + 1}} \]
    4. Taylor expanded in x around 0 97.3%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{x}} + 0.5 \cdot x\right) - 1} \]
    5. Step-by-step derivation
      1. *-lft-identity97.3%

        \[\leadsto \left(\color{blue}{1 \cdot \sqrt{\frac{1}{x}}} + 0.5 \cdot x\right) - 1 \]
      2. fma-def97.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(1, \sqrt{\frac{1}{x}}, 0.5 \cdot x\right)} - 1 \]
      3. inv-pow97.3%

        \[\leadsto \mathsf{fma}\left(1, \sqrt{\color{blue}{{x}^{-1}}}, 0.5 \cdot x\right) - 1 \]
      4. metadata-eval97.3%

        \[\leadsto \mathsf{fma}\left(1, \sqrt{{x}^{\color{blue}{\left(-1\right)}}}, 0.5 \cdot x\right) - 1 \]
      5. sqrt-pow198.2%

        \[\leadsto \mathsf{fma}\left(1, \color{blue}{{x}^{\left(\frac{-1}{2}\right)}}, 0.5 \cdot x\right) - 1 \]
      6. metadata-eval98.2%

        \[\leadsto \mathsf{fma}\left(1, {x}^{\left(\frac{\color{blue}{-1}}{2}\right)}, 0.5 \cdot x\right) - 1 \]
      7. metadata-eval98.2%

        \[\leadsto \mathsf{fma}\left(1, {x}^{\color{blue}{-0.5}}, 0.5 \cdot x\right) - 1 \]
      8. *-commutative98.2%

        \[\leadsto \mathsf{fma}\left(1, {x}^{-0.5}, \color{blue}{x \cdot 0.5}\right) - 1 \]
    6. Applied egg-rr98.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(1, {x}^{-0.5}, x \cdot 0.5\right)} - 1 \]
    7. Step-by-step derivation
      1. fma-udef98.2%

        \[\leadsto \color{blue}{\left(1 \cdot {x}^{-0.5} + x \cdot 0.5\right)} - 1 \]
      2. *-lft-identity98.2%

        \[\leadsto \left(\color{blue}{{x}^{-0.5}} + x \cdot 0.5\right) - 1 \]
    8. Simplified98.2%

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

    if 1 < x

    1. Initial program 40.5%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. frac-sub40.5%

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      2. associate-/r*40.5%

        \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
      3. div-inv40.5%

        \[\leadsto \frac{\color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x}}}}{\sqrt{x + 1}} \]
      4. associate-*r/40.5%

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
      5. flip--41.3%

        \[\leadsto \color{blue}{\frac{\left(1 \cdot \sqrt{x + 1}\right) \cdot \left(1 \cdot \sqrt{x + 1}\right) - \left(\sqrt{x} \cdot 1\right) \cdot \left(\sqrt{x} \cdot 1\right)}{1 \cdot \sqrt{x + 1} + \sqrt{x} \cdot 1}} \cdot \frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}} \]
      6. frac-times41.3%

        \[\leadsto \color{blue}{\frac{\left(\left(1 \cdot \sqrt{x + 1}\right) \cdot \left(1 \cdot \sqrt{x + 1}\right) - \left(\sqrt{x} \cdot 1\right) \cdot \left(\sqrt{x} \cdot 1\right)\right) \cdot \frac{1}{\sqrt{x}}}{\left(1 \cdot \sqrt{x + 1} + \sqrt{x} \cdot 1\right) \cdot \sqrt{x + 1}}} \]
    3. Applied egg-rr43.6%

      \[\leadsto \color{blue}{\frac{\left(\left(1 + x\right) - x\right) \cdot {x}^{-0.5}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}} \]
    4. Step-by-step derivation
      1. associate-/l*43.6%

        \[\leadsto \color{blue}{\frac{\left(1 + x\right) - x}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}}} \]
      2. associate--l+97.3%

        \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      3. +-inverses97.3%

        \[\leadsto \frac{1 + \color{blue}{0}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      4. metadata-eval97.3%

        \[\leadsto \frac{\color{blue}{1}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      5. associate-/l*99.5%

        \[\leadsto \color{blue}{\frac{1 \cdot {x}^{-0.5}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}} \]
      6. *-lft-identity99.5%

        \[\leadsto \frac{\color{blue}{{x}^{-0.5}}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}} \]
      7. *-commutative99.5%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)}} \]
      8. +-commutative99.5%

        \[\leadsto \frac{{x}^{-0.5}}{\sqrt{1 + x} \cdot \color{blue}{\left(\sqrt{1 + x} + \sqrt{x}\right)}} \]
      9. distribute-lft-in99.5%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot \sqrt{1 + x} + \sqrt{1 + x} \cdot \sqrt{x}}} \]
      10. rem-square-sqrt99.6%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(1 + x\right)} + \sqrt{1 + x} \cdot \sqrt{x}} \]
    5. Simplified99.6%

      \[\leadsto \color{blue}{\frac{{x}^{-0.5}}{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}}} \]
    6. Taylor expanded in x around inf 97.3%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{2 \cdot x}} \]
    7. Step-by-step derivation
      1. *-commutative97.3%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{x \cdot 2}} \]
    8. Simplified97.3%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{x \cdot 2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{-0.5}}{x \cdot 2}\\ \end{array} \]

Alternative 7: 99.1% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.41:\\ \;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{-0.5}}{1.5 - x \cdot -2}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 0.41)
   (+ (+ (pow x -0.5) (* x 0.5)) -1.0)
   (/ (pow x -0.5) (- 1.5 (* x -2.0)))))
double code(double x) {
	double tmp;
	if (x <= 0.41) {
		tmp = (pow(x, -0.5) + (x * 0.5)) + -1.0;
	} else {
		tmp = pow(x, -0.5) / (1.5 - (x * -2.0));
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 0.41d0) then
        tmp = ((x ** (-0.5d0)) + (x * 0.5d0)) + (-1.0d0)
    else
        tmp = (x ** (-0.5d0)) / (1.5d0 - (x * (-2.0d0)))
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 0.41) {
		tmp = (Math.pow(x, -0.5) + (x * 0.5)) + -1.0;
	} else {
		tmp = Math.pow(x, -0.5) / (1.5 - (x * -2.0));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 0.41:
		tmp = (math.pow(x, -0.5) + (x * 0.5)) + -1.0
	else:
		tmp = math.pow(x, -0.5) / (1.5 - (x * -2.0))
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 0.41)
		tmp = Float64(Float64((x ^ -0.5) + Float64(x * 0.5)) + -1.0);
	else
		tmp = Float64((x ^ -0.5) / Float64(1.5 - Float64(x * -2.0)));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 0.41)
		tmp = ((x ^ -0.5) + (x * 0.5)) + -1.0;
	else
		tmp = (x ^ -0.5) / (1.5 - (x * -2.0));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 0.41], N[(N[(N[Power[x, -0.5], $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] / N[(1.5 - N[(x * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.41:\\
\;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\

\mathbf{else}:\\
\;\;\;\;\frac{{x}^{-0.5}}{1.5 - x \cdot -2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 0.409999999999999976

    1. Initial program 99.6%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. inv-pow99.6%

        \[\leadsto \color{blue}{{\left(\sqrt{x}\right)}^{-1}} - \frac{1}{\sqrt{x + 1}} \]
      2. metadata-eval99.6%

        \[\leadsto {\left(\sqrt{x}\right)}^{\color{blue}{\left(-1\right)}} - \frac{1}{\sqrt{x + 1}} \]
      3. sqr-pow99.2%

        \[\leadsto \color{blue}{{\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)}} - \frac{1}{\sqrt{x + 1}} \]
      4. pow299.2%

        \[\leadsto \color{blue}{{\left({\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)}\right)}^{2}} - \frac{1}{\sqrt{x + 1}} \]
      5. sqrt-pow299.2%

        \[\leadsto {\color{blue}{\left({x}^{\left(\frac{\frac{-1}{2}}{2}\right)}\right)}}^{2} - \frac{1}{\sqrt{x + 1}} \]
      6. metadata-eval99.2%

        \[\leadsto {\left({x}^{\left(\frac{\frac{\color{blue}{-1}}{2}}{2}\right)}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
      7. metadata-eval99.2%

        \[\leadsto {\left({x}^{\left(\frac{\color{blue}{-0.5}}{2}\right)}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
      8. metadata-eval99.2%

        \[\leadsto {\left({x}^{\color{blue}{-0.25}}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
    3. Applied egg-rr99.2%

      \[\leadsto \color{blue}{{\left({x}^{-0.25}\right)}^{2}} - \frac{1}{\sqrt{x + 1}} \]
    4. Taylor expanded in x around 0 97.3%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{x}} + 0.5 \cdot x\right) - 1} \]
    5. Step-by-step derivation
      1. *-lft-identity97.3%

        \[\leadsto \left(\color{blue}{1 \cdot \sqrt{\frac{1}{x}}} + 0.5 \cdot x\right) - 1 \]
      2. fma-def97.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(1, \sqrt{\frac{1}{x}}, 0.5 \cdot x\right)} - 1 \]
      3. inv-pow97.3%

        \[\leadsto \mathsf{fma}\left(1, \sqrt{\color{blue}{{x}^{-1}}}, 0.5 \cdot x\right) - 1 \]
      4. metadata-eval97.3%

        \[\leadsto \mathsf{fma}\left(1, \sqrt{{x}^{\color{blue}{\left(-1\right)}}}, 0.5 \cdot x\right) - 1 \]
      5. sqrt-pow198.2%

        \[\leadsto \mathsf{fma}\left(1, \color{blue}{{x}^{\left(\frac{-1}{2}\right)}}, 0.5 \cdot x\right) - 1 \]
      6. metadata-eval98.2%

        \[\leadsto \mathsf{fma}\left(1, {x}^{\left(\frac{\color{blue}{-1}}{2}\right)}, 0.5 \cdot x\right) - 1 \]
      7. metadata-eval98.2%

        \[\leadsto \mathsf{fma}\left(1, {x}^{\color{blue}{-0.5}}, 0.5 \cdot x\right) - 1 \]
      8. *-commutative98.2%

        \[\leadsto \mathsf{fma}\left(1, {x}^{-0.5}, \color{blue}{x \cdot 0.5}\right) - 1 \]
    6. Applied egg-rr98.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(1, {x}^{-0.5}, x \cdot 0.5\right)} - 1 \]
    7. Step-by-step derivation
      1. fma-udef98.2%

        \[\leadsto \color{blue}{\left(1 \cdot {x}^{-0.5} + x \cdot 0.5\right)} - 1 \]
      2. *-lft-identity98.2%

        \[\leadsto \left(\color{blue}{{x}^{-0.5}} + x \cdot 0.5\right) - 1 \]
    8. Simplified98.2%

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

    if 0.409999999999999976 < x

    1. Initial program 40.5%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. frac-sub40.5%

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      2. associate-/r*40.5%

        \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
      3. div-inv40.5%

        \[\leadsto \frac{\color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x}}}}{\sqrt{x + 1}} \]
      4. associate-*r/40.5%

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
      5. flip--41.3%

        \[\leadsto \color{blue}{\frac{\left(1 \cdot \sqrt{x + 1}\right) \cdot \left(1 \cdot \sqrt{x + 1}\right) - \left(\sqrt{x} \cdot 1\right) \cdot \left(\sqrt{x} \cdot 1\right)}{1 \cdot \sqrt{x + 1} + \sqrt{x} \cdot 1}} \cdot \frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}} \]
      6. frac-times41.3%

        \[\leadsto \color{blue}{\frac{\left(\left(1 \cdot \sqrt{x + 1}\right) \cdot \left(1 \cdot \sqrt{x + 1}\right) - \left(\sqrt{x} \cdot 1\right) \cdot \left(\sqrt{x} \cdot 1\right)\right) \cdot \frac{1}{\sqrt{x}}}{\left(1 \cdot \sqrt{x + 1} + \sqrt{x} \cdot 1\right) \cdot \sqrt{x + 1}}} \]
    3. Applied egg-rr43.6%

      \[\leadsto \color{blue}{\frac{\left(\left(1 + x\right) - x\right) \cdot {x}^{-0.5}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}} \]
    4. Step-by-step derivation
      1. associate-/l*43.6%

        \[\leadsto \color{blue}{\frac{\left(1 + x\right) - x}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}}} \]
      2. associate--l+97.3%

        \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      3. +-inverses97.3%

        \[\leadsto \frac{1 + \color{blue}{0}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      4. metadata-eval97.3%

        \[\leadsto \frac{\color{blue}{1}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      5. associate-/l*99.5%

        \[\leadsto \color{blue}{\frac{1 \cdot {x}^{-0.5}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}} \]
      6. *-lft-identity99.5%

        \[\leadsto \frac{\color{blue}{{x}^{-0.5}}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}} \]
      7. *-commutative99.5%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)}} \]
      8. +-commutative99.5%

        \[\leadsto \frac{{x}^{-0.5}}{\sqrt{1 + x} \cdot \color{blue}{\left(\sqrt{1 + x} + \sqrt{x}\right)}} \]
      9. distribute-lft-in99.5%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot \sqrt{1 + x} + \sqrt{1 + x} \cdot \sqrt{x}}} \]
      10. rem-square-sqrt99.6%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(1 + x\right)} + \sqrt{1 + x} \cdot \sqrt{x}} \]
    5. Simplified99.6%

      \[\leadsto \color{blue}{\frac{{x}^{-0.5}}{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}}} \]
    6. Taylor expanded in x around -inf 0.0%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{1.5 + -1 \cdot \left(x \cdot \left({\left(\sqrt{-1}\right)}^{2} - 1\right)\right)}} \]
    7. Step-by-step derivation
      1. mul-1-neg0.0%

        \[\leadsto \frac{{x}^{-0.5}}{1.5 + \color{blue}{\left(-x \cdot \left({\left(\sqrt{-1}\right)}^{2} - 1\right)\right)}} \]
      2. unsub-neg0.0%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{1.5 - x \cdot \left({\left(\sqrt{-1}\right)}^{2} - 1\right)}} \]
      3. sub-neg0.0%

        \[\leadsto \frac{{x}^{-0.5}}{1.5 - x \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} + \left(-1\right)\right)}} \]
      4. unpow20.0%

        \[\leadsto \frac{{x}^{-0.5}}{1.5 - x \cdot \left(\color{blue}{\sqrt{-1} \cdot \sqrt{-1}} + \left(-1\right)\right)} \]
      5. rem-square-sqrt99.4%

        \[\leadsto \frac{{x}^{-0.5}}{1.5 - x \cdot \left(\color{blue}{-1} + \left(-1\right)\right)} \]
      6. metadata-eval99.4%

        \[\leadsto \frac{{x}^{-0.5}}{1.5 - x \cdot \left(-1 + \color{blue}{-1}\right)} \]
      7. metadata-eval99.4%

        \[\leadsto \frac{{x}^{-0.5}}{1.5 - x \cdot \color{blue}{-2}} \]
    8. Simplified99.4%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{1.5 - x \cdot -2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.41:\\ \;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{-0.5}}{1.5 - x \cdot -2}\\ \end{array} \]

Alternative 8: 98.2% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.65:\\ \;\;\;\;{x}^{-0.5} + -1\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{-0.5}}{x \cdot 2}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 0.65) (+ (pow x -0.5) -1.0) (/ (pow x -0.5) (* x 2.0))))
double code(double x) {
	double tmp;
	if (x <= 0.65) {
		tmp = pow(x, -0.5) + -1.0;
	} else {
		tmp = pow(x, -0.5) / (x * 2.0);
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 0.65d0) then
        tmp = (x ** (-0.5d0)) + (-1.0d0)
    else
        tmp = (x ** (-0.5d0)) / (x * 2.0d0)
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 0.65) {
		tmp = Math.pow(x, -0.5) + -1.0;
	} else {
		tmp = Math.pow(x, -0.5) / (x * 2.0);
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 0.65:
		tmp = math.pow(x, -0.5) + -1.0
	else:
		tmp = math.pow(x, -0.5) / (x * 2.0)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 0.65)
		tmp = Float64((x ^ -0.5) + -1.0);
	else
		tmp = Float64((x ^ -0.5) / Float64(x * 2.0));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 0.65)
		tmp = (x ^ -0.5) + -1.0;
	else
		tmp = (x ^ -0.5) / (x * 2.0);
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 0.65], N[(N[Power[x, -0.5], $MachinePrecision] + -1.0), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] / N[(x * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.65:\\
\;\;\;\;{x}^{-0.5} + -1\\

\mathbf{else}:\\
\;\;\;\;\frac{{x}^{-0.5}}{x \cdot 2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 0.650000000000000022

    1. Initial program 99.6%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Taylor expanded in x around 0 97.0%

      \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{1} \]
    3. Step-by-step derivation
      1. div-inv97.0%

        \[\leadsto \color{blue}{1 \cdot \frac{1}{\sqrt{x}}} - 1 \]
      2. pow1/297.0%

        \[\leadsto 1 \cdot \frac{1}{\color{blue}{{x}^{0.5}}} - 1 \]
      3. pow-flip97.4%

        \[\leadsto 1 \cdot \color{blue}{{x}^{\left(-0.5\right)}} - 1 \]
      4. metadata-eval97.4%

        \[\leadsto 1 \cdot {x}^{\color{blue}{-0.5}} - 1 \]
    4. Applied egg-rr97.4%

      \[\leadsto \color{blue}{1 \cdot {x}^{-0.5}} - 1 \]
    5. Step-by-step derivation
      1. *-lft-identity97.4%

        \[\leadsto \color{blue}{{x}^{-0.5}} - 1 \]
    6. Simplified97.4%

      \[\leadsto \color{blue}{{x}^{-0.5}} - 1 \]

    if 0.650000000000000022 < x

    1. Initial program 40.5%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. frac-sub40.5%

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      2. associate-/r*40.5%

        \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
      3. div-inv40.5%

        \[\leadsto \frac{\color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x}}}}{\sqrt{x + 1}} \]
      4. associate-*r/40.5%

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
      5. flip--41.3%

        \[\leadsto \color{blue}{\frac{\left(1 \cdot \sqrt{x + 1}\right) \cdot \left(1 \cdot \sqrt{x + 1}\right) - \left(\sqrt{x} \cdot 1\right) \cdot \left(\sqrt{x} \cdot 1\right)}{1 \cdot \sqrt{x + 1} + \sqrt{x} \cdot 1}} \cdot \frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}} \]
      6. frac-times41.3%

        \[\leadsto \color{blue}{\frac{\left(\left(1 \cdot \sqrt{x + 1}\right) \cdot \left(1 \cdot \sqrt{x + 1}\right) - \left(\sqrt{x} \cdot 1\right) \cdot \left(\sqrt{x} \cdot 1\right)\right) \cdot \frac{1}{\sqrt{x}}}{\left(1 \cdot \sqrt{x + 1} + \sqrt{x} \cdot 1\right) \cdot \sqrt{x + 1}}} \]
    3. Applied egg-rr43.6%

      \[\leadsto \color{blue}{\frac{\left(\left(1 + x\right) - x\right) \cdot {x}^{-0.5}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}} \]
    4. Step-by-step derivation
      1. associate-/l*43.6%

        \[\leadsto \color{blue}{\frac{\left(1 + x\right) - x}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}}} \]
      2. associate--l+97.3%

        \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      3. +-inverses97.3%

        \[\leadsto \frac{1 + \color{blue}{0}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      4. metadata-eval97.3%

        \[\leadsto \frac{\color{blue}{1}}{\frac{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}{{x}^{-0.5}}} \]
      5. associate-/l*99.5%

        \[\leadsto \color{blue}{\frac{1 \cdot {x}^{-0.5}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}}} \]
      6. *-lft-identity99.5%

        \[\leadsto \frac{\color{blue}{{x}^{-0.5}}}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \sqrt{1 + x}} \]
      7. *-commutative99.5%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)}} \]
      8. +-commutative99.5%

        \[\leadsto \frac{{x}^{-0.5}}{\sqrt{1 + x} \cdot \color{blue}{\left(\sqrt{1 + x} + \sqrt{x}\right)}} \]
      9. distribute-lft-in99.5%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot \sqrt{1 + x} + \sqrt{1 + x} \cdot \sqrt{x}}} \]
      10. rem-square-sqrt99.6%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{\left(1 + x\right)} + \sqrt{1 + x} \cdot \sqrt{x}} \]
    5. Simplified99.6%

      \[\leadsto \color{blue}{\frac{{x}^{-0.5}}{\left(1 + x\right) + \sqrt{1 + x} \cdot \sqrt{x}}} \]
    6. Taylor expanded in x around inf 97.3%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{2 \cdot x}} \]
    7. Step-by-step derivation
      1. *-commutative97.3%

        \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{x \cdot 2}} \]
    8. Simplified97.3%

      \[\leadsto \frac{{x}^{-0.5}}{\color{blue}{x \cdot 2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.65:\\ \;\;\;\;{x}^{-0.5} + -1\\ \mathbf{else}:\\ \;\;\;\;\frac{{x}^{-0.5}}{x \cdot 2}\\ \end{array} \]

Alternative 9: 68.2% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.8:\\ \;\;\;\;{x}^{-0.5} + -1\\ \mathbf{else}:\\ \;\;\;\;{\left(x \cdot x\right)}^{-0.25}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 0.8) (+ (pow x -0.5) -1.0) (pow (* x x) -0.25)))
double code(double x) {
	double tmp;
	if (x <= 0.8) {
		tmp = pow(x, -0.5) + -1.0;
	} else {
		tmp = pow((x * x), -0.25);
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 0.8d0) then
        tmp = (x ** (-0.5d0)) + (-1.0d0)
    else
        tmp = (x * x) ** (-0.25d0)
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 0.8) {
		tmp = Math.pow(x, -0.5) + -1.0;
	} else {
		tmp = Math.pow((x * x), -0.25);
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 0.8:
		tmp = math.pow(x, -0.5) + -1.0
	else:
		tmp = math.pow((x * x), -0.25)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 0.8)
		tmp = Float64((x ^ -0.5) + -1.0);
	else
		tmp = Float64(x * x) ^ -0.25;
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 0.8)
		tmp = (x ^ -0.5) + -1.0;
	else
		tmp = (x * x) ^ -0.25;
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 0.8], N[(N[Power[x, -0.5], $MachinePrecision] + -1.0), $MachinePrecision], N[Power[N[(x * x), $MachinePrecision], -0.25], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.8:\\
\;\;\;\;{x}^{-0.5} + -1\\

\mathbf{else}:\\
\;\;\;\;{\left(x \cdot x\right)}^{-0.25}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 0.80000000000000004

    1. Initial program 99.6%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Taylor expanded in x around 0 97.0%

      \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{1} \]
    3. Step-by-step derivation
      1. div-inv97.0%

        \[\leadsto \color{blue}{1 \cdot \frac{1}{\sqrt{x}}} - 1 \]
      2. pow1/297.0%

        \[\leadsto 1 \cdot \frac{1}{\color{blue}{{x}^{0.5}}} - 1 \]
      3. pow-flip97.4%

        \[\leadsto 1 \cdot \color{blue}{{x}^{\left(-0.5\right)}} - 1 \]
      4. metadata-eval97.4%

        \[\leadsto 1 \cdot {x}^{\color{blue}{-0.5}} - 1 \]
    4. Applied egg-rr97.4%

      \[\leadsto \color{blue}{1 \cdot {x}^{-0.5}} - 1 \]
    5. Step-by-step derivation
      1. *-lft-identity97.4%

        \[\leadsto \color{blue}{{x}^{-0.5}} - 1 \]
    6. Simplified97.4%

      \[\leadsto \color{blue}{{x}^{-0.5}} - 1 \]

    if 0.80000000000000004 < x

    1. Initial program 40.5%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. inv-pow40.5%

        \[\leadsto \color{blue}{{\left(\sqrt{x}\right)}^{-1}} - \frac{1}{\sqrt{x + 1}} \]
      2. metadata-eval40.5%

        \[\leadsto {\left(\sqrt{x}\right)}^{\color{blue}{\left(-1\right)}} - \frac{1}{\sqrt{x + 1}} \]
      3. sqr-pow23.3%

        \[\leadsto \color{blue}{{\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)}} - \frac{1}{\sqrt{x + 1}} \]
      4. pow223.3%

        \[\leadsto \color{blue}{{\left({\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)}\right)}^{2}} - \frac{1}{\sqrt{x + 1}} \]
      5. sqrt-pow223.2%

        \[\leadsto {\color{blue}{\left({x}^{\left(\frac{\frac{-1}{2}}{2}\right)}\right)}}^{2} - \frac{1}{\sqrt{x + 1}} \]
      6. metadata-eval23.2%

        \[\leadsto {\left({x}^{\left(\frac{\frac{\color{blue}{-1}}{2}}{2}\right)}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
      7. metadata-eval23.2%

        \[\leadsto {\left({x}^{\left(\frac{\color{blue}{-0.5}}{2}\right)}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
      8. metadata-eval23.2%

        \[\leadsto {\left({x}^{\color{blue}{-0.25}}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
    3. Applied egg-rr23.2%

      \[\leadsto \color{blue}{{\left({x}^{-0.25}\right)}^{2}} - \frac{1}{\sqrt{x + 1}} \]
    4. Taylor expanded in x around inf 5.6%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \]
    5. Step-by-step derivation
      1. inv-pow5.6%

        \[\leadsto \sqrt{\color{blue}{{x}^{-1}}} \]
      2. metadata-eval5.6%

        \[\leadsto \sqrt{{x}^{\color{blue}{\left(-1\right)}}} \]
      3. sqrt-pow15.6%

        \[\leadsto \color{blue}{{x}^{\left(\frac{-1}{2}\right)}} \]
      4. metadata-eval5.6%

        \[\leadsto {x}^{\left(\frac{\color{blue}{-1}}{2}\right)} \]
      5. metadata-eval5.6%

        \[\leadsto {x}^{\color{blue}{-0.5}} \]
      6. sqr-pow5.6%

        \[\leadsto \color{blue}{{x}^{\left(\frac{-0.5}{2}\right)} \cdot {x}^{\left(\frac{-0.5}{2}\right)}} \]
      7. pow-prod-down38.1%

        \[\leadsto \color{blue}{{\left(x \cdot x\right)}^{\left(\frac{-0.5}{2}\right)}} \]
      8. metadata-eval38.1%

        \[\leadsto {\left(x \cdot x\right)}^{\color{blue}{-0.25}} \]
    6. Applied egg-rr38.1%

      \[\leadsto \color{blue}{{\left(x \cdot x\right)}^{-0.25}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification68.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.8:\\ \;\;\;\;{x}^{-0.5} + -1\\ \mathbf{else}:\\ \;\;\;\;{\left(x \cdot x\right)}^{-0.25}\\ \end{array} \]

Alternative 10: 51.5% accurate, 2.0× speedup?

\[\begin{array}{l} \\ {x}^{-0.5} + -1 \end{array} \]
(FPCore (x) :precision binary64 (+ (pow x -0.5) -1.0))
double code(double x) {
	return pow(x, -0.5) + -1.0;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (x ** (-0.5d0)) + (-1.0d0)
end function
public static double code(double x) {
	return Math.pow(x, -0.5) + -1.0;
}
def code(x):
	return math.pow(x, -0.5) + -1.0
function code(x)
	return Float64((x ^ -0.5) + -1.0)
end
function tmp = code(x)
	tmp = (x ^ -0.5) + -1.0;
end
code[x_] := N[(N[Power[x, -0.5], $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}

\\
{x}^{-0.5} + -1
\end{array}
Derivation
  1. Initial program 70.2%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Taylor expanded in x around 0 50.1%

    \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{1} \]
  3. Step-by-step derivation
    1. div-inv50.1%

      \[\leadsto \color{blue}{1 \cdot \frac{1}{\sqrt{x}}} - 1 \]
    2. pow1/250.1%

      \[\leadsto 1 \cdot \frac{1}{\color{blue}{{x}^{0.5}}} - 1 \]
    3. pow-flip50.3%

      \[\leadsto 1 \cdot \color{blue}{{x}^{\left(-0.5\right)}} - 1 \]
    4. metadata-eval50.3%

      \[\leadsto 1 \cdot {x}^{\color{blue}{-0.5}} - 1 \]
  4. Applied egg-rr50.3%

    \[\leadsto \color{blue}{1 \cdot {x}^{-0.5}} - 1 \]
  5. Step-by-step derivation
    1. *-lft-identity50.3%

      \[\leadsto \color{blue}{{x}^{-0.5}} - 1 \]
  6. Simplified50.3%

    \[\leadsto \color{blue}{{x}^{-0.5}} - 1 \]
  7. Final simplification50.3%

    \[\leadsto {x}^{-0.5} + -1 \]

Alternative 11: 51.6% accurate, 2.0× speedup?

\[\begin{array}{l} \\ {x}^{-0.5} \end{array} \]
(FPCore (x) :precision binary64 (pow x -0.5))
double code(double x) {
	return pow(x, -0.5);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = x ** (-0.5d0)
end function
public static double code(double x) {
	return Math.pow(x, -0.5);
}
def code(x):
	return math.pow(x, -0.5)
function code(x)
	return x ^ -0.5
end
function tmp = code(x)
	tmp = x ^ -0.5;
end
code[x_] := N[Power[x, -0.5], $MachinePrecision]
\begin{array}{l}

\\
{x}^{-0.5}
\end{array}
Derivation
  1. Initial program 70.2%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Step-by-step derivation
    1. inv-pow70.2%

      \[\leadsto \color{blue}{{\left(\sqrt{x}\right)}^{-1}} - \frac{1}{\sqrt{x + 1}} \]
    2. metadata-eval70.2%

      \[\leadsto {\left(\sqrt{x}\right)}^{\color{blue}{\left(-1\right)}} - \frac{1}{\sqrt{x + 1}} \]
    3. sqr-pow61.5%

      \[\leadsto \color{blue}{{\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)}} - \frac{1}{\sqrt{x + 1}} \]
    4. pow261.5%

      \[\leadsto \color{blue}{{\left({\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)}\right)}^{2}} - \frac{1}{\sqrt{x + 1}} \]
    5. sqrt-pow261.5%

      \[\leadsto {\color{blue}{\left({x}^{\left(\frac{\frac{-1}{2}}{2}\right)}\right)}}^{2} - \frac{1}{\sqrt{x + 1}} \]
    6. metadata-eval61.5%

      \[\leadsto {\left({x}^{\left(\frac{\frac{\color{blue}{-1}}{2}}{2}\right)}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
    7. metadata-eval61.5%

      \[\leadsto {\left({x}^{\left(\frac{\color{blue}{-0.5}}{2}\right)}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
    8. metadata-eval61.5%

      \[\leadsto {\left({x}^{\color{blue}{-0.25}}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
  3. Applied egg-rr61.5%

    \[\leadsto \color{blue}{{\left({x}^{-0.25}\right)}^{2}} - \frac{1}{\sqrt{x + 1}} \]
  4. Taylor expanded in x around inf 49.4%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \]
  5. Step-by-step derivation
    1. *-lft-identity49.4%

      \[\leadsto \color{blue}{1 \cdot \sqrt{\frac{1}{x}}} \]
    2. inv-pow49.4%

      \[\leadsto 1 \cdot \sqrt{\color{blue}{{x}^{-1}}} \]
    3. metadata-eval49.4%

      \[\leadsto 1 \cdot \sqrt{{x}^{\color{blue}{\left(-1\right)}}} \]
    4. sqrt-pow149.9%

      \[\leadsto 1 \cdot \color{blue}{{x}^{\left(\frac{-1}{2}\right)}} \]
    5. metadata-eval49.9%

      \[\leadsto 1 \cdot {x}^{\left(\frac{\color{blue}{-1}}{2}\right)} \]
    6. metadata-eval49.9%

      \[\leadsto 1 \cdot {x}^{\color{blue}{-0.5}} \]
  6. Applied egg-rr49.9%

    \[\leadsto \color{blue}{1 \cdot {x}^{-0.5}} \]
  7. Step-by-step derivation
    1. *-lft-identity49.9%

      \[\leadsto \color{blue}{{x}^{-0.5}} \]
  8. Simplified49.9%

    \[\leadsto \color{blue}{{x}^{-0.5}} \]
  9. Final simplification49.9%

    \[\leadsto {x}^{-0.5} \]

Alternative 12: 2.3% accurate, 41.8× speedup?

\[\begin{array}{l} \\ x \cdot 0.5 + -1 \end{array} \]
(FPCore (x) :precision binary64 (+ (* x 0.5) -1.0))
double code(double x) {
	return (x * 0.5) + -1.0;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (x * 0.5d0) + (-1.0d0)
end function
public static double code(double x) {
	return (x * 0.5) + -1.0;
}
def code(x):
	return (x * 0.5) + -1.0
function code(x)
	return Float64(Float64(x * 0.5) + -1.0)
end
function tmp = code(x)
	tmp = (x * 0.5) + -1.0;
end
code[x_] := N[(N[(x * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}

\\
x \cdot 0.5 + -1
\end{array}
Derivation
  1. Initial program 70.2%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Step-by-step derivation
    1. inv-pow70.2%

      \[\leadsto \color{blue}{{\left(\sqrt{x}\right)}^{-1}} - \frac{1}{\sqrt{x + 1}} \]
    2. metadata-eval70.2%

      \[\leadsto {\left(\sqrt{x}\right)}^{\color{blue}{\left(-1\right)}} - \frac{1}{\sqrt{x + 1}} \]
    3. sqr-pow61.5%

      \[\leadsto \color{blue}{{\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)}} - \frac{1}{\sqrt{x + 1}} \]
    4. pow261.5%

      \[\leadsto \color{blue}{{\left({\left(\sqrt{x}\right)}^{\left(\frac{-1}{2}\right)}\right)}^{2}} - \frac{1}{\sqrt{x + 1}} \]
    5. sqrt-pow261.5%

      \[\leadsto {\color{blue}{\left({x}^{\left(\frac{\frac{-1}{2}}{2}\right)}\right)}}^{2} - \frac{1}{\sqrt{x + 1}} \]
    6. metadata-eval61.5%

      \[\leadsto {\left({x}^{\left(\frac{\frac{\color{blue}{-1}}{2}}{2}\right)}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
    7. metadata-eval61.5%

      \[\leadsto {\left({x}^{\left(\frac{\color{blue}{-0.5}}{2}\right)}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
    8. metadata-eval61.5%

      \[\leadsto {\left({x}^{\color{blue}{-0.25}}\right)}^{2} - \frac{1}{\sqrt{x + 1}} \]
  3. Applied egg-rr61.5%

    \[\leadsto \color{blue}{{\left({x}^{-0.25}\right)}^{2}} - \frac{1}{\sqrt{x + 1}} \]
  4. Taylor expanded in x around 0 50.7%

    \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{x}} + 0.5 \cdot x\right) - 1} \]
  5. Taylor expanded in x around inf 2.3%

    \[\leadsto \color{blue}{0.5 \cdot x} - 1 \]
  6. Step-by-step derivation
    1. *-commutative2.3%

      \[\leadsto \color{blue}{x \cdot 0.5} - 1 \]
  7. Simplified2.3%

    \[\leadsto \color{blue}{x \cdot 0.5} - 1 \]
  8. Final simplification2.3%

    \[\leadsto x \cdot 0.5 + -1 \]

Alternative 13: 1.9% accurate, 209.0× speedup?

\[\begin{array}{l} \\ -1 \end{array} \]
(FPCore (x) :precision binary64 -1.0)
double code(double x) {
	return -1.0;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = -1.0d0
end function
public static double code(double x) {
	return -1.0;
}
def code(x):
	return -1.0
function code(x)
	return -1.0
end
function tmp = code(x)
	tmp = -1.0;
end
code[x_] := -1.0
\begin{array}{l}

\\
-1
\end{array}
Derivation
  1. Initial program 70.2%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Taylor expanded in x around 0 50.1%

    \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{1} \]
  3. Taylor expanded in x around inf 1.9%

    \[\leadsto \color{blue}{-1} \]
  4. Final simplification1.9%

    \[\leadsto -1 \]

Developer target: 98.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}} \end{array} \]
(FPCore (x)
 :precision binary64
 (/ 1.0 (+ (* (+ x 1.0) (sqrt x)) (* x (sqrt (+ x 1.0))))))
double code(double x) {
	return 1.0 / (((x + 1.0) * sqrt(x)) + (x * sqrt((x + 1.0))));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = 1.0d0 / (((x + 1.0d0) * sqrt(x)) + (x * sqrt((x + 1.0d0))))
end function
public static double code(double x) {
	return 1.0 / (((x + 1.0) * Math.sqrt(x)) + (x * Math.sqrt((x + 1.0))));
}
def code(x):
	return 1.0 / (((x + 1.0) * math.sqrt(x)) + (x * math.sqrt((x + 1.0))))
function code(x)
	return Float64(1.0 / Float64(Float64(Float64(x + 1.0) * sqrt(x)) + Float64(x * sqrt(Float64(x + 1.0)))))
end
function tmp = code(x)
	tmp = 1.0 / (((x + 1.0) * sqrt(x)) + (x * sqrt((x + 1.0))));
end
code[x_] := N[(1.0 / N[(N[(N[(x + 1.0), $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(x * N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}}
\end{array}

Reproduce

?
herbie shell --seed 2023297 
(FPCore (x)
  :name "2isqrt (example 3.6)"
  :precision binary64

  :herbie-target
  (/ 1.0 (+ (* (+ x 1.0) (sqrt x)) (* x (sqrt (+ x 1.0)))))

  (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))