2isqrt (example 3.6)

Percentage Accurate: 69.7% → 99.3%
Time: 14.2s
Alternatives: 11
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 11 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.7% 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.3% accurate, 0.5× speedup?

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

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

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


\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)))) < 4.9999999999999999e-17

    1. Initial program 27.5%

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

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      2. div-inv27.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-identity27.5%

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

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

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

        \[\leadsto \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{\color{blue}{1 \cdot 1}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      7. frac-times27.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-inv27.5%

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

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

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

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

        \[\leadsto \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{{x}^{-0.5}}{\sqrt{\color{blue}{1 + x}}} \]
    3. Applied egg-rr27.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/27.5%

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{1 + x}} \cdot \frac{{x}^{-0.5}}{1}} \]
      4. div-sub27.5%

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

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

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

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

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

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

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\sqrt{1 + e^{\log x \cdot 0.5} \cdot {x}^{\color{blue}{0.5}}}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      11. exp-to-pow4.9%

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\sqrt{1 + e^{\log x \cdot 0.5} \cdot \color{blue}{e^{\log x \cdot 0.5}}}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      12. hypot-1-def4.9%

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\color{blue}{\mathsf{hypot}\left(1, e^{\log x \cdot 0.5}\right)}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      13. exp-to-pow27.5%

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \color{blue}{{x}^{0.5}}\right)}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      14. unpow1/227.5%

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{x}}\right)}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      15. /-rgt-identity27.5%

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

      \[\leadsto \color{blue}{\left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \sqrt{x}\right)}\right) \cdot {x}^{-0.5}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity27.5%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{0.5}{x} - \frac{0.375}{\color{blue}{x \cdot x}}\right) \cdot {x}^{-0.5} \]
    12. Simplified99.7%

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

    if 4.9999999999999999e-17 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1))))

    1. Initial program 99.4%

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

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

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

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

        \[\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.4%

        \[\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.4%

        \[\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.4%

        \[\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.4%

        \[\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-pow299.8%

        \[\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-eval99.8%

        \[\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/299.8%

        \[\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-flip99.8%

        \[\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. +-commutative99.8%

        \[\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-eval99.8%

        \[\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-rr99.8%

      \[\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-udef99.8%

        \[\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. neg-mul-199.8%

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \left(\color{blue}{\left(-{\left(1 + x\right)}^{-0.5}\right)} + {\left(1 + x\right)}^{-0.5}\right) \]
      3. rem-log-exp99.7%

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \left(\left(-\color{blue}{\log \left(e^{{\left(1 + x\right)}^{-0.5}}\right)}\right) + {\left(1 + x\right)}^{-0.5}\right) \]
      4. log-rec99.7%

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

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

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \left({\left(1 + x\right)}^{-0.5} + \color{blue}{\left(-\log \left(e^{{\left(1 + x\right)}^{-0.5}}\right)\right)}\right) \]
      7. rem-log-exp99.8%

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

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

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

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

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

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

Alternative 2: 98.8% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 99.6%

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

      \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{1 + 0.5 \cdot x}} \]
    3. Step-by-step derivation
      1. *-commutative98.3%

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

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

    if 1.44999999999999996 < x

    1. Initial program 29.6%

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

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      2. div-inv29.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-identity29.6%

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

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

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

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

        \[\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-inv29.7%

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

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

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

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

        \[\leadsto \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{{x}^{-0.5}}{\sqrt{\color{blue}{1 + x}}} \]
    3. Applied egg-rr29.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/29.7%

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

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

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

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

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

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

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

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

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\sqrt{1 + \color{blue}{e^{\log x \cdot 0.5}} \cdot {x}^{\left(\frac{1}{2}\right)}}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      10. metadata-eval7.9%

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\sqrt{1 + e^{\log x \cdot 0.5} \cdot {x}^{\color{blue}{0.5}}}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      11. exp-to-pow7.7%

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

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\color{blue}{\mathsf{hypot}\left(1, e^{\log x \cdot 0.5}\right)}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      13. exp-to-pow29.6%

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \color{blue}{{x}^{0.5}}\right)}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      14. unpow1/229.6%

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{x}}\right)}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      15. /-rgt-identity29.6%

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

      \[\leadsto \color{blue}{\left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \sqrt{x}\right)}\right) \cdot {x}^{-0.5}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity29.6%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(0.5 \cdot \frac{1}{x} - 0.375 \cdot \frac{1}{{x}^{2}}\right)} \cdot {x}^{-0.5} \]
    11. Step-by-step derivation
      1. associate-*r/97.5%

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

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

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

        \[\leadsto \left(\frac{0.5}{x} - \frac{\color{blue}{0.375}}{{x}^{2}}\right) \cdot {x}^{-0.5} \]
      5. unpow297.5%

        \[\leadsto \left(\frac{0.5}{x} - \frac{0.375}{\color{blue}{x \cdot x}}\right) \cdot {x}^{-0.5} \]
    12. Simplified97.5%

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

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

Alternative 3: 98.3% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 99.6%

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

      \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{1 + 0.5 \cdot x}} \]
    3. Step-by-step derivation
      1. *-commutative98.3%

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

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

    if 1.69999999999999996 < x

    1. Initial program 29.6%

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

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      2. div-inv29.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-identity29.6%

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

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

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

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

        \[\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-inv29.7%

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

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

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

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

        \[\leadsto \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{{x}^{-0.5}}{\sqrt{\color{blue}{1 + x}}} \]
    3. Applied egg-rr29.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/29.7%

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

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

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

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

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

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

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

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

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\sqrt{1 + \color{blue}{e^{\log x \cdot 0.5}} \cdot {x}^{\left(\frac{1}{2}\right)}}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      10. metadata-eval7.9%

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\sqrt{1 + e^{\log x \cdot 0.5} \cdot {x}^{\color{blue}{0.5}}}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      11. exp-to-pow7.7%

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

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\color{blue}{\mathsf{hypot}\left(1, e^{\log x \cdot 0.5}\right)}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      13. exp-to-pow29.6%

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \color{blue}{{x}^{0.5}}\right)}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      14. unpow1/229.6%

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{x}}\right)}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      15. /-rgt-identity29.6%

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

      \[\leadsto \color{blue}{\left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \sqrt{x}\right)}\right) \cdot {x}^{-0.5}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity29.6%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.5}{x}} \cdot {x}^{-0.5} \]
    11. Step-by-step derivation
      1. associate-*l/97.1%

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

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

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

Alternative 4: 98.3% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 99.6%

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

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

    if 1 < x

    1. Initial program 29.6%

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

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      2. div-inv29.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-identity29.6%

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

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

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

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

        \[\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-inv29.7%

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

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

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

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

        \[\leadsto \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{{x}^{-0.5}}{\sqrt{\color{blue}{1 + x}}} \]
    3. Applied egg-rr29.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/29.7%

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

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

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

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

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

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

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

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

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\sqrt{1 + \color{blue}{e^{\log x \cdot 0.5}} \cdot {x}^{\left(\frac{1}{2}\right)}}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      10. metadata-eval7.9%

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\sqrt{1 + e^{\log x \cdot 0.5} \cdot {x}^{\color{blue}{0.5}}}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      11. exp-to-pow7.7%

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

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\color{blue}{\mathsf{hypot}\left(1, e^{\log x \cdot 0.5}\right)}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      13. exp-to-pow29.6%

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \color{blue}{{x}^{0.5}}\right)}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      14. unpow1/229.6%

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{x}}\right)}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      15. /-rgt-identity29.6%

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

      \[\leadsto \color{blue}{\left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \sqrt{x}\right)}\right) \cdot {x}^{-0.5}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity29.6%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.5}{x}} \cdot {x}^{-0.5} \]
    11. Step-by-step derivation
      1. associate-*l/97.1%

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

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

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

Alternative 5: 98.1% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 99.6%

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

      \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{1} \]
    3. Step-by-step derivation
      1. add-log-exp5.4%

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

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

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

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

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

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

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

        \[\leadsto \left(0 + {x}^{\color{blue}{-0.5}}\right) - 1 \]
    4. Applied egg-rr97.9%

      \[\leadsto \color{blue}{\left(0 + {x}^{-0.5}\right)} - 1 \]
    5. Step-by-step derivation
      1. +-lft-identity97.9%

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

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

    if 0.680000000000000049 < x

    1. Initial program 29.6%

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

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      2. div-inv29.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-identity29.6%

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

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

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

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

        \[\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-inv29.7%

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

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

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

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

        \[\leadsto \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{{x}^{-0.5}}{\sqrt{\color{blue}{1 + x}}} \]
    3. Applied egg-rr29.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/29.7%

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

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

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

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

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

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

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

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

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\sqrt{1 + \color{blue}{e^{\log x \cdot 0.5}} \cdot {x}^{\left(\frac{1}{2}\right)}}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      10. metadata-eval7.9%

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\sqrt{1 + e^{\log x \cdot 0.5} \cdot {x}^{\color{blue}{0.5}}}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      11. exp-to-pow7.7%

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

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\color{blue}{\mathsf{hypot}\left(1, e^{\log x \cdot 0.5}\right)}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      13. exp-to-pow29.6%

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \color{blue}{{x}^{0.5}}\right)}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      14. unpow1/229.6%

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{x}}\right)}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      15. /-rgt-identity29.6%

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

      \[\leadsto \color{blue}{\left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \sqrt{x}\right)}\right) \cdot {x}^{-0.5}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity29.6%

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

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

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

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

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

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

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

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

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

Alternative 6: 98.2% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 99.6%

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

      \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{1} \]
    3. Step-by-step derivation
      1. add-log-exp5.4%

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

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

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

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

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

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

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

        \[\leadsto \left(0 + {x}^{\color{blue}{-0.5}}\right) - 1 \]
    4. Applied egg-rr97.9%

      \[\leadsto \color{blue}{\left(0 + {x}^{-0.5}\right)} - 1 \]
    5. Step-by-step derivation
      1. +-lft-identity97.9%

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

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

    if 0.680000000000000049 < x

    1. Initial program 29.6%

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

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      2. div-inv29.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-identity29.6%

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

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

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

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

        \[\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-inv29.7%

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

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

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

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

        \[\leadsto \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{{x}^{-0.5}}{\sqrt{\color{blue}{1 + x}}} \]
    3. Applied egg-rr29.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/29.7%

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

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

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

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

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

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

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

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

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\sqrt{1 + \color{blue}{e^{\log x \cdot 0.5}} \cdot {x}^{\left(\frac{1}{2}\right)}}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      10. metadata-eval7.9%

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\sqrt{1 + e^{\log x \cdot 0.5} \cdot {x}^{\color{blue}{0.5}}}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      11. exp-to-pow7.7%

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

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\color{blue}{\mathsf{hypot}\left(1, e^{\log x \cdot 0.5}\right)}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      13. exp-to-pow29.6%

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \color{blue}{{x}^{0.5}}\right)}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      14. unpow1/229.6%

        \[\leadsto \left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{x}}\right)}\right) \cdot \frac{{x}^{-0.5}}{1} \]
      15. /-rgt-identity29.6%

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

      \[\leadsto \color{blue}{\left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \sqrt{x}\right)}\right) \cdot {x}^{-0.5}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity29.6%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.5}{x}} \cdot {x}^{-0.5} \]
    11. Step-by-step derivation
      1. associate-*l/97.1%

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

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

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

Alternative 7: 67.3% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 99.6%

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

      \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{1} \]
    3. Step-by-step derivation
      1. add-log-exp5.4%

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

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

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

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

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

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

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

        \[\leadsto \left(0 + {x}^{\color{blue}{-0.5}}\right) - 1 \]
    4. Applied egg-rr97.1%

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

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

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

    if 4 < x

    1. Initial program 29.0%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. pow1/229.0%

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

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

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

        \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{e^{\color{blue}{\mathsf{log1p}\left(x\right)} \cdot 0.5}} \]
    3. Applied egg-rr6.9%

      \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{e^{\mathsf{log1p}\left(x\right) \cdot 0.5}}} \]
    4. Taylor expanded in x around inf 3.1%

      \[\leadsto \color{blue}{-1 \cdot \sqrt{\frac{1}{x}}} \]
    5. Step-by-step derivation
      1. mul-1-neg3.1%

        \[\leadsto \color{blue}{-\sqrt{\frac{1}{x}}} \]
    6. Simplified3.1%

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

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

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

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

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

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

        \[\leadsto -{\left(x \cdot x\right)}^{\color{blue}{-0.25}} \]
    8. Applied egg-rr25.2%

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

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

Alternative 8: 51.1% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(0 + {x}^{\color{blue}{-0.5}}\right) - 1 \]
  4. Applied egg-rr50.6%

    \[\leadsto \color{blue}{\left(0 + {x}^{-0.5}\right)} - 1 \]
  5. Step-by-step derivation
    1. +-lft-identity50.6%

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

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

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

Alternative 9: 2.1% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\sqrt{x}} - e^{\mathsf{log1p}\left(x\right) \cdot \color{blue}{-0.5}} \]
  3. Applied egg-rr53.9%

    \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{e^{\mathsf{log1p}\left(x\right) \cdot -0.5}} \]
  4. Taylor expanded in x around inf 2.1%

    \[\leadsto \color{blue}{-1 \cdot \sqrt{\frac{1}{x}}} \]
  5. Step-by-step derivation
    1. mul-1-neg2.1%

      \[\leadsto \color{blue}{-\sqrt{\frac{1}{x}}} \]
    2. unpow1/22.1%

      \[\leadsto -\color{blue}{{\left(\frac{1}{x}\right)}^{0.5}} \]
    3. exp-to-pow2.1%

      \[\leadsto -\color{blue}{e^{\log \left(\frac{1}{x}\right) \cdot 0.5}} \]
    4. log-rec2.1%

      \[\leadsto -e^{\color{blue}{\left(-\log x\right)} \cdot 0.5} \]
    5. distribute-lft-neg-out2.1%

      \[\leadsto -e^{\color{blue}{-\log x \cdot 0.5}} \]
    6. distribute-rgt-neg-in2.1%

      \[\leadsto -e^{\color{blue}{\log x \cdot \left(-0.5\right)}} \]
    7. metadata-eval2.1%

      \[\leadsto -e^{\log x \cdot \color{blue}{-0.5}} \]
    8. exp-to-pow2.1%

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

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

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

Alternative 10: 51.1% accurate, 2.0× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. div-inv64.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-identity64.9%

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

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

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

      \[\leadsto \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{\color{blue}{1 \cdot 1}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    7. frac-times64.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-inv64.9%

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

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

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

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

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

    \[\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/65.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(1 - \frac{\sqrt{x}}{\sqrt{1 + e^{\log x \cdot 0.5} \cdot {x}^{\color{blue}{0.5}}}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
    11. exp-to-pow54.2%

      \[\leadsto \left(1 - \frac{\sqrt{x}}{\sqrt{1 + e^{\log x \cdot 0.5} \cdot \color{blue}{e^{\log x \cdot 0.5}}}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
    12. hypot-1-def54.2%

      \[\leadsto \left(1 - \frac{\sqrt{x}}{\color{blue}{\mathsf{hypot}\left(1, e^{\log x \cdot 0.5}\right)}}\right) \cdot \frac{{x}^{-0.5}}{1} \]
    13. exp-to-pow65.1%

      \[\leadsto \left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \color{blue}{{x}^{0.5}}\right)}\right) \cdot \frac{{x}^{-0.5}}{1} \]
    14. unpow1/265.1%

      \[\leadsto \left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{x}}\right)}\right) \cdot \frac{{x}^{-0.5}}{1} \]
    15. /-rgt-identity65.1%

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

    \[\leadsto \color{blue}{\left(1 - \frac{\sqrt{x}}{\mathsf{hypot}\left(1, \sqrt{x}\right)}\right) \cdot {x}^{-0.5}} \]
  6. Taylor expanded in x around 0 50.2%

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

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

Alternative 11: 1.9% accurate, 209.0× speedup?

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{\frac{1}{\sqrt{x}}}, \sqrt[3]{\frac{1}{\sqrt{x}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x}}}, -\frac{1}{\sqrt{x + 1}}\right)} \]
    4. pow1/253.1%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\sqrt[3]{{x}^{-0.5}}, \sqrt[3]{\frac{\color{blue}{1}}{\sqrt{x} \cdot \sqrt{x}}}, -\frac{1}{\sqrt{x + 1}}\right) \]
    10. add-sqr-sqrt53.5%

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

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

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

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

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

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

    \[\leadsto -1 \]

Developer target: 98.8% 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 2023285 
(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)))))