2isqrt (example 3.6)

Percentage Accurate: 68.8% → 99.0%
Time: 9.0s
Alternatives: 8
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 8 alternatives:

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

Initial Program: 68.8% 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.0% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 35.8%

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x} - \color{blue}{\frac{1 \cdot 1}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      6. metadata-eval24.7%

        \[\leadsto \frac{\frac{1}{x} - \frac{\color{blue}{1}}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      7. add-sqr-sqrt35.8%

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

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      9. pow1/235.8%

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{\frac{1}{\color{blue}{{x}^{0.5}}} + \frac{1}{\sqrt{x + 1}}} \]
      10. pow-flip35.8%

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

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{\color{blue}{-0.5}} + \frac{1}{\sqrt{x + 1}}} \]
      12. inv-pow35.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{{x}^{-1.5}} \cdot \sqrt{{x}^{-1.5}}\right)} \]
      15. 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 1.99999999999999992e-23 < (-.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.1%

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

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

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

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

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

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

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

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

Alternative 2: 99.3% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    9. pow1/268.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 118000000:\\ \;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot {x}^{-1.5}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 118000000.0)
   (- (pow x -0.5) (pow (+ 1.0 x) -0.5))
   (* 0.5 (pow x -1.5))))
double code(double x) {
	double tmp;
	if (x <= 118000000.0) {
		tmp = pow(x, -0.5) - pow((1.0 + x), -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 <= 118000000.0d0) then
        tmp = (x ** (-0.5d0)) - ((1.0d0 + x) ** (-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 <= 118000000.0) {
		tmp = Math.pow(x, -0.5) - Math.pow((1.0 + x), -0.5);
	} else {
		tmp = 0.5 * Math.pow(x, -1.5);
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 118000000.0:
		tmp = math.pow(x, -0.5) - math.pow((1.0 + x), -0.5)
	else:
		tmp = 0.5 * math.pow(x, -1.5)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 118000000.0)
		tmp = Float64((x ^ -0.5) - (Float64(1.0 + x) ^ -0.5));
	else
		tmp = Float64(0.5 * (x ^ -1.5));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 118000000.0)
		tmp = (x ^ -0.5) - ((1.0 + x) ^ -0.5);
	else
		tmp = 0.5 * (x ^ -1.5);
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 118000000.0], N[(N[Power[x, -0.5], $MachinePrecision] - N[Power[N[(1.0 + x), $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 118000000:\\
\;\;\;\;{x}^{-0.5} - {\left(1 + x\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.18e8

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {x}^{-0.5} - \left(\color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - 1\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
      4. associate--l-99.4%

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

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

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

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

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

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \color{blue}{1}\right) \]
      10. expm1-def99.6%

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

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

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

    if 1.18e8 < x

    1. Initial program 35.8%

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x} - \color{blue}{\frac{1 \cdot 1}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      6. metadata-eval24.7%

        \[\leadsto \frac{\frac{1}{x} - \frac{\color{blue}{1}}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      7. add-sqr-sqrt35.8%

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

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      9. pow1/235.8%

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{\frac{1}{\color{blue}{{x}^{0.5}}} + \frac{1}{\sqrt{x + 1}}} \]
      10. pow-flip35.8%

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

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{\color{blue}{-0.5}} + \frac{1}{\sqrt{x + 1}}} \]
      12. inv-pow35.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{{x}^{-1.5}} \cdot \sqrt{{x}^{-1.5}}\right)} \]
      15. 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}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.8%

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

Alternative 4: 98.5% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.68:\\
\;\;\;\;{x}^{-0.5} + \frac{-1}{1 + x \cdot 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.67999999999999994

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.67999999999999994 < x

    1. Initial program 36.9%

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x} - \color{blue}{\frac{1 \cdot 1}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      6. metadata-eval26.1%

        \[\leadsto \frac{\frac{1}{x} - \frac{\color{blue}{1}}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      7. add-sqr-sqrt36.9%

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

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      9. pow1/236.9%

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{\frac{1}{\color{blue}{{x}^{0.5}}} + \frac{1}{\sqrt{x + 1}}} \]
      10. pow-flip36.9%

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

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{\color{blue}{-0.5}} + \frac{1}{\sqrt{x + 1}}} \]
      12. inv-pow36.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-3}}} \]
      10. metadata-eval60.1%

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

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-1.5} \cdot {x}^{-1.5}}} \]
      12. rem-sqrt-square98.5%

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{{x}^{-1.5}} \cdot \sqrt{{x}^{-1.5}}\right)} \]
      15. rem-square-sqrt98.5%

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

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

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

Alternative 5: 98.5% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\ \mathbf{else}:\\ \;\;\;\;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.7%

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

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

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

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

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

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

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

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

        \[\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. associate-+l-100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1 < x

    1. Initial program 36.9%

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x} - \color{blue}{\frac{1 \cdot 1}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      6. metadata-eval26.1%

        \[\leadsto \frac{\frac{1}{x} - \frac{\color{blue}{1}}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      7. add-sqr-sqrt36.9%

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

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      9. pow1/236.9%

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{\frac{1}{\color{blue}{{x}^{0.5}}} + \frac{1}{\sqrt{x + 1}}} \]
      10. pow-flip36.9%

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

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{\color{blue}{-0.5}} + \frac{1}{\sqrt{x + 1}}} \]
      12. inv-pow36.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-3}}} \]
      10. metadata-eval60.1%

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

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-1.5} \cdot {x}^{-1.5}}} \]
      12. rem-sqrt-square98.5%

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{{x}^{-1.5}} \cdot \sqrt{{x}^{-1.5}}\right)} \]
      15. rem-square-sqrt98.5%

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

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

    \[\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 6: 98.2% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.67:\\ \;\;\;\;{x}^{-0.5} + -1\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot {x}^{-1.5}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 0.67) (+ (pow x -0.5) -1.0) (* 0.5 (pow x -1.5))))
double code(double x) {
	double tmp;
	if (x <= 0.67) {
		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.67d0) 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.67) {
		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.67:
		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.67)
		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.67)
		tmp = (x ^ -0.5) + -1.0;
	else
		tmp = 0.5 * (x ^ -1.5);
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 0.67], 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.67:\\
\;\;\;\;{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.67000000000000004

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

        \[\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. associate-+l-100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.67000000000000004 < x

    1. Initial program 36.9%

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x} - \color{blue}{\frac{1 \cdot 1}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      6. metadata-eval26.1%

        \[\leadsto \frac{\frac{1}{x} - \frac{\color{blue}{1}}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      7. add-sqr-sqrt36.9%

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

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      9. pow1/236.9%

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{\frac{1}{\color{blue}{{x}^{0.5}}} + \frac{1}{\sqrt{x + 1}}} \]
      10. pow-flip36.9%

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

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{\color{blue}{-0.5}} + \frac{1}{\sqrt{x + 1}}} \]
      12. inv-pow36.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-3}}} \]
      10. metadata-eval60.1%

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

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-1.5} \cdot {x}^{-1.5}}} \]
      12. rem-sqrt-square98.5%

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{{x}^{-1.5}} \cdot \sqrt{{x}^{-1.5}}\right)} \]
      15. rem-square-sqrt98.5%

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

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

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

Alternative 7: 52.2% accurate, 2.0× speedup?

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

\\
0.5 \cdot {x}^{-1.5}
\end{array}
Derivation
  1. Initial program 68.8%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    9. pow1/268.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-1.5} \cdot {x}^{-1.5}}} \]
    12. rem-sqrt-square51.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left|{x}^{-1.5}\right|} \]
    13. rem-square-sqrt51.0%

      \[\leadsto 0.5 \cdot \left|\color{blue}{\sqrt{{x}^{-1.5}} \cdot \sqrt{{x}^{-1.5}}}\right| \]
    14. fabs-sqr51.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{{x}^{-1.5}} \cdot \sqrt{{x}^{-1.5}}\right)} \]
    15. rem-square-sqrt51.2%

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

    \[\leadsto \color{blue}{0.5 \cdot {x}^{-1.5}} \]
  11. Final simplification51.2%

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

Alternative 8: 25.3% accurate, 2.0× speedup?

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

\\
{x}^{-1.5}
\end{array}
Derivation
  1. Initial program 68.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{x} - \color{blue}{\frac{\frac{-1}{\sqrt{1 + x}} \cdot -1}{\sqrt{1 + x}}}}{{x}^{-0.5} - \frac{-1}{\sqrt{1 + x}}} \]
    2. associate-*l/60.2%

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

      \[\leadsto \frac{\frac{1}{x} - \frac{\frac{\color{blue}{1}}{\sqrt{1 + x}}}{\sqrt{1 + x}}}{{x}^{-0.5} - \frac{-1}{\sqrt{1 + x}}} \]
    4. sub-neg60.2%

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{\frac{1}{{x}^{3}}}} \]
  7. Step-by-step derivation
    1. expm1-log1p-u21.7%

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

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

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

      \[\leadsto e^{\mathsf{log1p}\left({\color{blue}{\left({x}^{\left(-3\right)}\right)}}^{0.5}\right)} - 1 \]
    5. pow-pow20.1%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{x}^{\left(\left(-3\right) \cdot 0.5\right)}}\right)} - 1 \]
    6. metadata-eval20.1%

      \[\leadsto e^{\mathsf{log1p}\left({x}^{\left(\color{blue}{-3} \cdot 0.5\right)}\right)} - 1 \]
    7. metadata-eval20.1%

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

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

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

      \[\leadsto \color{blue}{{x}^{-1.5}} \]
  10. Simplified24.4%

    \[\leadsto \color{blue}{{x}^{-1.5}} \]
  11. Final simplification24.4%

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

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