2isqrt (example 3.6)

Percentage Accurate: 69.4% → 99.8%
Time: 11.5s
Alternatives: 15
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 15 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.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 0.0

    1. Initial program 47.2%

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

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      3. *-un-lft-identity47.3%

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

        \[\leadsto \left(\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      5. *-rgt-identity47.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\left({\left(\sqrt{x}\right)}^{-0.5}\right)}^{2} \cdot \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      6. associate-*r/47.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\frac{\sqrt{1 + x} + \sqrt{x}}{\color{blue}{1}}}}{\sqrt{1 + x}} \]
      4. /-rgt-identity99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      5. +-commutative99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    9. Simplified99.5%

      \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    10. Taylor expanded in x around inf 99.7%

      \[\leadsto \frac{\color{blue}{\frac{0.5}{x}}}{\sqrt{1 + x}} \]
    11. Step-by-step derivation
      1. div-inv99.6%

        \[\leadsto \color{blue}{\frac{0.5}{x} \cdot \frac{1}{\sqrt{1 + x}}} \]
      2. +-commutative99.6%

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

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot \left({x}^{-0.5} \cdot {x}^{-0.5}\right)\right) \cdot {\left(1 + x\right)}^{\color{blue}{-0.5}} \]
      11. associate-*l*99.3%

        \[\leadsto \color{blue}{0.5 \cdot \left(\left({x}^{-0.5} \cdot {x}^{-0.5}\right) \cdot {\left(1 + x\right)}^{-0.5}\right)} \]
      12. pow-prod-up99.7%

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

        \[\leadsto 0.5 \cdot \left({x}^{\color{blue}{-1}} \cdot {\left(1 + x\right)}^{-0.5}\right) \]
      14. inv-pow99.7%

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

        \[\leadsto 0.5 \cdot \left(\frac{1}{x} \cdot {\color{blue}{\left(x + 1\right)}}^{-0.5}\right) \]
    12. Applied egg-rr99.7%

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

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

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

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

    if 0.0 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1))))

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\left({\left(\sqrt{x}\right)}^{-0.5}\right)}^{2} \cdot \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      6. associate-*r/99.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\frac{\sqrt{1 + x} + \sqrt{x}}{\color{blue}{1}}}}{\sqrt{1 + x}} \]
      4. /-rgt-identity99.8%

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

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    9. Simplified99.8%

      \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    10. Step-by-step derivation
      1. associate-/l/99.8%

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

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

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

        \[\leadsto {x}^{-0.5} \cdot \frac{1}{\color{blue}{\sqrt{1 + x} \cdot \sqrt{1 + x} + \sqrt{x} \cdot \sqrt{1 + x}}} \]
      5. add-sqr-sqrt99.9%

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

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

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

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

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

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

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

Alternative 2: 99.8% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 0.0

    1. Initial program 47.2%

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

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      3. *-un-lft-identity47.3%

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

        \[\leadsto \left(\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      5. *-rgt-identity47.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\left({\left(\sqrt{x}\right)}^{-0.5}\right)}^{2} \cdot \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      6. associate-*r/47.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\frac{\sqrt{1 + x} + \sqrt{x}}{\color{blue}{1}}}}{\sqrt{1 + x}} \]
      4. /-rgt-identity99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      5. +-commutative99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    9. Simplified99.5%

      \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    10. Taylor expanded in x around inf 99.7%

      \[\leadsto \frac{\color{blue}{\frac{0.5}{x}}}{\sqrt{1 + x}} \]
    11. Step-by-step derivation
      1. div-inv99.6%

        \[\leadsto \color{blue}{\frac{0.5}{x} \cdot \frac{1}{\sqrt{1 + x}}} \]
      2. +-commutative99.6%

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

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot \left({x}^{-0.5} \cdot {x}^{-0.5}\right)\right) \cdot {\left(1 + x\right)}^{\color{blue}{-0.5}} \]
      11. associate-*l*99.3%

        \[\leadsto \color{blue}{0.5 \cdot \left(\left({x}^{-0.5} \cdot {x}^{-0.5}\right) \cdot {\left(1 + x\right)}^{-0.5}\right)} \]
      12. pow-prod-up99.7%

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

        \[\leadsto 0.5 \cdot \left({x}^{\color{blue}{-1}} \cdot {\left(1 + x\right)}^{-0.5}\right) \]
      14. inv-pow99.7%

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

        \[\leadsto 0.5 \cdot \left(\frac{1}{x} \cdot {\color{blue}{\left(x + 1\right)}}^{-0.5}\right) \]
    12. Applied egg-rr99.7%

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

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

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

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

    if 0.0 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1))))

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\left({\left(\sqrt{x}\right)}^{-0.5}\right)}^{2} \cdot \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      6. associate-*r/99.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\frac{\sqrt{1 + x} + \sqrt{x}}{\color{blue}{1}}}}{\sqrt{1 + x}} \]
      4. /-rgt-identity99.8%

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

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    9. Simplified99.8%

      \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    10. Step-by-step derivation
      1. expm1-log1p-u92.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{1 + x}}\right)\right)} \]
      2. expm1-udef92.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{1 + x}}\right)} - 1} \]
      3. associate-/l/92.2%

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{{x}^{-0.5}}{\sqrt{1 + x} \cdot \color{blue}{\left(\sqrt{1 + x} + \sqrt{x}\right)}}\right)} - 1 \]
      5. distribute-rgt-in92.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot \sqrt{1 + x} + \sqrt{x} \cdot \sqrt{1 + x}}}\right)} - 1 \]
      6. add-sqr-sqrt92.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{{x}^{-0.5}}{\color{blue}{\left(1 + x\right)} + \sqrt{x} \cdot \sqrt{1 + x}}\right)} - 1 \]
      7. +-commutative92.2%

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{{x}^{-0.5}}{\left(x + 1\right) + \color{blue}{\sqrt{x \cdot \left(1 + x\right)}}}\right)} - 1 \]
      9. distribute-lft-in92.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{{x}^{-0.5}}{\left(x + 1\right) + \sqrt{\color{blue}{x \cdot 1 + x \cdot x}}}\right)} - 1 \]
      10. *-rgt-identity92.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{{x}^{-0.5}}{\left(x + 1\right) + \sqrt{\color{blue}{x} + x \cdot x}}\right)} - 1 \]
    11. Applied egg-rr92.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{{x}^{-0.5}}{\left(x + 1\right) + \sqrt{x + x \cdot x}}\right)} - 1} \]
    12. Step-by-step derivation
      1. expm1-def92.6%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{x}^{-0.5}}{\left(x + 1\right) + \sqrt{x + x \cdot x}}\right)\right)} \]
      2. expm1-log1p99.9%

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

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

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

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

Alternative 3: 99.4% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{-1}{\sqrt{x + 1}}\\
\mathbf{if}\;\frac{1}{\sqrt{x}} + t_0 \leq 2 \cdot 10^{-13}:\\
\;\;\;\;0.5 \cdot \frac{{\left(x + 1\right)}^{-0.5}}{x}\\

\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} + t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 2.0000000000000001e-13

    1. Initial program 47.2%

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

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      3. *-un-lft-identity47.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\left({\left(\sqrt{x}\right)}^{-0.5}\right)}^{2} \cdot \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      6. associate-*r/48.3%

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

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

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

        \[\leadsto \frac{\frac{{\color{blue}{x}}^{-0.5} \cdot \left(\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}\right)}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{1 + x}} \]
      10. add-sqr-sqrt30.1%

        \[\leadsto \frac{\frac{{x}^{-0.5} \cdot \left(\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}\right)}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{1 + x}} \]
      11. add-sqr-sqrt49.1%

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

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

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

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

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

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\frac{\sqrt{1 + x} + \sqrt{x}}{\color{blue}{1}}}}{\sqrt{1 + x}} \]
      4. /-rgt-identity99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      5. +-commutative99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    9. Simplified99.5%

      \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    10. Taylor expanded in x around inf 99.4%

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

        \[\leadsto \color{blue}{\frac{0.5}{x} \cdot \frac{1}{\sqrt{1 + x}}} \]
      2. +-commutative99.3%

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

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot \left({x}^{-0.5} \cdot {x}^{-0.5}\right)\right) \cdot {\left(1 + x\right)}^{\color{blue}{-0.5}} \]
      11. associate-*l*99.0%

        \[\leadsto \color{blue}{0.5 \cdot \left(\left({x}^{-0.5} \cdot {x}^{-0.5}\right) \cdot {\left(1 + x\right)}^{-0.5}\right)} \]
      12. pow-prod-up99.4%

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

        \[\leadsto 0.5 \cdot \left({x}^{\color{blue}{-1}} \cdot {\left(1 + x\right)}^{-0.5}\right) \]
      14. inv-pow99.4%

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

        \[\leadsto 0.5 \cdot \left(\frac{1}{x} \cdot {\color{blue}{\left(x + 1\right)}}^{-0.5}\right) \]
    12. Applied egg-rr99.4%

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

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

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

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

    if 2.0000000000000001e-13 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1))))

    1. Initial program 99.5%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. add-log-exp6.1%

        \[\leadsto \color{blue}{\log \left(e^{\frac{1}{\sqrt{x}}}\right)} - \frac{1}{\sqrt{x + 1}} \]
      2. *-un-lft-identity6.1%

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

        \[\leadsto \color{blue}{\left(\log 1 + \log \left(e^{\frac{1}{\sqrt{x}}}\right)\right)} - \frac{1}{\sqrt{x + 1}} \]
      4. metadata-eval6.1%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(0 + {x}^{-0.5}\right)} - \frac{1}{\sqrt{x + 1}} \]
    4. Step-by-step derivation
      1. +-lft-identity100.0%

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

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

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

Alternative 4: 99.7% accurate, 0.5× speedup?

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

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

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

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

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    3. *-un-lft-identity73.3%

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

      \[\leadsto \left(\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    5. *-rgt-identity73.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{{\left({\left(\sqrt{x}\right)}^{-0.5}\right)}^{2} \cdot \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
    6. associate-*r/73.5%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{x}^{-0.5}}{\frac{\sqrt{1 + x} + \sqrt{x}}{\color{blue}{1}}}}{\sqrt{1 + x}} \]
    4. /-rgt-identity99.6%

      \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
    5. +-commutative99.6%

      \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
  9. Simplified99.6%

    \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
  10. Step-by-step derivation
    1. associate-/l/99.6%

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

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

      \[\leadsto \color{blue}{\frac{1}{\sqrt{1 + x}} \cdot \frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{1 + x}}} \]
    4. pow1/299.6%

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

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

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

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

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

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

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

Alternative 5: 99.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{x + 1}\\
\frac{\frac{{x}^{-0.5}}{\sqrt{x} + t_0}}{t_0}
\end{array}
\end{array}
Derivation
  1. Initial program 73.2%

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

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

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    3. *-un-lft-identity73.3%

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

      \[\leadsto \left(\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    5. *-rgt-identity73.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{{\left({\left(\sqrt{x}\right)}^{-0.5}\right)}^{2} \cdot \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
    6. associate-*r/73.5%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{x}^{-0.5}}{\frac{\sqrt{1 + x} + \sqrt{x}}{\color{blue}{1}}}}{\sqrt{1 + x}} \]
    4. /-rgt-identity99.6%

      \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
    5. +-commutative99.6%

      \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
  9. Simplified99.6%

    \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
  10. Final simplification99.6%

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

Alternative 6: 99.5% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{x + 1}\\
\frac{\frac{1}{x + \sqrt{x} \cdot t_0}}{t_0}
\end{array}
\end{array}
Derivation
  1. Initial program 73.2%

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

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

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    3. *-un-lft-identity73.3%

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

      \[\leadsto \left(\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    5. *-rgt-identity73.3%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}} \cdot {x}^{-0.5}}{\sqrt{1 + x}} \]
    2. metadata-eval73.9%

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

      \[\leadsto \frac{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}} \cdot \color{blue}{\frac{1}{{x}^{0.5}}}}{\sqrt{1 + x}} \]
    4. pow1/273.7%

      \[\leadsto \frac{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}} \cdot \frac{1}{\color{blue}{\sqrt{x}}}}{\sqrt{1 + x}} \]
    5. frac-times73.7%

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

      \[\leadsto \frac{\frac{\left(\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}\right) \cdot 1}{\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}}}{\sqrt{1 + x}} \]
    7. add-sqr-sqrt74.1%

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

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

    \[\leadsto \frac{\color{blue}{\frac{\left(1 + \left(x - x\right)\right) \cdot 1}{\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \sqrt{x}}}}{\sqrt{1 + x}} \]
  8. Step-by-step derivation
    1. *-rgt-identity99.3%

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{\color{blue}{x} + \sqrt{x} \cdot \sqrt{1 + x}}}{\sqrt{1 + x}} \]
  9. Simplified99.4%

    \[\leadsto \frac{\color{blue}{\frac{1}{x + \sqrt{x} \cdot \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
  10. Final simplification99.4%

    \[\leadsto \frac{\frac{1}{x + \sqrt{x} \cdot \sqrt{x + 1}}}{\sqrt{x + 1}} \]

Alternative 7: 99.4% accurate, 1.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{t_0}{x}\\


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

    1. Initial program 99.5%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity99.5%

        \[\leadsto \color{blue}{1 \cdot \frac{1}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
      2. clear-num99.5%

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

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]
      4. prod-diff99.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(1, \frac{1}{\sqrt{x}}, -1 \cdot \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right)} \]
      5. *-un-lft-identity99.5%

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

        \[\leadsto \color{blue}{\left(1 \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\right)} + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
      7. *-un-lft-identity99.5%

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

        \[\leadsto \left(\color{blue}{{\left(\sqrt{x}\right)}^{-1}} - \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
      9. sqrt-pow2100.0%

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

        \[\leadsto \left({x}^{\color{blue}{-0.5}} - \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
      11. pow1/2100.0%

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

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

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

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

      \[\leadsto \color{blue}{\left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)} \]
    4. Step-by-step derivation
      1. fma-udef100.0%

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
      2. distribute-lft1-in100.0%

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

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{0} \cdot {\left(1 + x\right)}^{-0.5} \]
      4. mul0-lft100.0%

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{0} \]
      5. +-rgt-identity100.0%

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

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

    if 5e7 < x

    1. Initial program 47.2%

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

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      3. *-un-lft-identity47.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\left({\left(\sqrt{x}\right)}^{-0.5}\right)}^{2} \cdot \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      6. associate-*r/48.3%

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

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

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

        \[\leadsto \frac{\frac{{\color{blue}{x}}^{-0.5} \cdot \left(\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}\right)}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{1 + x}} \]
      10. add-sqr-sqrt30.1%

        \[\leadsto \frac{\frac{{x}^{-0.5} \cdot \left(\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}\right)}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{1 + x}} \]
      11. add-sqr-sqrt49.1%

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

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

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

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

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

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\frac{\sqrt{1 + x} + \sqrt{x}}{\color{blue}{1}}}}{\sqrt{1 + x}} \]
      4. /-rgt-identity99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      5. +-commutative99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    9. Simplified99.5%

      \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    10. Taylor expanded in x around inf 99.4%

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

        \[\leadsto \color{blue}{\frac{0.5}{x} \cdot \frac{1}{\sqrt{1 + x}}} \]
      2. +-commutative99.3%

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

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot \left({x}^{-0.5} \cdot {x}^{-0.5}\right)\right) \cdot {\left(1 + x\right)}^{\color{blue}{-0.5}} \]
      11. associate-*l*99.0%

        \[\leadsto \color{blue}{0.5 \cdot \left(\left({x}^{-0.5} \cdot {x}^{-0.5}\right) \cdot {\left(1 + x\right)}^{-0.5}\right)} \]
      12. pow-prod-up99.4%

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

        \[\leadsto 0.5 \cdot \left({x}^{\color{blue}{-1}} \cdot {\left(1 + x\right)}^{-0.5}\right) \]
      14. inv-pow99.4%

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

        \[\leadsto 0.5 \cdot \left(\frac{1}{x} \cdot {\color{blue}{\left(x + 1\right)}}^{-0.5}\right) \]
    12. Applied egg-rr99.4%

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

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

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

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

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

Alternative 8: 98.6% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 99.5%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. add-log-exp6.1%

        \[\leadsto \color{blue}{\log \left(e^{\frac{1}{\sqrt{x}}}\right)} - \frac{1}{\sqrt{x + 1}} \]
      2. *-un-lft-identity6.1%

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

        \[\leadsto \color{blue}{\left(\log 1 + \log \left(e^{\frac{1}{\sqrt{x}}}\right)\right)} - \frac{1}{\sqrt{x + 1}} \]
      4. metadata-eval6.1%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(0 + {x}^{-0.5}\right)} - \frac{1}{\sqrt{x + 1}} \]
    4. Step-by-step derivation
      1. +-lft-identity100.0%

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

      \[\leadsto \color{blue}{{x}^{-0.5}} - \frac{1}{\sqrt{x + 1}} \]
    6. Taylor expanded in x around 0 98.8%

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

    if 1.1499999999999999 < x

    1. Initial program 47.2%

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

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      3. *-un-lft-identity47.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\left({\left(\sqrt{x}\right)}^{-0.5}\right)}^{2} \cdot \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      6. associate-*r/48.3%

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

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

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

        \[\leadsto \frac{\frac{{\color{blue}{x}}^{-0.5} \cdot \left(\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}\right)}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{1 + x}} \]
      10. add-sqr-sqrt30.1%

        \[\leadsto \frac{\frac{{x}^{-0.5} \cdot \left(\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}\right)}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{1 + x}} \]
      11. add-sqr-sqrt49.1%

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

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

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

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

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

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\frac{\sqrt{1 + x} + \sqrt{x}}{\color{blue}{1}}}}{\sqrt{1 + x}} \]
      4. /-rgt-identity99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      5. +-commutative99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    9. Simplified99.5%

      \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    10. Taylor expanded in x around inf 99.4%

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

        \[\leadsto \color{blue}{\frac{0.5}{x} \cdot \frac{1}{\sqrt{1 + x}}} \]
      2. +-commutative99.3%

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

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot \left({x}^{-0.5} \cdot {x}^{-0.5}\right)\right) \cdot {\left(1 + x\right)}^{\color{blue}{-0.5}} \]
      11. associate-*l*99.0%

        \[\leadsto \color{blue}{0.5 \cdot \left(\left({x}^{-0.5} \cdot {x}^{-0.5}\right) \cdot {\left(1 + x\right)}^{-0.5}\right)} \]
      12. pow-prod-up99.4%

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

        \[\leadsto 0.5 \cdot \left({x}^{\color{blue}{-1}} \cdot {\left(1 + x\right)}^{-0.5}\right) \]
      14. inv-pow99.4%

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

        \[\leadsto 0.5 \cdot \left(\frac{1}{x} \cdot {\color{blue}{\left(x + 1\right)}}^{-0.5}\right) \]
    12. Applied egg-rr99.4%

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

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

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

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

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

Alternative 9: 98.2% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 99.5%

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

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

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

        \[\leadsto \left(-\color{blue}{\sqrt{\frac{1}{\sqrt{x + 1}}} \cdot \sqrt{\frac{1}{\sqrt{x + 1}}}}\right) + \frac{1}{\sqrt{x}} \]
      4. distribute-rgt-neg-in99.5%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\sqrt{{\left(1 + x\right)}^{\color{blue}{-0.5}}}, -\sqrt{\frac{1}{\sqrt{x + 1}}}, \frac{1}{\sqrt{x}}\right) \]
      10. inv-pow99.5%

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

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

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

        \[\leadsto \mathsf{fma}\left(\sqrt{{\left(1 + x\right)}^{-0.5}}, -\sqrt{{\left(1 + x\right)}^{\color{blue}{-0.5}}}, \frac{1}{\sqrt{x}}\right) \]
      14. pow1/299.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{{\left(1 + x\right)}^{-0.5}}, -\sqrt{{\left(1 + x\right)}^{-0.5}}, {x}^{-0.5}\right)} \]
    4. Taylor expanded in x around 0 97.9%

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

    if 0.47999999999999998 < x

    1. Initial program 47.2%

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

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      3. *-un-lft-identity47.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\left({\left(\sqrt{x}\right)}^{-0.5}\right)}^{2} \cdot \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      6. associate-*r/48.3%

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

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

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

        \[\leadsto \frac{\frac{{\color{blue}{x}}^{-0.5} \cdot \left(\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}\right)}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{1 + x}} \]
      10. add-sqr-sqrt30.1%

        \[\leadsto \frac{\frac{{x}^{-0.5} \cdot \left(\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}\right)}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{1 + x}} \]
      11. add-sqr-sqrt49.1%

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

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

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

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

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

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\frac{\sqrt{1 + x} + \sqrt{x}}{\color{blue}{1}}}}{\sqrt{1 + x}} \]
      4. /-rgt-identity99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      5. +-commutative99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    9. Simplified99.5%

      \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    10. Taylor expanded in x around inf 99.4%

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

        \[\leadsto \color{blue}{\frac{0.5}{x} \cdot \frac{1}{\sqrt{1 + x}}} \]
      2. +-commutative99.3%

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

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot \left({x}^{-0.5} \cdot {x}^{-0.5}\right)\right) \cdot {\left(1 + x\right)}^{\color{blue}{-0.5}} \]
      11. associate-*l*99.0%

        \[\leadsto \color{blue}{0.5 \cdot \left(\left({x}^{-0.5} \cdot {x}^{-0.5}\right) \cdot {\left(1 + x\right)}^{-0.5}\right)} \]
      12. pow-prod-up99.4%

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

        \[\leadsto 0.5 \cdot \left({x}^{\color{blue}{-1}} \cdot {\left(1 + x\right)}^{-0.5}\right) \]
      14. inv-pow99.4%

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

        \[\leadsto 0.5 \cdot \left(\frac{1}{x} \cdot {\color{blue}{\left(x + 1\right)}}^{-0.5}\right) \]
    12. Applied egg-rr99.4%

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

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

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

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

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

Alternative 10: 98.6% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 99.5%

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

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

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

        \[\leadsto \left(-\color{blue}{\sqrt{\frac{1}{\sqrt{x + 1}}} \cdot \sqrt{\frac{1}{\sqrt{x + 1}}}}\right) + \frac{1}{\sqrt{x}} \]
      4. distribute-rgt-neg-in99.5%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\sqrt{{\left(1 + x\right)}^{\color{blue}{-0.5}}}, -\sqrt{\frac{1}{\sqrt{x + 1}}}, \frac{1}{\sqrt{x}}\right) \]
      10. inv-pow99.5%

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

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

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

        \[\leadsto \mathsf{fma}\left(\sqrt{{\left(1 + x\right)}^{-0.5}}, -\sqrt{{\left(1 + x\right)}^{\color{blue}{-0.5}}}, \frac{1}{\sqrt{x}}\right) \]
      14. pow1/299.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{{\left(1 + x\right)}^{-0.5}}, -\sqrt{{\left(1 + x\right)}^{-0.5}}, {x}^{-0.5}\right)} \]
    4. Taylor expanded in x around 0 98.8%

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

    if 0.69999999999999996 < x

    1. Initial program 47.2%

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

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      3. *-un-lft-identity47.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\left({\left(\sqrt{x}\right)}^{-0.5}\right)}^{2} \cdot \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      6. associate-*r/48.3%

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

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

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

        \[\leadsto \frac{\frac{{\color{blue}{x}}^{-0.5} \cdot \left(\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}\right)}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{1 + x}} \]
      10. add-sqr-sqrt30.1%

        \[\leadsto \frac{\frac{{x}^{-0.5} \cdot \left(\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}\right)}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{1 + x}} \]
      11. add-sqr-sqrt49.1%

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

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

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

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

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

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\frac{\sqrt{1 + x} + \sqrt{x}}{\color{blue}{1}}}}{\sqrt{1 + x}} \]
      4. /-rgt-identity99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      5. +-commutative99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    9. Simplified99.5%

      \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    10. Taylor expanded in x around inf 99.4%

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

        \[\leadsto \color{blue}{\frac{0.5}{x} \cdot \frac{1}{\sqrt{1 + x}}} \]
      2. +-commutative99.3%

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

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot \left({x}^{-0.5} \cdot {x}^{-0.5}\right)\right) \cdot {\left(1 + x\right)}^{\color{blue}{-0.5}} \]
      11. associate-*l*99.0%

        \[\leadsto \color{blue}{0.5 \cdot \left(\left({x}^{-0.5} \cdot {x}^{-0.5}\right) \cdot {\left(1 + x\right)}^{-0.5}\right)} \]
      12. pow-prod-up99.4%

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

        \[\leadsto 0.5 \cdot \left({x}^{\color{blue}{-1}} \cdot {\left(1 + x\right)}^{-0.5}\right) \]
      14. inv-pow99.4%

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

        \[\leadsto 0.5 \cdot \left(\frac{1}{x} \cdot {\color{blue}{\left(x + 1\right)}}^{-0.5}\right) \]
    12. Applied egg-rr99.4%

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

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

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

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

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

Alternative 11: 98.2% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 99.5%

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

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

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

        \[\leadsto \left(-\color{blue}{\sqrt{\frac{1}{\sqrt{x + 1}}} \cdot \sqrt{\frac{1}{\sqrt{x + 1}}}}\right) + \frac{1}{\sqrt{x}} \]
      4. distribute-rgt-neg-in99.5%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\sqrt{{\left(1 + x\right)}^{\color{blue}{-0.5}}}, -\sqrt{\frac{1}{\sqrt{x + 1}}}, \frac{1}{\sqrt{x}}\right) \]
      10. inv-pow99.5%

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

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

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

        \[\leadsto \mathsf{fma}\left(\sqrt{{\left(1 + x\right)}^{-0.5}}, -\sqrt{{\left(1 + x\right)}^{\color{blue}{-0.5}}}, \frac{1}{\sqrt{x}}\right) \]
      14. pow1/299.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{{\left(1 + x\right)}^{-0.5}}, -\sqrt{{\left(1 + x\right)}^{-0.5}}, {x}^{-0.5}\right)} \]
    4. Taylor expanded in x around 0 97.9%

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

    if 0.47999999999999998 < x

    1. Initial program 47.2%

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

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      3. *-un-lft-identity47.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\left({\left(\sqrt{x}\right)}^{-0.5}\right)}^{2} \cdot \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      6. associate-*r/48.3%

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

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

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

        \[\leadsto \frac{\frac{{\color{blue}{x}}^{-0.5} \cdot \left(\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}\right)}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{1 + x}} \]
      10. add-sqr-sqrt30.1%

        \[\leadsto \frac{\frac{{x}^{-0.5} \cdot \left(\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}\right)}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{1 + x}} \]
      11. add-sqr-sqrt49.1%

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

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

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

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

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

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\frac{\sqrt{1 + x} + \sqrt{x}}{\color{blue}{1}}}}{\sqrt{1 + x}} \]
      4. /-rgt-identity99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      5. +-commutative99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    9. Simplified99.5%

      \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    10. Taylor expanded in x around inf 99.4%

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

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

Alternative 12: 68.5% accurate, 2.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5}{x}}{1 + x \cdot 0.5}\\


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

    1. Initial program 99.5%

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

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

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

        \[\leadsto \left(-\color{blue}{\sqrt{\frac{1}{\sqrt{x + 1}}} \cdot \sqrt{\frac{1}{\sqrt{x + 1}}}}\right) + \frac{1}{\sqrt{x}} \]
      4. distribute-rgt-neg-in99.5%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\sqrt{{\left(1 + x\right)}^{\color{blue}{-0.5}}}, -\sqrt{\frac{1}{\sqrt{x + 1}}}, \frac{1}{\sqrt{x}}\right) \]
      10. inv-pow99.5%

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

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

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

        \[\leadsto \mathsf{fma}\left(\sqrt{{\left(1 + x\right)}^{-0.5}}, -\sqrt{{\left(1 + x\right)}^{\color{blue}{-0.5}}}, \frac{1}{\sqrt{x}}\right) \]
      14. pow1/299.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{{\left(1 + x\right)}^{-0.5}}, -\sqrt{{\left(1 + x\right)}^{-0.5}}, {x}^{-0.5}\right)} \]
    4. Taylor expanded in x around 0 97.9%

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

    if 0.47999999999999998 < x

    1. Initial program 47.2%

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

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      3. *-un-lft-identity47.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\left({\left(\sqrt{x}\right)}^{-0.5}\right)}^{2} \cdot \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      6. associate-*r/48.3%

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

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

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

        \[\leadsto \frac{\frac{{\color{blue}{x}}^{-0.5} \cdot \left(\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}\right)}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{1 + x}} \]
      10. add-sqr-sqrt30.1%

        \[\leadsto \frac{\frac{{x}^{-0.5} \cdot \left(\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}\right)}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{1 + x}} \]
      11. add-sqr-sqrt49.1%

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

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

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

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

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

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\frac{\sqrt{1 + x} + \sqrt{x}}{\color{blue}{1}}}}{\sqrt{1 + x}} \]
      4. /-rgt-identity99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      5. +-commutative99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    9. Simplified99.5%

      \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    10. Taylor expanded in x around inf 99.4%

      \[\leadsto \frac{\color{blue}{\frac{0.5}{x}}}{\sqrt{1 + x}} \]
    11. Taylor expanded in x around 0 48.2%

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

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

Alternative 13: 29.2% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.112:\\
\;\;\;\;\sqrt{\frac{2}{x}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5}{x}}{1 + x \cdot 0.5}\\


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

    1. Initial program 99.5%

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

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      2. div-inv99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{1}{x} + \frac{1}{1 + x}}} \]
    7. Taylor expanded in x around inf 20.3%

      \[\leadsto \sqrt{\color{blue}{\frac{2}{x}}} \]

    if 0.112000000000000002 < x

    1. Initial program 47.7%

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

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

        \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      3. *-un-lft-identity47.9%

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

        \[\leadsto \left(\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      5. *-rgt-identity47.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{\left({\left(\sqrt{x}\right)}^{-0.5}\right)}^{2} \cdot \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      6. associate-*r/48.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\frac{\sqrt{1 + x} + \sqrt{x}}{\color{blue}{1}}}}{\sqrt{1 + x}} \]
      4. /-rgt-identity99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
      5. +-commutative99.5%

        \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    9. Simplified99.5%

      \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
    10. Taylor expanded in x around inf 98.8%

      \[\leadsto \frac{\color{blue}{\frac{0.5}{x}}}{\sqrt{1 + x}} \]
    11. Taylor expanded in x around 0 48.0%

      \[\leadsto \frac{\frac{0.5}{x}}{\color{blue}{0.5 \cdot x + 1}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification34.4%

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

Alternative 14: 22.5% accurate, 23.2× speedup?

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

\\
\frac{\frac{0.5}{x}}{1 + x \cdot 0.5}
\end{array}
Derivation
  1. Initial program 73.2%

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

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

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    3. *-un-lft-identity73.3%

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

      \[\leadsto \left(\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    5. *-rgt-identity73.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{{\left({\left(\sqrt{x}\right)}^{-0.5}\right)}^{2} \cdot \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
    6. associate-*r/73.5%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{x}^{-0.5}}{\frac{\sqrt{1 + x} + \sqrt{x}}{\color{blue}{1}}}}{\sqrt{1 + x}} \]
    4. /-rgt-identity99.6%

      \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
    5. +-commutative99.6%

      \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
  9. Simplified99.6%

    \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
  10. Taylor expanded in x around inf 53.6%

    \[\leadsto \frac{\color{blue}{\frac{0.5}{x}}}{\sqrt{1 + x}} \]
  11. Taylor expanded in x around 0 27.8%

    \[\leadsto \frac{\frac{0.5}{x}}{\color{blue}{0.5 \cdot x + 1}} \]
  12. Final simplification27.8%

    \[\leadsto \frac{\frac{0.5}{x}}{1 + x \cdot 0.5} \]

Alternative 15: 4.8% accurate, 41.8× speedup?

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

\\
\frac{0.5}{x} + -0.25
\end{array}
Derivation
  1. Initial program 73.2%

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

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

      \[\leadsto \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    3. *-un-lft-identity73.3%

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

      \[\leadsto \left(\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    5. *-rgt-identity73.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{{\left({\left(\sqrt{x}\right)}^{-0.5}\right)}^{2} \cdot \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
    6. associate-*r/73.5%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{x}^{-0.5}}{\frac{\sqrt{1 + x} + \sqrt{x}}{\color{blue}{1}}}}{\sqrt{1 + x}} \]
    4. /-rgt-identity99.6%

      \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{1 + x}} \]
    5. +-commutative99.6%

      \[\leadsto \frac{\frac{{x}^{-0.5}}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
  9. Simplified99.6%

    \[\leadsto \frac{\color{blue}{\frac{{x}^{-0.5}}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{1 + x}} \]
  10. Taylor expanded in x around inf 53.6%

    \[\leadsto \frac{\color{blue}{\frac{0.5}{x}}}{\sqrt{1 + x}} \]
  11. Taylor expanded in x around 0 4.9%

    \[\leadsto \color{blue}{0.5 \cdot \frac{1}{x} - 0.25} \]
  12. Step-by-step derivation
    1. sub-neg4.9%

      \[\leadsto \color{blue}{0.5 \cdot \frac{1}{x} + \left(-0.25\right)} \]
    2. associate-*r/4.9%

      \[\leadsto \color{blue}{\frac{0.5 \cdot 1}{x}} + \left(-0.25\right) \]
    3. metadata-eval4.9%

      \[\leadsto \frac{\color{blue}{0.5}}{x} + \left(-0.25\right) \]
    4. metadata-eval4.9%

      \[\leadsto \frac{0.5}{x} + \color{blue}{-0.25} \]
  13. Simplified4.9%

    \[\leadsto \color{blue}{\frac{0.5}{x} + -0.25} \]
  14. Final simplification4.9%

    \[\leadsto \frac{0.5}{x} + -0.25 \]

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 2023249 
(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)))))