2isqrt (example 3.6)

Percentage Accurate: 69.3% → 99.7%
Time: 11.7s
Alternatives: 14
Speedup: 2.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 14 alternatives:

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

Initial Program: 69.3% 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.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{x + 1}\\ \mathbf{if}\;\frac{1}{\sqrt{x}} - \frac{1}{t_0} \leq 0:\\ \;\;\;\;0.5 \cdot {x}^{-1.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{t_0 + \sqrt{x}}}{\sqrt{x \cdot \left(x + 1\right)}}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (sqrt (+ x 1.0))))
   (if (<= (- (/ 1.0 (sqrt x)) (/ 1.0 t_0)) 0.0)
     (* 0.5 (pow x -1.5))
     (/ (/ 1.0 (+ t_0 (sqrt x))) (sqrt (* x (+ x 1.0)))))))
double code(double x) {
	double t_0 = sqrt((x + 1.0));
	double tmp;
	if (((1.0 / sqrt(x)) - (1.0 / t_0)) <= 0.0) {
		tmp = 0.5 * pow(x, -1.5);
	} else {
		tmp = (1.0 / (t_0 + sqrt(x))) / sqrt((x * (x + 1.0)));
	}
	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)) <= 0.0d0) then
        tmp = 0.5d0 * (x ** (-1.5d0))
    else
        tmp = (1.0d0 / (t_0 + sqrt(x))) / sqrt((x * (x + 1.0d0)))
    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)) <= 0.0) {
		tmp = 0.5 * Math.pow(x, -1.5);
	} else {
		tmp = (1.0 / (t_0 + Math.sqrt(x))) / Math.sqrt((x * (x + 1.0)));
	}
	return tmp;
}
def code(x):
	t_0 = math.sqrt((x + 1.0))
	tmp = 0
	if ((1.0 / math.sqrt(x)) - (1.0 / t_0)) <= 0.0:
		tmp = 0.5 * math.pow(x, -1.5)
	else:
		tmp = (1.0 / (t_0 + math.sqrt(x))) / math.sqrt((x * (x + 1.0)))
	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)) <= 0.0)
		tmp = Float64(0.5 * (x ^ -1.5));
	else
		tmp = Float64(Float64(1.0 / Float64(t_0 + sqrt(x))) / sqrt(Float64(x * Float64(x + 1.0))));
	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)) <= 0.0)
		tmp = 0.5 * (x ^ -1.5);
	else
		tmp = (1.0 / (t_0 + sqrt(x))) / sqrt((x * (x + 1.0)));
	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], 0.0], N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(t$95$0 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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


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

    1. Initial program 38.6%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{1}{\color{blue}{{x}^{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) \]
      9. pow-flip26.3%

        \[\leadsto \left(\color{blue}{{x}^{\left(-0.5\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-eval26.3%

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

        \[\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.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. +-commutative38.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-eval38.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-rr38.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. +-commutative38.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right) + \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right)} \]
      2. sub-neg38.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 + \left(-{\left(1 + x\right)}^{-0.5}\right)\right) + {x}^{-0.5}} \]
      9. sub-neg38.6%

        \[\leadsto \color{blue}{\left(0 - {\left(1 + x\right)}^{-0.5}\right)} + {x}^{-0.5} \]
      10. neg-sub038.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}} \]
    9. Step-by-step derivation
      1. unpow-166.1%

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

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

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

        \[\leadsto 0.5 \cdot \sqrt{e^{-1 \cdot \color{blue}{\left(3 \cdot \log x\right)}}} \]
      5. associate-*r*64.7%

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

        \[\leadsto 0.5 \cdot \sqrt{e^{\color{blue}{-3} \cdot \log x}} \]
      7. *-commutative64.7%

        \[\leadsto 0.5 \cdot \sqrt{e^{\color{blue}{\log x \cdot -3}}} \]
      8. exp-to-pow67.0%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-3}}} \]
      9. metadata-eval67.0%

        \[\leadsto 0.5 \cdot \sqrt{{x}^{\color{blue}{\left(2 \cdot -1.5\right)}}} \]
      10. pow-sqr67.1%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-1.5} \cdot {x}^{-1.5}}} \]
      11. rem-sqrt-square100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left|{x}^{-1.5}\right|} \]
      12. rem-square-sqrt99.5%

        \[\leadsto 0.5 \cdot \left|\color{blue}{\sqrt{{x}^{-1.5}} \cdot \sqrt{{x}^{-1.5}}}\right| \]
      13. fabs-sqr99.5%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{{x}^{-1.5}} \cdot \sqrt{{x}^{-1.5}}\right)} \]
      14. rem-square-sqrt100.0%

        \[\leadsto 0.5 \cdot \color{blue}{{x}^{-1.5}} \]
    10. Simplified100.0%

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

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

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  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 0:\\ \;\;\;\;0.5 \cdot {x}^{-1.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x \cdot \left(x + 1\right)}}\\ \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 5 \cdot 10^{-10}:\\ \;\;\;\;\frac{\frac{1}{t_0 + \sqrt{x}}}{x + 0.5}\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.5} + \frac{-1}{t_0}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (sqrt (+ x 1.0))))
   (if (<= (- (/ 1.0 (sqrt x)) (/ 1.0 t_0)) 5e-10)
     (/ (/ 1.0 (+ t_0 (sqrt x))) (+ x 0.5))
     (+ (pow x -0.5) (/ -1.0 t_0)))))
double code(double x) {
	double t_0 = sqrt((x + 1.0));
	double tmp;
	if (((1.0 / sqrt(x)) - (1.0 / t_0)) <= 5e-10) {
		tmp = (1.0 / (t_0 + sqrt(x))) / (x + 0.5);
	} else {
		tmp = pow(x, -0.5) + (-1.0 / t_0);
	}
	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)) <= 5d-10) then
        tmp = (1.0d0 / (t_0 + sqrt(x))) / (x + 0.5d0)
    else
        tmp = (x ** (-0.5d0)) + ((-1.0d0) / t_0)
    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)) <= 5e-10) {
		tmp = (1.0 / (t_0 + Math.sqrt(x))) / (x + 0.5);
	} else {
		tmp = Math.pow(x, -0.5) + (-1.0 / t_0);
	}
	return tmp;
}
def code(x):
	t_0 = math.sqrt((x + 1.0))
	tmp = 0
	if ((1.0 / math.sqrt(x)) - (1.0 / t_0)) <= 5e-10:
		tmp = (1.0 / (t_0 + math.sqrt(x))) / (x + 0.5)
	else:
		tmp = math.pow(x, -0.5) + (-1.0 / t_0)
	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)) <= 5e-10)
		tmp = Float64(Float64(1.0 / Float64(t_0 + sqrt(x))) / Float64(x + 0.5));
	else
		tmp = Float64((x ^ -0.5) + Float64(-1.0 / t_0));
	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)) <= 5e-10)
		tmp = (1.0 / (t_0 + sqrt(x))) / (x + 0.5);
	else
		tmp = (x ^ -0.5) + (-1.0 / t_0);
	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], 5e-10], N[(N[(1.0 / N[(t$95$0 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 0.5), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] + N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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


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

    1. Initial program 39.0%

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

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
      2. *-un-lft-identity39.0%

        \[\leadsto \frac{\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
      3. *-rgt-identity39.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.2% 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 5 \cdot 10^{-23}:\\ \;\;\;\;0.5 \cdot {x}^{-1.5}\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.5} + \frac{-1}{t_0}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (sqrt (+ x 1.0))))
   (if (<= (- (/ 1.0 (sqrt x)) (/ 1.0 t_0)) 5e-23)
     (* 0.5 (pow x -1.5))
     (+ (pow x -0.5) (/ -1.0 t_0)))))
double code(double x) {
	double t_0 = sqrt((x + 1.0));
	double tmp;
	if (((1.0 / sqrt(x)) - (1.0 / t_0)) <= 5e-23) {
		tmp = 0.5 * pow(x, -1.5);
	} else {
		tmp = pow(x, -0.5) + (-1.0 / t_0);
	}
	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)) <= 5d-23) then
        tmp = 0.5d0 * (x ** (-1.5d0))
    else
        tmp = (x ** (-0.5d0)) + ((-1.0d0) / t_0)
    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)) <= 5e-23) {
		tmp = 0.5 * Math.pow(x, -1.5);
	} else {
		tmp = Math.pow(x, -0.5) + (-1.0 / t_0);
	}
	return tmp;
}
def code(x):
	t_0 = math.sqrt((x + 1.0))
	tmp = 0
	if ((1.0 / math.sqrt(x)) - (1.0 / t_0)) <= 5e-23:
		tmp = 0.5 * math.pow(x, -1.5)
	else:
		tmp = math.pow(x, -0.5) + (-1.0 / t_0)
	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)) <= 5e-23)
		tmp = Float64(0.5 * (x ^ -1.5));
	else
		tmp = Float64((x ^ -0.5) + Float64(-1.0 / t_0));
	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)) <= 5e-23)
		tmp = 0.5 * (x ^ -1.5);
	else
		tmp = (x ^ -0.5) + (-1.0 / t_0);
	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], 5e-23], N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] + N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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


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

    1. Initial program 38.5%

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

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

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

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]
      4. prod-diff38.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-identity38.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-neg38.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-identity38.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. pow1/238.5%

        \[\leadsto \left(\frac{1}{\color{blue}{{x}^{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) \]
      9. pow-flip26.3%

        \[\leadsto \left(\color{blue}{{x}^{\left(-0.5\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-eval26.3%

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

        \[\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.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. +-commutative38.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-eval38.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-rr38.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. +-commutative38.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}} \]
    9. Step-by-step derivation
      1. unpow-166.3%

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

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

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

        \[\leadsto 0.5 \cdot \sqrt{e^{-1 \cdot \color{blue}{\left(3 \cdot \log x\right)}}} \]
      5. associate-*r*64.9%

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

        \[\leadsto 0.5 \cdot \sqrt{e^{\color{blue}{-3} \cdot \log x}} \]
      7. *-commutative64.9%

        \[\leadsto 0.5 \cdot \sqrt{e^{\color{blue}{\log x \cdot -3}}} \]
      8. exp-to-pow67.2%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-3}}} \]
      9. metadata-eval67.2%

        \[\leadsto 0.5 \cdot \sqrt{{x}^{\color{blue}{\left(2 \cdot -1.5\right)}}} \]
      10. pow-sqr67.3%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-1.5} \cdot {x}^{-1.5}}} \]
      11. rem-sqrt-square99.9%

        \[\leadsto 0.5 \cdot \color{blue}{\left|{x}^{-1.5}\right|} \]
      12. rem-square-sqrt99.5%

        \[\leadsto 0.5 \cdot \left|\color{blue}{\sqrt{{x}^{-1.5}} \cdot \sqrt{{x}^{-1.5}}}\right| \]
      13. fabs-sqr99.5%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{{x}^{-1.5}} \cdot \sqrt{{x}^{-1.5}}\right)} \]
      14. rem-square-sqrt99.9%

        \[\leadsto 0.5 \cdot \color{blue}{{x}^{-1.5}} \]
    10. Simplified99.9%

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

    if 5.0000000000000002e-23 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1))))

    1. Initial program 98.8%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. expm1-log1p-u92.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{x}^{-0.5}} - \frac{1}{\sqrt{x + 1}} \]
  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 5 \cdot 10^{-23}:\\ \;\;\;\;0.5 \cdot {x}^{-1.5}\\ \mathbf{else}:\\ \;\;\;\;{x}^{-0.5} + \frac{-1}{\sqrt{x + 1}}\\ \end{array} \]

Alternative 4: 99.6% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{x + 1}\\
\frac{{x}^{-0.5}}{t_0 \cdot \left(t_0 + \sqrt{x}\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 68.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} \cdot \frac{\frac{1}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{1 + x}}} \]
    4. pow1/299.4%

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

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

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

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

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

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

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

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

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

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

Alternative 5: 99.0% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \color{blue}{\mathsf{hypot}\left(\sqrt{x}, x\right)}}\right)} - 1 \]
  9. Applied egg-rr64.6%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \mathsf{hypot}\left(\sqrt{x}, x\right)}\right)} - 1} \]
  10. Step-by-step derivation
    1. expm1-def95.7%

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

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

      \[\leadsto \frac{1}{\color{blue}{\left(\sqrt{x} + \sqrt{1 + x}\right)} \cdot \mathsf{hypot}\left(\sqrt{x}, x\right)} \]
  11. Simplified98.9%

    \[\leadsto \color{blue}{\frac{1}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \mathsf{hypot}\left(\sqrt{x}, x\right)}} \]
  12. Final simplification98.9%

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

Alternative 6: 99.5% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 98.8%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{1}{\color{blue}{{x}^{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) \]
      9. pow-flip99.1%

        \[\leadsto \left(\color{blue}{{x}^{\left(-0.5\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.1%

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

        \[\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.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. +-commutative99.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-eval99.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-rr99.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. +-commutative99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.08e8 < x

    1. Initial program 38.5%

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

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

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

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]
      4. prod-diff38.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-identity38.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-neg38.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-identity38.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. pow1/238.5%

        \[\leadsto \left(\frac{1}{\color{blue}{{x}^{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) \]
      9. pow-flip26.3%

        \[\leadsto \left(\color{blue}{{x}^{\left(-0.5\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-eval26.3%

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

        \[\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.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. +-commutative38.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-eval38.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-rr38.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. +-commutative38.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}} \]
    9. Step-by-step derivation
      1. unpow-166.3%

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

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

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

        \[\leadsto 0.5 \cdot \sqrt{e^{-1 \cdot \color{blue}{\left(3 \cdot \log x\right)}}} \]
      5. associate-*r*64.9%

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

        \[\leadsto 0.5 \cdot \sqrt{e^{\color{blue}{-3} \cdot \log x}} \]
      7. *-commutative64.9%

        \[\leadsto 0.5 \cdot \sqrt{e^{\color{blue}{\log x \cdot -3}}} \]
      8. exp-to-pow67.2%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-3}}} \]
      9. metadata-eval67.2%

        \[\leadsto 0.5 \cdot \sqrt{{x}^{\color{blue}{\left(2 \cdot -1.5\right)}}} \]
      10. pow-sqr67.3%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-1.5} \cdot {x}^{-1.5}}} \]
      11. rem-sqrt-square99.9%

        \[\leadsto 0.5 \cdot \color{blue}{\left|{x}^{-1.5}\right|} \]
      12. rem-square-sqrt99.5%

        \[\leadsto 0.5 \cdot \left|\color{blue}{\sqrt{{x}^{-1.5}} \cdot \sqrt{{x}^{-1.5}}}\right| \]
      13. fabs-sqr99.5%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{{x}^{-1.5}} \cdot \sqrt{{x}^{-1.5}}\right)} \]
      14. rem-square-sqrt99.9%

        \[\leadsto 0.5 \cdot \color{blue}{{x}^{-1.5}} \]
    10. Simplified99.9%

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

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

Alternative 7: 98.6% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{1}{\color{blue}{{x}^{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) \]
      9. pow-flip100.0%

        \[\leadsto \left(\color{blue}{{x}^{\left(-0.5\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. +-commutative100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right) + \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right)} \]
      2. sub-neg100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{x}^{-0.5} + \left(-{\left(1 + x\right)}^{-0.5}\right)} \]
      12. sub-neg100.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 98.2%

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

    if 1 < x

    1. Initial program 40.0%

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

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

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

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]
      4. prod-diff40.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-identity40.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-neg40.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-identity40.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. pow1/240.0%

        \[\leadsto \left(\frac{1}{\color{blue}{{x}^{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) \]
      9. pow-flip28.2%

        \[\leadsto \left(\color{blue}{{x}^{\left(-0.5\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-eval28.2%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right) + \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right)} \]
      2. sub-neg39.9%

        \[\leadsto \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{\left({x}^{-0.5} + \left(-{\left(1 + x\right)}^{-0.5}\right)\right)} \]
      3. fma-udef39.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - {\left(1 + x\right)}^{-0.5}\right)} + {x}^{-0.5} \]
      10. neg-sub039.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}} \]
    9. Step-by-step derivation
      1. unpow-165.3%

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

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

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

        \[\leadsto 0.5 \cdot \sqrt{e^{-1 \cdot \color{blue}{\left(3 \cdot \log x\right)}}} \]
      5. associate-*r*64.0%

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

        \[\leadsto 0.5 \cdot \sqrt{e^{\color{blue}{-3} \cdot \log x}} \]
      7. *-commutative64.0%

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

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-3}}} \]
      9. metadata-eval66.3%

        \[\leadsto 0.5 \cdot \sqrt{{x}^{\color{blue}{\left(2 \cdot -1.5\right)}}} \]
      10. pow-sqr66.3%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-1.5} \cdot {x}^{-1.5}}} \]
      11. rem-sqrt-square97.7%

        \[\leadsto 0.5 \cdot \color{blue}{\left|{x}^{-1.5}\right|} \]
      12. rem-square-sqrt97.3%

        \[\leadsto 0.5 \cdot \left|\color{blue}{\sqrt{{x}^{-1.5}} \cdot \sqrt{{x}^{-1.5}}}\right| \]
      13. fabs-sqr97.3%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{{x}^{-1.5}} \cdot \sqrt{{x}^{-1.5}}\right)} \]
      14. rem-square-sqrt97.7%

        \[\leadsto 0.5 \cdot \color{blue}{{x}^{-1.5}} \]
    10. Simplified97.7%

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

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

Alternative 8: 96.8% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left({x}^{0.25}\right)}^{-1} \cdot {\left({x}^{0.25}\right)}^{-1}} - \frac{1}{\sqrt{x + 1}} \]
    4. Step-by-step derivation
      1. pow-sqr99.2%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{-\sqrt{x}}} \]
      4. metadata-eval94.1%

        \[\leadsto \frac{\color{blue}{-1}}{-\sqrt{x}} \]
      5. div-inv94.1%

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{-\sqrt{x}}} \]
    8. Applied egg-rr94.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{1}{-\sqrt{x}}} \]
    9. Step-by-step derivation
      1. associate-*r/94.1%

        \[\leadsto \color{blue}{\frac{-1 \cdot 1}{-\sqrt{x}}} \]
      2. metadata-eval94.1%

        \[\leadsto \frac{\color{blue}{-1}}{-\sqrt{x}} \]
      3. neg-mul-194.1%

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

        \[\leadsto \color{blue}{\frac{\frac{-1}{-1}}{\sqrt{x}}} \]
      5. metadata-eval94.1%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{x}} \]
    10. Simplified94.1%

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

    if 0.5 < x

    1. Initial program 40.9%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{1}{\color{blue}{{x}^{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) \]
      9. pow-flip29.2%

        \[\leadsto \left(\color{blue}{{x}^{\left(-0.5\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-eval29.2%

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

        \[\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.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. +-commutative40.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-eval40.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-rr40.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. +-commutative40.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}} \]
    9. Step-by-step derivation
      1. unpow-164.7%

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

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{e^{\log \left({x}^{3}\right) \cdot -1}}} \]
      3. *-commutative62.6%

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

        \[\leadsto 0.5 \cdot \sqrt{e^{-1 \cdot \color{blue}{\left(3 \cdot \log x\right)}}} \]
      5. associate-*r*63.4%

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

        \[\leadsto 0.5 \cdot \sqrt{e^{\color{blue}{-3} \cdot \log x}} \]
      7. *-commutative63.4%

        \[\leadsto 0.5 \cdot \sqrt{e^{\color{blue}{\log x \cdot -3}}} \]
      8. exp-to-pow65.6%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-3}}} \]
      9. metadata-eval65.6%

        \[\leadsto 0.5 \cdot \sqrt{{x}^{\color{blue}{\left(2 \cdot -1.5\right)}}} \]
      10. pow-sqr65.6%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-1.5} \cdot {x}^{-1.5}}} \]
      11. rem-sqrt-square96.6%

        \[\leadsto 0.5 \cdot \color{blue}{\left|{x}^{-1.5}\right|} \]
      12. rem-square-sqrt96.1%

        \[\leadsto 0.5 \cdot \left|\color{blue}{\sqrt{{x}^{-1.5}} \cdot \sqrt{{x}^{-1.5}}}\right| \]
      13. fabs-sqr96.1%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{{x}^{-1.5}} \cdot \sqrt{{x}^{-1.5}}\right)} \]
      14. rem-square-sqrt96.6%

        \[\leadsto 0.5 \cdot \color{blue}{{x}^{-1.5}} \]
    10. Simplified96.6%

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

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

Alternative 9: 98.4% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{1}{\color{blue}{{x}^{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) \]
      9. pow-flip100.0%

        \[\leadsto \left(\color{blue}{{x}^{\left(-0.5\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. +-commutative100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right) + \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right)} \]
      2. sub-neg100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{x}^{-0.5} + \left(-{\left(1 + x\right)}^{-0.5}\right)} \]
      12. sub-neg100.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 98.4%

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

    if 0.680000000000000049 < x

    1. Initial program 40.9%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{1}{\color{blue}{{x}^{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) \]
      9. pow-flip29.2%

        \[\leadsto \left(\color{blue}{{x}^{\left(-0.5\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-eval29.2%

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

        \[\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.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. +-commutative40.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-eval40.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-rr40.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. +-commutative40.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}} \]
    9. Step-by-step derivation
      1. unpow-164.7%

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

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{e^{\log \left({x}^{3}\right) \cdot -1}}} \]
      3. *-commutative62.6%

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

        \[\leadsto 0.5 \cdot \sqrt{e^{-1 \cdot \color{blue}{\left(3 \cdot \log x\right)}}} \]
      5. associate-*r*63.4%

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

        \[\leadsto 0.5 \cdot \sqrt{e^{\color{blue}{-3} \cdot \log x}} \]
      7. *-commutative63.4%

        \[\leadsto 0.5 \cdot \sqrt{e^{\color{blue}{\log x \cdot -3}}} \]
      8. exp-to-pow65.6%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-3}}} \]
      9. metadata-eval65.6%

        \[\leadsto 0.5 \cdot \sqrt{{x}^{\color{blue}{\left(2 \cdot -1.5\right)}}} \]
      10. pow-sqr65.6%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-1.5} \cdot {x}^{-1.5}}} \]
      11. rem-sqrt-square96.6%

        \[\leadsto 0.5 \cdot \color{blue}{\left|{x}^{-1.5}\right|} \]
      12. rem-square-sqrt96.1%

        \[\leadsto 0.5 \cdot \left|\color{blue}{\sqrt{{x}^{-1.5}} \cdot \sqrt{{x}^{-1.5}}}\right| \]
      13. fabs-sqr96.1%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{{x}^{-1.5}} \cdot \sqrt{{x}^{-1.5}}\right)} \]
      14. rem-square-sqrt96.6%

        \[\leadsto 0.5 \cdot \color{blue}{{x}^{-1.5}} \]
    10. Simplified96.6%

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

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

Alternative 10: 2.1% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{e^{-0.5 \cdot \mathsf{log1p}\left(x\right)}} \]
  4. Step-by-step derivation
    1. distribute-lft-neg-in51.1%

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

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

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

    \[\leadsto \color{blue}{-1 \cdot \sqrt{\frac{1}{x}}} \]
  7. Step-by-step derivation
    1. unpow1/22.2%

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

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

      \[\leadsto -1 \cdot \color{blue}{{\left(\frac{1}{x}\right)}^{0.5}} \]
    4. rem-exp-log2.2%

      \[\leadsto -1 \cdot {\left(\frac{1}{\color{blue}{e^{\log x}}}\right)}^{0.5} \]
    5. exp-neg2.2%

      \[\leadsto -1 \cdot {\color{blue}{\left(e^{-\log x}\right)}}^{0.5} \]
    6. exp-prod2.2%

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

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

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

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

      \[\leadsto -1 \cdot \color{blue}{{x}^{-0.5}} \]
    11. neg-mul-12.2%

      \[\leadsto \color{blue}{-{x}^{-0.5}} \]
  8. Simplified2.2%

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

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

Alternative 11: 11.7% accurate, 2.0× speedup?

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

\\
\sqrt{\frac{0.1111111111111111}{x}}
\end{array}
Derivation
  1. Initial program 68.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{{\left(\sqrt{x}\right)}^{-3} + \frac{-1}{{\left(\sqrt{1 + x}\right)}^{3}}}{\frac{1}{x} + \left(\frac{1}{1 + x} + \frac{{x}^{-0.5}}{\sqrt{1 + x}}\right)}} \]
  6. Step-by-step derivation
    1. expm1-log1p-u51.2%

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

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

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

      \[\leadsto \frac{\left(e^{\mathsf{log1p}\left({x}^{\color{blue}{-1.5}}\right)} - 1\right) + \frac{-1}{{\left(\sqrt{1 + x}\right)}^{3}}}{\frac{1}{x} + \left(\frac{1}{1 + x} + \frac{{x}^{-0.5}}{\sqrt{1 + x}}\right)} \]
  7. Applied egg-rr51.0%

    \[\leadsto \frac{\color{blue}{\left(e^{\mathsf{log1p}\left({x}^{-1.5}\right)} - 1\right)} + \frac{-1}{{\left(\sqrt{1 + x}\right)}^{3}}}{\frac{1}{x} + \left(\frac{1}{1 + x} + \frac{{x}^{-0.5}}{\sqrt{1 + x}}\right)} \]
  8. Step-by-step derivation
    1. expm1-def51.3%

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

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

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

    \[\leadsto \color{blue}{0.3333333333333333 \cdot \sqrt{\frac{1}{x}}} \]
  11. Step-by-step derivation
    1. *-commutative11.4%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} \cdot 0.3333333333333333} \]
  12. Simplified11.4%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} \cdot 0.3333333333333333} \]
  13. Step-by-step derivation
    1. add-sqr-sqrt11.4%

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\left(\color{blue}{{x}^{\left(\frac{-1}{2}\right)}} \cdot 0.3333333333333333\right) \cdot \left({x}^{-0.5} \cdot 0.3333333333333333\right)} \]
    10. metadata-eval11.4%

      \[\leadsto \sqrt{\left({x}^{\color{blue}{-0.5}} \cdot 0.3333333333333333\right) \cdot \left({x}^{-0.5} \cdot 0.3333333333333333\right)} \]
    11. swap-sqr11.4%

      \[\leadsto \sqrt{\color{blue}{\left({x}^{-0.5} \cdot {x}^{-0.5}\right) \cdot \left(0.3333333333333333 \cdot 0.3333333333333333\right)}} \]
    12. pow-prod-up11.4%

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

      \[\leadsto \sqrt{{x}^{\color{blue}{-1}} \cdot \left(0.3333333333333333 \cdot 0.3333333333333333\right)} \]
    14. inv-pow11.4%

      \[\leadsto \sqrt{\color{blue}{\frac{1}{x}} \cdot \left(0.3333333333333333 \cdot 0.3333333333333333\right)} \]
    15. metadata-eval11.4%

      \[\leadsto \sqrt{\frac{1}{x} \cdot \color{blue}{0.1111111111111111}} \]
  14. Applied egg-rr11.4%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{x} \cdot 0.1111111111111111}} \]
  15. Step-by-step derivation
    1. associate-*l/11.4%

      \[\leadsto \sqrt{\color{blue}{\frac{1 \cdot 0.1111111111111111}{x}}} \]
    2. metadata-eval11.4%

      \[\leadsto \sqrt{\frac{\color{blue}{0.1111111111111111}}{x}} \]
  16. Simplified11.4%

    \[\leadsto \color{blue}{\sqrt{\frac{0.1111111111111111}{x}}} \]
  17. Final simplification11.4%

    \[\leadsto \sqrt{\frac{0.1111111111111111}{x}} \]

Alternative 12: 51.1% accurate, 2.0× speedup?

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

\\
\sqrt{\frac{1}{x}}
\end{array}
Derivation
  1. Initial program 68.2%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{\left({x}^{0.25}\right)}^{-1} \cdot {\left({x}^{0.25}\right)}^{-1}} - \frac{1}{\sqrt{x + 1}} \]
  4. Step-by-step derivation
    1. pow-sqr60.7%

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

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

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

    \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \]
  7. Final simplification46.5%

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

Alternative 13: 51.0% accurate, 2.0× speedup?

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

\\
\frac{1}{\sqrt{x}}
\end{array}
Derivation
  1. Initial program 68.2%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{\left({x}^{0.25}\right)}^{-1} \cdot {\left({x}^{0.25}\right)}^{-1}} - \frac{1}{\sqrt{x + 1}} \]
  4. Step-by-step derivation
    1. pow-sqr60.7%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{x}}} \]
    2. metadata-eval46.9%

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

      \[\leadsto \color{blue}{\frac{-1}{-\sqrt{x}}} \]
    4. metadata-eval46.9%

      \[\leadsto \frac{\color{blue}{-1}}{-\sqrt{x}} \]
    5. div-inv46.9%

      \[\leadsto \color{blue}{-1 \cdot \frac{1}{-\sqrt{x}}} \]
  8. Applied egg-rr46.9%

    \[\leadsto \color{blue}{-1 \cdot \frac{1}{-\sqrt{x}}} \]
  9. Step-by-step derivation
    1. associate-*r/46.9%

      \[\leadsto \color{blue}{\frac{-1 \cdot 1}{-\sqrt{x}}} \]
    2. metadata-eval46.9%

      \[\leadsto \frac{\color{blue}{-1}}{-\sqrt{x}} \]
    3. neg-mul-146.9%

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

      \[\leadsto \color{blue}{\frac{\frac{-1}{-1}}{\sqrt{x}}} \]
    5. metadata-eval46.9%

      \[\leadsto \frac{\color{blue}{1}}{\sqrt{x}} \]
  10. Simplified46.9%

    \[\leadsto \color{blue}{\frac{1}{\sqrt{x}}} \]
  11. Final simplification46.9%

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

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 68.2%

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

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

    \[\leadsto \color{blue}{-1} \]
  4. Final simplification2.0%

    \[\leadsto -1 \]

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 2023334 
(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)))))