2isqrt (example 3.6)

Percentage Accurate: 68.9% → 99.8%
Time: 11.3s
Alternatives: 15
Speedup: 1.0×

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: 68.9% 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.4× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{x + 1}\\
t_1 := t_0 + \sqrt{x}\\
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{t_0} \leq 0:\\
\;\;\;\;\frac{\frac{1 + \left(x - x\right)}{t_1}}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{t_1} \cdot {\left(x + x \cdot 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)))) < 0.0

    1. Initial program 38.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{x}} \cdot \frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u38.2%

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\left(x + 1\right) - x}}{x \cdot \left(\sqrt{x + 1} + \sqrt{x}\right)}\right)} - 1 \]
      5. associate--l+38.2%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 96.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\sqrt{x \cdot \left(1 + x\right)}} \cdot \color{blue}{\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}} \]
    8. Taylor expanded in x around 0 99.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(x + x \cdot x\right)}^{-0.5}} \cdot \frac{1}{\sqrt{x + 1} + \sqrt{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:\\ \;\;\;\;\frac{\frac{1 + \left(x - x\right)}{\sqrt{x + 1} + \sqrt{x}}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}} \cdot {\left(x + x \cdot x\right)}^{-0.5}\\ \end{array} \]

Alternative 2: 99.7% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} - {\left(x + 1\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)))) < 2.00000000000000016e-5

    1. Initial program 39.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\sqrt{x \cdot \left(1 + x\right)}} \cdot \color{blue}{\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}} \]
    8. Taylor expanded in x around 0 84.7%

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

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

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

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

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

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

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

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

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

    if 2.00000000000000016e-5 < (-.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. *-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}} \]
  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^{-5}:\\ \;\;\;\;\frac{1}{\sqrt{x + 1} + \sqrt{x}} \cdot \frac{1}{\left(0.5 + \left(x + \frac{0.0625}{x \cdot x}\right)\right) - \frac{0.125}{x}}\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.5} - {\left(x + 1\right)}^{-0.5}\\ \end{array} \]

Alternative 3: 99.7% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} - {\left(x + 1\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)))) < 9.99999999999999955e-7

    1. Initial program 39.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\sqrt{x \cdot \left(1 + x\right)}} \cdot \color{blue}{\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}} \]
    8. Taylor expanded in x around 0 84.5%

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

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

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

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

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

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

    if 9.99999999999999955e-7 < (-.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. *-un-lft-identity99.2%

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

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

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

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

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

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

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

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

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

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

        \[\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. distribute-lft1-in99.8%

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

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

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{0} \]
      5. +-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.6%

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

Alternative 4: 99.6% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} - {\left(x + 1\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)))) < 2.00000000000000007e-10

    1. Initial program 38.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\sqrt{x \cdot \left(1 + x\right)}} \cdot \color{blue}{\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}} \]
    8. Taylor expanded in x around 0 84.3%

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

      \[\leadsto \frac{1}{\color{blue}{0.5 + x}} \cdot \frac{1}{\sqrt{x + 1} + \sqrt{x}} \]
    10. Step-by-step derivation
      1. +-commutative99.5%

        \[\leadsto \frac{1}{\color{blue}{x + 0.5}} \cdot \frac{1}{\sqrt{x + 1} + \sqrt{x}} \]
    11. Simplified99.5%

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

    if 2.00000000000000007e-10 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1))))

    1. Initial program 99.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 99.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{x + 1}\\
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{t_0} \leq 4 \cdot 10^{-15}:\\
\;\;\;\;\frac{1}{t_0 + \sqrt{x}} \cdot \frac{1}{x}\\

\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} - {\left(x + 1\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.0000000000000003e-15

    1. Initial program 38.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\sqrt{x \cdot \left(1 + x\right)}} \cdot \color{blue}{\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}} \]
    8. Taylor expanded in x around 0 84.1%

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

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

    if 4.0000000000000003e-15 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1))))

    1. Initial program 98.5%

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

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

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

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]
      4. prod-diff98.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-identity98.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-neg98.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-identity98.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-pow98.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-pow299.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-eval99.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/299.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-flip99.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. +-commutative99.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-eval99.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-rr99.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-udef99.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-in99.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-eval99.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-lft99.0%

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

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

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

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

Alternative 6: 99.6% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{\sqrt{x \cdot \left(1 + x\right)}} \cdot \color{blue}{\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}} \]
  8. Taylor expanded in x around 0 91.5%

    \[\leadsto \frac{1}{\sqrt{x \cdot \left(1 + x\right)}} \cdot \frac{\color{blue}{1}}{\sqrt{x + 1} + \sqrt{x}} \]
  9. Step-by-step derivation
    1. inv-pow91.5%

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

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

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

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

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

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

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

Alternative 7: 99.6% accurate, 0.5× speedup?

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

\\
\frac{\frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right)}}{\sqrt{x + 1} + \sqrt{x}}
\end{array}
Derivation
  1. Initial program 67.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{\sqrt{x \cdot \left(1 + x\right)}} \cdot \color{blue}{\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}} \]
  8. Taylor expanded in x around 0 91.5%

    \[\leadsto \frac{1}{\sqrt{x \cdot \left(1 + x\right)}} \cdot \frac{\color{blue}{1}}{\sqrt{x + 1} + \sqrt{x}} \]
  9. Step-by-step derivation
    1. un-div-inv91.5%

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

      \[\leadsto \frac{\frac{1}{\sqrt{\color{blue}{1 \cdot x + x \cdot x}}}}{\sqrt{x + 1} + \sqrt{x}} \]
    3. *-un-lft-identity91.5%

      \[\leadsto \frac{\frac{1}{\sqrt{\color{blue}{x} + x \cdot x}}}{\sqrt{x + 1} + \sqrt{x}} \]
    4. add-sqr-sqrt91.5%

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

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

      \[\leadsto \frac{\frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right)}}{\sqrt{\color{blue}{1 + x}} + \sqrt{x}} \]
  10. Applied egg-rr99.5%

    \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right)}}{\sqrt{1 + x} + \sqrt{x}}} \]
  11. Final simplification99.5%

    \[\leadsto \frac{\frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right)}}{\sqrt{x + 1} + \sqrt{x}} \]

Alternative 8: 84.0% accurate, 1.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\\


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

    1. Initial program 98.5%

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

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

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

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]
      4. prod-diff98.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-identity98.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-neg98.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-identity98.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-pow98.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-pow299.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-eval99.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/299.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-flip99.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. +-commutative99.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-eval99.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-rr99.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-udef99.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-in99.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-eval99.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-lft99.0%

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

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

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

    if 1.22e8 < x

    1. Initial program 38.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 82.9% accurate, 1.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\\


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

    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}} \]
    6. Taylor expanded in x around 0 99.8%

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

    if 1 < x

    1. Initial program 40.1%

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

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

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

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

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

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

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

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

        \[\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-pow234.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-eval34.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/234.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-flip40.2%

        \[\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. +-commutative40.2%

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 67.6% accurate, 1.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0\\


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

    1. Initial program 79.1%

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

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

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

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

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

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

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

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

        \[\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-pow279.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-eval79.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/279.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-flip79.6%

        \[\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. +-commutative79.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}} \]
    6. Taylor expanded in x around 0 76.1%

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

    if 8.1999999999999997e76 < x

    1. Initial program 48.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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. +-commutative48.3%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}} \]
    6. Step-by-step derivation
      1. metadata-eval48.3%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {x}^{-0.5} - \color{blue}{{\left({\left(x + 1\right)}^{0.25}\right)}^{-1} \cdot {\left({\left(x + 1\right)}^{0.25}\right)}^{-1}} \]
    8. Step-by-step derivation
      1. pow-sqr27.6%

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

        \[\leadsto {x}^{-0.5} - {\left({\left(x + 1\right)}^{0.25}\right)}^{\color{blue}{-2}} \]
    9. Simplified27.6%

      \[\leadsto {x}^{-0.5} - \color{blue}{{\left({\left(x + 1\right)}^{0.25}\right)}^{-2}} \]
    10. Taylor expanded in x around inf 48.3%

      \[\leadsto \color{blue}{{\left(\frac{1}{x}\right)}^{0.5} - \sqrt{\frac{1}{x}}} \]
    11. Step-by-step derivation
      1. unpow1/248.3%

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

        \[\leadsto \color{blue}{0} \]
    12. Simplified48.3%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification65.4%

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

Alternative 11: 66.3% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{\sqrt{x \cdot \left(1 + x\right)}} \cdot \color{blue}{\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}} \]
  8. Taylor expanded in x around 0 91.5%

    \[\leadsto \frac{1}{\sqrt{x \cdot \left(1 + x\right)}} \cdot \frac{\color{blue}{1}}{\sqrt{x + 1} + \sqrt{x}} \]
  9. Taylor expanded in x around 0 65.1%

    \[\leadsto \frac{1}{\sqrt{x \cdot \left(1 + x\right)}} \cdot \color{blue}{1} \]
  10. Final simplification65.1%

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

Alternative 12: 66.1% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.5 \cdot 10^{+122}:\\
\;\;\;\;{x}^{-0.5}\\

\mathbf{else}:\\
\;\;\;\;0\\


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

    1. Initial program 70.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {x}^{\color{blue}{-0.5}} \]
      4. expm1-log1p-u62.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({x}^{-0.5}\right)\right)} \]
      5. expm1-udef61.7%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({x}^{-0.5}\right)} - 1} \]
    8. Applied egg-rr61.7%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({x}^{-0.5}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def62.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({x}^{-0.5}\right)\right)} \]
      2. expm1-log1p67.4%

        \[\leadsto \color{blue}{{x}^{-0.5}} \]
    10. Simplified67.4%

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

    if 8.50000000000000003e122 < x

    1. Initial program 59.4%

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

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

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

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]
      4. prod-diff59.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-identity59.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-neg59.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-identity59.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-pow59.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-pow249.6%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}} \]
    6. Step-by-step derivation
      1. metadata-eval59.4%

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

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

        \[\leadsto {x}^{-0.5} - {\color{blue}{\left(\sqrt{\sqrt{1 + x}} \cdot \sqrt{\sqrt{1 + x}}\right)}}^{-1} \]
      4. unpow-prod-down25.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto {x}^{-0.5} - \color{blue}{{\left({\left(x + 1\right)}^{0.25}\right)}^{-1} \cdot {\left({\left(x + 1\right)}^{0.25}\right)}^{-1}} \]
    8. Step-by-step derivation
      1. pow-sqr33.5%

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

        \[\leadsto {x}^{-0.5} - {\left({\left(x + 1\right)}^{0.25}\right)}^{\color{blue}{-2}} \]
    9. Simplified33.5%

      \[\leadsto {x}^{-0.5} - \color{blue}{{\left({\left(x + 1\right)}^{0.25}\right)}^{-2}} \]
    10. Taylor expanded in x around inf 59.4%

      \[\leadsto \color{blue}{{\left(\frac{1}{x}\right)}^{0.5} - \sqrt{\frac{1}{x}}} \]
    11. Step-by-step derivation
      1. unpow1/259.4%

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

        \[\leadsto \color{blue}{0} \]
    12. Simplified59.4%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification64.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 8.5 \cdot 10^{+122}:\\ \;\;\;\;{x}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 13: 22.0% accurate, 41.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 4.6 \cdot 10^{+153}:\\ \;\;\;\;\frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x) :precision binary64 (if (<= x 4.6e+153) (/ 1.0 x) 0.0))
double code(double x) {
	double tmp;
	if (x <= 4.6e+153) {
		tmp = 1.0 / x;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 4.6d+153) then
        tmp = 1.0d0 / x
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 4.6e+153) {
		tmp = 1.0 / x;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 4.6e+153:
		tmp = 1.0 / x
	else:
		tmp = 0.0
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 4.6e+153)
		tmp = Float64(1.0 / x);
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 4.6e+153)
		tmp = 1.0 / x;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 4.6e+153], N[(1.0 / x), $MachinePrecision], 0.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.6 \cdot 10^{+153}:\\
\;\;\;\;\frac{1}{x}\\

\mathbf{else}:\\
\;\;\;\;0\\


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

    1. Initial program 66.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{x}} \cdot \frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}} \]
    9. Taylor expanded in x around 0 7.4%

      \[\leadsto \color{blue}{\frac{1}{x}} \]

    if 4.6000000000000003e153 < x

    1. Initial program 69.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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. +-commutative69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {x}^{-0.5} - {\left({\left(x + 1\right)}^{0.25}\right)}^{-1} \cdot {\left(\sqrt{\color{blue}{{\left(1 + x\right)}^{0.5}}}\right)}^{-1} \]
      10. sqrt-pow127.2%

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

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

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

      \[\leadsto {x}^{-0.5} - \color{blue}{{\left({\left(x + 1\right)}^{0.25}\right)}^{-1} \cdot {\left({\left(x + 1\right)}^{0.25}\right)}^{-1}} \]
    8. Step-by-step derivation
      1. pow-sqr38.7%

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

        \[\leadsto {x}^{-0.5} - {\left({\left(x + 1\right)}^{0.25}\right)}^{\color{blue}{-2}} \]
    9. Simplified38.7%

      \[\leadsto {x}^{-0.5} - \color{blue}{{\left({\left(x + 1\right)}^{0.25}\right)}^{-2}} \]
    10. Taylor expanded in x around inf 69.1%

      \[\leadsto \color{blue}{{\left(\frac{1}{x}\right)}^{0.5} - \sqrt{\frac{1}{x}}} \]
    11. Step-by-step derivation
      1. unpow1/269.1%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} - \sqrt{\frac{1}{x}} \]
      2. +-inverses69.1%

        \[\leadsto \color{blue}{0} \]
    12. Simplified69.1%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification23.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 4.6 \cdot 10^{+153}:\\ \;\;\;\;\frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 14: 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 67.2%

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

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

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

    \[\leadsto -1 \]

Alternative 15: 18.8% accurate, 209.0× speedup?

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

\\
0
\end{array}
Derivation
  1. Initial program 67.2%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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. +-commutative67.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto {x}^{-0.5} - \color{blue}{{\left({\left(x + 1\right)}^{0.25}\right)}^{-1} \cdot {\left({\left(x + 1\right)}^{0.25}\right)}^{-1}} \]
  8. Step-by-step derivation
    1. pow-sqr59.6%

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

      \[\leadsto {x}^{-0.5} - {\left({\left(x + 1\right)}^{0.25}\right)}^{\color{blue}{-2}} \]
  9. Simplified59.6%

    \[\leadsto {x}^{-0.5} - \color{blue}{{\left({\left(x + 1\right)}^{0.25}\right)}^{-2}} \]
  10. Taylor expanded in x around inf 20.4%

    \[\leadsto \color{blue}{{\left(\frac{1}{x}\right)}^{0.5} - \sqrt{\frac{1}{x}}} \]
  11. Step-by-step derivation
    1. unpow1/220.4%

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

      \[\leadsto \color{blue}{0} \]
  12. Simplified20.4%

    \[\leadsto \color{blue}{0} \]
  13. Final simplification20.4%

    \[\leadsto 0 \]

Developer target: 99.0% 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 2023266 
(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)))))