2isqrt (example 3.6)

Percentage Accurate: 68.2% → 99.8%
Time: 15.8s
Alternatives: 13
Speedup: 1.0×

Specification

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

\\
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 13 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.2% accurate, 1.0× speedup?

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

\\
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\end{array}

Alternative 1: 99.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 280000:\\ \;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5, {x}^{-1.5}, -0.375 \cdot {x}^{-2.5}\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 280000.0)
   (- (pow x -0.5) (pow (+ 1.0 x) -0.5))
   (fma 0.5 (pow x -1.5) (* -0.375 (pow x -2.5)))))
double code(double x) {
	double tmp;
	if (x <= 280000.0) {
		tmp = pow(x, -0.5) - pow((1.0 + x), -0.5);
	} else {
		tmp = fma(0.5, pow(x, -1.5), (-0.375 * pow(x, -2.5)));
	}
	return tmp;
}
function code(x)
	tmp = 0.0
	if (x <= 280000.0)
		tmp = Float64((x ^ -0.5) - (Float64(1.0 + x) ^ -0.5));
	else
		tmp = fma(0.5, (x ^ -1.5), Float64(-0.375 * (x ^ -2.5)));
	end
	return tmp
end
code[x_] := If[LessEqual[x, 280000.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] + N[(-0.375 * N[Power[x, -2.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.5, {x}^{-1.5}, -0.375 \cdot {x}^{-2.5}\right)\\


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

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
      2. neg-mul-199.9%

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

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

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

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

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

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

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

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

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

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

    if 2.8e5 < x

    1. Initial program 33.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{{x}^{\left(\frac{-1}{2}\right)}} - \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
      10. metadata-eval24.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/224.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-flip33.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. +-commutative33.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-eval33.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-rr33.5%

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

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
      2. neg-mul-133.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(-0.375 \cdot \sqrt{\frac{1}{{x}^{5}}} + 0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\right)\right)} \]
      2. expm1-udef32.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-0.375 \cdot \sqrt{\frac{1}{{x}^{5}}} + 0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\right)} - 1} \]
      3. fma-def32.4%

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

        \[\leadsto e^{\mathsf{log1p}\left(\mathsf{fma}\left(-0.375, \sqrt{\color{blue}{{x}^{\left(-5\right)}}}, 0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\right)\right)} - 1 \]
      5. metadata-eval32.4%

        \[\leadsto e^{\mathsf{log1p}\left(\mathsf{fma}\left(-0.375, \sqrt{{x}^{\color{blue}{-5}}}, 0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\right)\right)} - 1 \]
      6. *-commutative32.4%

        \[\leadsto e^{\mathsf{log1p}\left(\mathsf{fma}\left(-0.375, \sqrt{{x}^{-5}}, \color{blue}{\sqrt{\frac{1}{{x}^{3}}} \cdot 0.5}\right)\right)} - 1 \]
      7. pow-flip32.4%

        \[\leadsto e^{\mathsf{log1p}\left(\mathsf{fma}\left(-0.375, \sqrt{{x}^{-5}}, \sqrt{\color{blue}{{x}^{\left(-3\right)}}} \cdot 0.5\right)\right)} - 1 \]
      8. metadata-eval32.4%

        \[\leadsto e^{\mathsf{log1p}\left(\mathsf{fma}\left(-0.375, \sqrt{{x}^{-5}}, \sqrt{{x}^{\color{blue}{-3}}} \cdot 0.5\right)\right)} - 1 \]
    8. Applied egg-rr32.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\mathsf{fma}\left(-0.375, \sqrt{{x}^{-5}}, \sqrt{{x}^{-3}} \cdot 0.5\right)\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def64.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(-0.375, \sqrt{{x}^{-5}}, \sqrt{{x}^{-3}} \cdot 0.5\right)\right)\right)} \]
      2. expm1-log1p64.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-0.375, \sqrt{{x}^{-5}}, \sqrt{{x}^{-3}} \cdot 0.5\right)} \]
      3. fma-udef64.9%

        \[\leadsto \color{blue}{-0.375 \cdot \sqrt{{x}^{-5}} + \sqrt{{x}^{-3}} \cdot 0.5} \]
      4. +-commutative64.9%

        \[\leadsto \color{blue}{\sqrt{{x}^{-3}} \cdot 0.5 + -0.375 \cdot \sqrt{{x}^{-5}}} \]
      5. *-commutative64.9%

        \[\leadsto \color{blue}{0.5 \cdot \sqrt{{x}^{-3}}} + -0.375 \cdot \sqrt{{x}^{-5}} \]
      6. fma-udef64.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \sqrt{{x}^{-3}}, -0.375 \cdot \sqrt{{x}^{-5}}\right)} \]
      7. sqr-pow64.9%

        \[\leadsto \mathsf{fma}\left(0.5, \sqrt{\color{blue}{{x}^{\left(\frac{-3}{2}\right)} \cdot {x}^{\left(\frac{-3}{2}\right)}}}, -0.375 \cdot \sqrt{{x}^{-5}}\right) \]
      8. rem-sqrt-square100.0%

        \[\leadsto \mathsf{fma}\left(0.5, \color{blue}{\left|{x}^{\left(\frac{-3}{2}\right)}\right|}, -0.375 \cdot \sqrt{{x}^{-5}}\right) \]
      9. sqr-pow99.4%

        \[\leadsto \mathsf{fma}\left(0.5, \left|\color{blue}{{x}^{\left(\frac{\frac{-3}{2}}{2}\right)} \cdot {x}^{\left(\frac{\frac{-3}{2}}{2}\right)}}\right|, -0.375 \cdot \sqrt{{x}^{-5}}\right) \]
      10. fabs-sqr99.4%

        \[\leadsto \mathsf{fma}\left(0.5, \color{blue}{{x}^{\left(\frac{\frac{-3}{2}}{2}\right)} \cdot {x}^{\left(\frac{\frac{-3}{2}}{2}\right)}}, -0.375 \cdot \sqrt{{x}^{-5}}\right) \]
      11. sqr-pow100.0%

        \[\leadsto \mathsf{fma}\left(0.5, \color{blue}{{x}^{\left(\frac{-3}{2}\right)}}, -0.375 \cdot \sqrt{{x}^{-5}}\right) \]
      12. metadata-eval100.0%

        \[\leadsto \mathsf{fma}\left(0.5, {x}^{\color{blue}{-1.5}}, -0.375 \cdot \sqrt{{x}^{-5}}\right) \]
      13. sqr-pow100.0%

        \[\leadsto \mathsf{fma}\left(0.5, {x}^{-1.5}, -0.375 \cdot \sqrt{\color{blue}{{x}^{\left(\frac{-5}{2}\right)} \cdot {x}^{\left(\frac{-5}{2}\right)}}}\right) \]
      14. rem-sqrt-square100.0%

        \[\leadsto \mathsf{fma}\left(0.5, {x}^{-1.5}, -0.375 \cdot \color{blue}{\left|{x}^{\left(\frac{-5}{2}\right)}\right|}\right) \]
      15. sqr-pow100.0%

        \[\leadsto \mathsf{fma}\left(0.5, {x}^{-1.5}, -0.375 \cdot \left|\color{blue}{{x}^{\left(\frac{\frac{-5}{2}}{2}\right)} \cdot {x}^{\left(\frac{\frac{-5}{2}}{2}\right)}}\right|\right) \]
      16. fabs-sqr100.0%

        \[\leadsto \mathsf{fma}\left(0.5, {x}^{-1.5}, -0.375 \cdot \color{blue}{\left({x}^{\left(\frac{\frac{-5}{2}}{2}\right)} \cdot {x}^{\left(\frac{\frac{-5}{2}}{2}\right)}\right)}\right) \]
      17. sqr-pow100.0%

        \[\leadsto \mathsf{fma}\left(0.5, {x}^{-1.5}, -0.375 \cdot \color{blue}{{x}^{\left(\frac{-5}{2}\right)}}\right) \]
      18. metadata-eval100.0%

        \[\leadsto \mathsf{fma}\left(0.5, {x}^{-1.5}, -0.375 \cdot {x}^{\color{blue}{-2.5}}\right) \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, {x}^{-1.5}, -0.375 \cdot {x}^{-2.5}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.9%

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

Alternative 2: 99.5% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 33.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x + x \cdot x}}} \]
    6. Step-by-step derivation
      1. flip--33.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 + x \cdot x}} \]
      2. div-inv33.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 + x \cdot x}} \]
      3. add-sqr-sqrt35.2%

        \[\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 + x \cdot x}} \]
      4. +-commutative35.2%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x + x \cdot x}} \]
    11. Taylor expanded in x around inf 99.7%

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

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

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

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

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
      2. neg-mul-199.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.4% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 33.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x + x \cdot x}}} \]
    6. Step-by-step derivation
      1. flip--33.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 + x \cdot x}} \]
      2. div-inv33.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 + x \cdot x}} \]
      3. add-sqr-sqrt35.2%

        \[\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 + x \cdot x}} \]
      4. +-commutative35.2%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x + x \cdot x}} \]
    11. Taylor expanded in x around inf 99.1%

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

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

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
      2. neg-mul-199.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 99.0% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x + x \cdot x}}} \]
  6. Step-by-step derivation
    1. flip--68.8%

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

      \[\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 + x \cdot x}} \]
    3. add-sqr-sqrt69.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 + x \cdot x}} \]
    4. +-commutative69.6%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x + x \cdot x}} \]
  11. Step-by-step derivation
    1. expm1-log1p-u86.1%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{1 + x} + \sqrt{x}}}{\mathsf{hypot}\left(x, \sqrt{x}\right)}} \]
    3. associate-/r*98.7%

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

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

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

Alternative 5: 83.6% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
      2. neg-mul-199.9%

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

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

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

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

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

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

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

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

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

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

    if 1e8 < x

    1. Initial program 33.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{{x}^{\left(\frac{-1}{2}\right)}} - \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
      10. metadata-eval24.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/224.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-flip33.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. +-commutative33.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-eval33.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-rr33.5%

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

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
      2. neg-mul-133.5%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 82.8% accurate, 1.0× 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 \sqrt{\frac{1}{{x}^{3}}}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 1.0)
   (+ (+ (pow x -0.5) (* x 0.5)) -1.0)
   (* 0.5 (sqrt (/ 1.0 (pow x 3.0))))))
double code(double x) {
	double tmp;
	if (x <= 1.0) {
		tmp = (pow(x, -0.5) + (x * 0.5)) + -1.0;
	} else {
		tmp = 0.5 * sqrt((1.0 / pow(x, 3.0)));
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 1.0d0) then
        tmp = ((x ** (-0.5d0)) + (x * 0.5d0)) + (-1.0d0)
    else
        tmp = 0.5d0 * sqrt((1.0d0 / (x ** 3.0d0)))
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 1.0) {
		tmp = (Math.pow(x, -0.5) + (x * 0.5)) + -1.0;
	} else {
		tmp = 0.5 * Math.sqrt((1.0 / Math.pow(x, 3.0)));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 1.0:
		tmp = (math.pow(x, -0.5) + (x * 0.5)) + -1.0
	else:
		tmp = 0.5 * math.sqrt((1.0 / math.pow(x, 3.0)))
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 1.0)
		tmp = Float64(Float64((x ^ -0.5) + Float64(x * 0.5)) + -1.0);
	else
		tmp = Float64(0.5 * sqrt(Float64(1.0 / (x ^ 3.0))));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 1.0)
		tmp = ((x ^ -0.5) + (x * 0.5)) + -1.0;
	else
		tmp = 0.5 * sqrt((1.0 / (x ^ 3.0)));
	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[Sqrt[N[(1.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]], $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 \sqrt{\frac{1}{{x}^{3}}}\\


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

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

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

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

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

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

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

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

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

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
      2. neg-mul-1100.0%

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

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

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

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

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

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

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

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

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

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

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

    if 1 < x

    1. Initial program 34.3%

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

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

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

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]
      4. prod-diff34.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-identity34.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-neg34.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-identity34.3%

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

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

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

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

        \[\leadsto \left({x}^{-0.5} - \frac{1}{\color{blue}{{\left(x + 1\right)}^{0.5}}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
      12. pow-flip34.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. +-commutative34.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-eval34.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-rr34.5%

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

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
      2. neg-mul-134.5%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 67.3% accurate, 1.8× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0 \cdot \sqrt{\frac{1}{x}}\\


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

    1. Initial program 75.8%

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

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

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

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

    if 8.2000000000000004e122 < x

    1. Initial program 50.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{0} \cdot \sqrt{\frac{1}{x}} \]
    6. Simplified50.5%

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

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

Alternative 8: 67.1% accurate, 1.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0 \cdot \sqrt{\frac{1}{x}}\\


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

    1. Initial program 83.6%

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

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

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

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]
      4. prod-diff83.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-identity83.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-neg83.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-identity83.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. inv-pow83.6%

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

        \[\leadsto \left(\color{blue}{{x}^{\left(\frac{-1}{2}\right)}} - \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
      10. metadata-eval84.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/284.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-flip84.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. +-commutative84.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-eval84.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-rr84.0%

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

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
      2. neg-mul-184.0%

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

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

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

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

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

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

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

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

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

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

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

    if 8.1999999999999997e76 < x

    1. Initial program 41.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{0} \cdot \sqrt{\frac{1}{x}} \]
    6. Simplified41.4%

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

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

Alternative 9: 66.5% accurate, 2.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0 \cdot \sqrt{\frac{1}{x}}\\


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

    1. Initial program 99.6%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. 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. inv-pow99.6%

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

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

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

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

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

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

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

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

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
      2. neg-mul-1100.0%

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

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

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

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

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

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

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

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

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

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

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

    if 1 < x

    1. Initial program 34.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{0} \cdot \sqrt{\frac{1}{x}} \]
    6. Simplified31.7%

      \[\leadsto \color{blue}{0 \cdot \sqrt{\frac{1}{x}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification66.9%

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

Alternative 10: 67.0% accurate, 2.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0 \cdot \sqrt{\frac{1}{x}}\\


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

    1. Initial program 71.9%

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

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

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

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]
      4. prod-diff71.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-identity71.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-neg71.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-identity71.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. inv-pow71.9%

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

        \[\leadsto \left(\color{blue}{{x}^{\left(\frac{-1}{2}\right)}} - \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
      10. metadata-eval72.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/272.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-flip72.3%

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

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

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

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

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
      2. neg-mul-172.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{x \cdot \left(1 + {x}^{-0.5}\right)}} \]
    11. Step-by-step derivation
      1. distribute-rgt-in69.7%

        \[\leadsto \frac{1}{\color{blue}{1 \cdot x + {x}^{-0.5} \cdot x}} \]
      2. *-un-lft-identity69.7%

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

      \[\leadsto \frac{1}{\color{blue}{x + {x}^{-0.5} \cdot x}} \]
    13. Step-by-step derivation
      1. pow-plus70.0%

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

        \[\leadsto \frac{1}{x + {x}^{\color{blue}{0.5}}} \]
      3. unpow1/270.0%

        \[\leadsto \frac{1}{x + \color{blue}{\sqrt{x}}} \]
    14. Simplified70.0%

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

    if 4.6000000000000003e153 < x

    1. Initial program 58.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot \sqrt{\frac{1}{x}} + \color{blue}{\sqrt{\frac{1}{x}}} \]
      2. distribute-lft1-in58.6%

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

        \[\leadsto \color{blue}{0} \cdot \sqrt{\frac{1}{x}} \]
    6. Simplified58.6%

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

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

Alternative 11: 48.9% accurate, 2.0× speedup?

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

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

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

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

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

      \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]
    4. prod-diff68.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-identity68.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-neg68.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-identity68.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. inv-pow68.7%

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

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

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

      \[\leadsto \left({x}^{-0.5} - \frac{1}{\color{blue}{{\left(x + 1\right)}^{0.5}}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
    12. pow-flip69.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. +-commutative69.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-eval69.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-rr69.0%

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

      \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
    2. neg-mul-169.0%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 49.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.7%

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

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

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

      \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]
    4. prod-diff68.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-identity68.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-neg68.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-identity68.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. inv-pow68.7%

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

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

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

      \[\leadsto \left({x}^{-0.5} - \frac{1}{\color{blue}{{\left(x + 1\right)}^{0.5}}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
    12. pow-flip69.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. +-commutative69.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-eval69.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-rr69.0%

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

      \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
    2. neg-mul-169.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}} \]
  6. Step-by-step derivation
    1. flip--68.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. div-inv68.8%

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

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

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

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

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

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

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

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

Alternative 13: 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.7%

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

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

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

    \[\leadsto -1 \]

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