2isqrt (example 3.6)

Percentage Accurate: 68.6% → 99.6%
Time: 10.6s
Alternatives: 16
Speedup: 2.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 16 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.6% 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.6% accurate, 0.4× speedup?

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

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


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

    1. Initial program 41.9%

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
    3. Applied egg-rr42.0%

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

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

        \[\leadsto \frac{\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}}}{\sqrt{1 + x}} \]
      3. add-sqr-sqrt24.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{x + 1}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    8. Step-by-step derivation
      1. clear-num98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {x}^{\color{blue}{-0.5}} \cdot \frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{1 + x}} \]
      7. +-commutative99.9%

        \[\leadsto {x}^{-0.5} \cdot \frac{\sqrt{\color{blue}{x + 1}} - \sqrt{x}}{\sqrt{1 + x}} \]
      8. +-commutative99.9%

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

      \[\leadsto \color{blue}{{x}^{-0.5} \cdot \frac{\sqrt{x + 1} - \sqrt{x}}{\sqrt{x + 1}}} \]
    6. Step-by-step derivation
      1. div-sub99.9%

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

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

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

Alternative 2: 99.8% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 41.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{{x}^{\left(-0.5\right)}} - \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
      10. metadata-eval31.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/231.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-flip41.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {x}^{-0.5} - \color{blue}{e^{-0.5 \cdot \mathsf{log1p}\left(x\right)}} \]
    8. Taylor expanded in x around inf 74.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 96.9%

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
    3. Applied egg-rr97.0%

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

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

        \[\leadsto \frac{\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}}}{\sqrt{1 + x}} \]
      3. add-sqr-sqrt98.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{x + 1}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    8. Step-by-step derivation
      1. clear-num99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.8% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 41.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{{x}^{\left(-0.5\right)}} - \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
      10. metadata-eval31.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/231.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-flip41.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {x}^{-0.5} - \color{blue}{e^{-0.5 \cdot \mathsf{log1p}\left(x\right)}} \]
    8. Taylor expanded in x around inf 74.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 96.9%

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
    3. Applied egg-rr97.0%

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

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

        \[\leadsto \frac{\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}}}{\sqrt{1 + x}} \]
      3. add-sqr-sqrt98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{x + 1}}}{\sqrt{x}}}{\sqrt{1 + x}}\right)} - 1} \]
    9. Applied egg-rr88.7%

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

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

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

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

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

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

Alternative 4: 99.6% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 41.9%

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
    3. Applied egg-rr42.0%

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

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

        \[\leadsto \frac{\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}}}{\sqrt{1 + x}} \]
      3. add-sqr-sqrt24.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{x + 1}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    8. Step-by-step derivation
      1. clear-num98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 99.4% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
  3. Applied egg-rr69.4%

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

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

      \[\leadsto \frac{\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}}}{\sqrt{1 + x}} \]
    3. add-sqr-sqrt60.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 99.7% accurate, 1.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{1}{\left(0.5 + x \cdot 2\right) - \frac{0.125}{x}}\\


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

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4500 < x

    1. Initial program 41.9%

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
    3. Applied egg-rr42.0%

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

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

        \[\leadsto \frac{\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}}}{\sqrt{1 + x}} \]
      3. add-sqr-sqrt24.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{x + 1}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    8. Step-by-step derivation
      1. clear-num98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 99.2% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {x}^{-0.5} - \color{blue}{\left(1 + \left(-0.5 \cdot x + 0.375 \cdot {x}^{2}\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutative98.8%

        \[\leadsto {x}^{-0.5} - \left(1 + \left(\color{blue}{x \cdot -0.5} + 0.375 \cdot {x}^{2}\right)\right) \]
      2. *-commutative98.8%

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

        \[\leadsto {x}^{-0.5} - \left(1 + \left(x \cdot -0.5 + \color{blue}{\left(x \cdot x\right)} \cdot 0.375\right)\right) \]
      4. associate-*l*98.8%

        \[\leadsto {x}^{-0.5} - \left(1 + \left(x \cdot -0.5 + \color{blue}{x \cdot \left(x \cdot 0.375\right)}\right)\right) \]
      5. distribute-lft-out98.8%

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

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

    if 0.56000000000000005 < x

    1. Initial program 42.6%

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}} \]
      4. *-rgt-identity42.8%

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

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

        \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
    3. Applied egg-rr42.8%

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

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

        \[\leadsto \frac{\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}}}{\sqrt{1 + x}} \]
      3. add-sqr-sqrt25.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{x + 1}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    8. Step-by-step derivation
      1. clear-num98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 99.0% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.47999999999999998 < x

    1. Initial program 42.6%

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}} \]
      4. *-rgt-identity42.8%

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

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

        \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
    3. Applied egg-rr42.8%

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

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

        \[\leadsto \frac{\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}}}{\sqrt{1 + x}} \]
      3. add-sqr-sqrt25.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{x + 1}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    8. Step-by-step derivation
      1. clear-num98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 99.1% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {x}^{-0.5} - \color{blue}{\left(1 + \left(-0.5 \cdot x + 0.375 \cdot {x}^{2}\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutative98.8%

        \[\leadsto {x}^{-0.5} - \left(1 + \left(\color{blue}{x \cdot -0.5} + 0.375 \cdot {x}^{2}\right)\right) \]
      2. *-commutative98.8%

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

        \[\leadsto {x}^{-0.5} - \left(1 + \left(x \cdot -0.5 + \color{blue}{\left(x \cdot x\right)} \cdot 0.375\right)\right) \]
      4. associate-*l*98.8%

        \[\leadsto {x}^{-0.5} - \left(1 + \left(x \cdot -0.5 + \color{blue}{x \cdot \left(x \cdot 0.375\right)}\right)\right) \]
      5. distribute-lft-out98.8%

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

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

    if 0.56000000000000005 < x

    1. Initial program 42.6%

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}} \]
      4. *-rgt-identity42.8%

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

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

        \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
    3. Applied egg-rr42.8%

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

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

        \[\leadsto \frac{\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}}}{\sqrt{1 + x}} \]
      3. add-sqr-sqrt25.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{x + 1}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    8. Step-by-step derivation
      1. clear-num98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 98.5% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1 < x

    1. Initial program 42.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {x}^{-0.5} - \color{blue}{e^{-0.5 \cdot \mathsf{log1p}\left(x\right)}} \]
    8. Taylor expanded in x around inf 74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 96.7% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{x}} \]
      3. expm1-log1p-u89.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\sqrt{x}}\right)\right)} \]
      4. expm1-udef89.0%

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left(\sqrt{x}\right)}^{-1}}\right)} - 1 \]
      6. sqrt-pow289.0%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{x}^{\left(\frac{-1}{2}\right)}}\right)} - 1 \]
      7. metadata-eval89.0%

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

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

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

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

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

    if 0.5 < x

    1. Initial program 42.6%

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

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

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

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]
      4. prod-diff42.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-identity42.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-neg42.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-identity42.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {x}^{-0.5} - e^{\color{blue}{-0.5 \cdot \log \left(1 + x\right)}} \]
      3. log1p-udef8.2%

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

      \[\leadsto {x}^{-0.5} - \color{blue}{e^{-0.5 \cdot \mathsf{log1p}\left(x\right)}} \]
    8. Taylor expanded in x around inf 74.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 98.2% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.680000000000000049 < x

    1. Initial program 42.6%

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

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

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

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]
      4. prod-diff42.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-identity42.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-neg42.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-identity42.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {x}^{-0.5} - e^{\color{blue}{-0.5 \cdot \log \left(1 + x\right)}} \]
      3. log1p-udef8.2%

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

      \[\leadsto {x}^{-0.5} - \color{blue}{e^{-0.5 \cdot \mathsf{log1p}\left(x\right)}} \]
    8. Taylor expanded in x around inf 74.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 50.2% accurate, 2.0× speedup?

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

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

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

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

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

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

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

      \[\leadsto \left(e^{\mathsf{log1p}\left({x}^{\color{blue}{-0.5}}\right)} - 1\right) - \frac{1}{\sqrt{x + 1}} \]
  3. Applied egg-rr46.2%

    \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left({x}^{-0.5}\right)} - 1\right)} - \frac{1}{\sqrt{x + 1}} \]
  4. Step-by-step derivation
    1. expm1-def60.6%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({x}^{-0.5}\right)\right)} - \frac{1}{\sqrt{x + 1}} \]
    2. expm1-log1p64.3%

      \[\leadsto \color{blue}{{x}^{-0.5}} - \frac{1}{\sqrt{x + 1}} \]
  5. Simplified64.3%

    \[\leadsto \color{blue}{{x}^{-0.5}} - \frac{1}{\sqrt{x + 1}} \]
  6. Taylor expanded in x around inf 48.2%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \]
  7. Step-by-step derivation
    1. sqrt-div48.1%

      \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{x}}} \]
    2. metadata-eval48.1%

      \[\leadsto \frac{\color{blue}{1}}{\sqrt{x}} \]
    3. expm1-log1p-u44.8%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\sqrt{x}}\right)\right)} \]
    4. expm1-udef63.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{\sqrt{x}}\right)} - 1} \]
    5. inv-pow63.2%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{\left(\sqrt{x}\right)}^{-1}}\right)} - 1 \]
    6. sqrt-pow263.2%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{{x}^{\left(\frac{-1}{2}\right)}}\right)} - 1 \]
    7. metadata-eval63.2%

      \[\leadsto e^{\mathsf{log1p}\left({x}^{\color{blue}{-0.5}}\right)} - 1 \]
  8. Applied egg-rr63.2%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({x}^{-0.5}\right)} - 1} \]
  9. Step-by-step derivation
    1. expm1-def44.8%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({x}^{-0.5}\right)\right)} \]
    2. expm1-log1p48.3%

      \[\leadsto \color{blue}{{x}^{-0.5}} \]
  10. Simplified48.3%

    \[\leadsto \color{blue}{{x}^{-0.5}} \]
  11. Final simplification48.3%

    \[\leadsto {x}^{-0.5} \]

Alternative 14: 5.2% accurate, 19.0× speedup?

\[\begin{array}{l} \\ \left(x \cdot 0.1875 + 0.5 \cdot \frac{1}{x}\right) - 0.25 \end{array} \]
(FPCore (x) :precision binary64 (- (+ (* x 0.1875) (* 0.5 (/ 1.0 x))) 0.25))
double code(double x) {
	return ((x * 0.1875) + (0.5 * (1.0 / x))) - 0.25;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = ((x * 0.1875d0) + (0.5d0 * (1.0d0 / x))) - 0.25d0
end function
public static double code(double x) {
	return ((x * 0.1875) + (0.5 * (1.0 / x))) - 0.25;
}
def code(x):
	return ((x * 0.1875) + (0.5 * (1.0 / x))) - 0.25
function code(x)
	return Float64(Float64(Float64(x * 0.1875) + Float64(0.5 * Float64(1.0 / x))) - 0.25)
end
function tmp = code(x)
	tmp = ((x * 0.1875) + (0.5 * (1.0 / x))) - 0.25;
end
code[x_] := N[(N[(N[(x * 0.1875), $MachinePrecision] + N[(0.5 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.25), $MachinePrecision]
\begin{array}{l}

\\
\left(x \cdot 0.1875 + 0.5 \cdot \frac{1}{x}\right) - 0.25
\end{array}
Derivation
  1. Initial program 69.3%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Step-by-step derivation
    1. frac-sub69.4%

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. associate-/r*69.4%

      \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
    3. *-un-lft-identity69.4%

      \[\leadsto \frac{\frac{\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}} \]
    4. *-rgt-identity69.4%

      \[\leadsto \frac{\frac{\sqrt{x + 1} - \color{blue}{\sqrt{x}}}{\sqrt{x}}}{\sqrt{x + 1}} \]
    5. +-commutative69.4%

      \[\leadsto \frac{\frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x}}{\sqrt{x}}}{\sqrt{x + 1}} \]
    6. +-commutative69.4%

      \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
  3. Applied egg-rr69.4%

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{1 + x}}} \]
  4. Step-by-step derivation
    1. flip--69.8%

      \[\leadsto \frac{\frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    2. div-inv69.8%

      \[\leadsto \frac{\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}}}{\sqrt{1 + x}} \]
    3. add-sqr-sqrt60.4%

      \[\leadsto \frac{\frac{\left(\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}\right) \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    4. +-commutative60.4%

      \[\leadsto \frac{\frac{\left(\color{blue}{\left(x + 1\right)} - \sqrt{x} \cdot \sqrt{x}\right) \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    5. add-sqr-sqrt70.7%

      \[\leadsto \frac{\frac{\left(\left(x + 1\right) - \color{blue}{x}\right) \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    6. associate--l+70.7%

      \[\leadsto \frac{\frac{\color{blue}{\left(x + \left(1 - x\right)\right)} \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    7. +-commutative70.7%

      \[\leadsto \frac{\frac{\left(x + \left(1 - x\right)\right) \cdot \frac{1}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    8. +-commutative70.7%

      \[\leadsto \frac{\frac{\left(x + \left(1 - x\right)\right) \cdot \frac{1}{\sqrt{x} + \sqrt{\color{blue}{x + 1}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  5. Applied egg-rr70.7%

    \[\leadsto \frac{\frac{\color{blue}{\left(x + \left(1 - x\right)\right) \cdot \frac{1}{\sqrt{x} + \sqrt{x + 1}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  6. Step-by-step derivation
    1. associate-*r/70.7%

      \[\leadsto \frac{\frac{\color{blue}{\frac{\left(x + \left(1 - x\right)\right) \cdot 1}{\sqrt{x} + \sqrt{x + 1}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    2. *-rgt-identity70.7%

      \[\leadsto \frac{\frac{\frac{\color{blue}{x + \left(1 - x\right)}}{\sqrt{x} + \sqrt{x + 1}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    3. associate-+r-70.7%

      \[\leadsto \frac{\frac{\frac{\color{blue}{\left(x + 1\right) - x}}{\sqrt{x} + \sqrt{x + 1}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    4. +-commutative70.7%

      \[\leadsto \frac{\frac{\frac{\color{blue}{\left(1 + x\right)} - x}{\sqrt{x} + \sqrt{x + 1}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    5. associate--l+99.4%

      \[\leadsto \frac{\frac{\frac{\color{blue}{1 + \left(x - x\right)}}{\sqrt{x} + \sqrt{x + 1}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  7. Simplified99.4%

    \[\leadsto \frac{\frac{\color{blue}{\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{x + 1}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  8. Taylor expanded in x around inf 55.1%

    \[\leadsto \frac{\color{blue}{\frac{0.5}{x}}}{\sqrt{1 + x}} \]
  9. Taylor expanded in x around 0 5.1%

    \[\leadsto \color{blue}{\left(0.1875 \cdot x + 0.5 \cdot \frac{1}{x}\right) - 0.25} \]
  10. Final simplification5.1%

    \[\leadsto \left(x \cdot 0.1875 + 0.5 \cdot \frac{1}{x}\right) - 0.25 \]

Alternative 15: 4.8% accurate, 41.8× speedup?

\[\begin{array}{l} \\ \frac{0.5}{x} + -0.25 \end{array} \]
(FPCore (x) :precision binary64 (+ (/ 0.5 x) -0.25))
double code(double x) {
	return (0.5 / x) + -0.25;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (0.5d0 / x) + (-0.25d0)
end function
public static double code(double x) {
	return (0.5 / x) + -0.25;
}
def code(x):
	return (0.5 / x) + -0.25
function code(x)
	return Float64(Float64(0.5 / x) + -0.25)
end
function tmp = code(x)
	tmp = (0.5 / x) + -0.25;
end
code[x_] := N[(N[(0.5 / x), $MachinePrecision] + -0.25), $MachinePrecision]
\begin{array}{l}

\\
\frac{0.5}{x} + -0.25
\end{array}
Derivation
  1. Initial program 69.3%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Step-by-step derivation
    1. frac-sub69.4%

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. associate-/r*69.4%

      \[\leadsto \color{blue}{\frac{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}}} \]
    3. *-un-lft-identity69.4%

      \[\leadsto \frac{\frac{\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x}}}{\sqrt{x + 1}} \]
    4. *-rgt-identity69.4%

      \[\leadsto \frac{\frac{\sqrt{x + 1} - \color{blue}{\sqrt{x}}}{\sqrt{x}}}{\sqrt{x + 1}} \]
    5. +-commutative69.4%

      \[\leadsto \frac{\frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x}}{\sqrt{x}}}{\sqrt{x + 1}} \]
    6. +-commutative69.4%

      \[\leadsto \frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{\color{blue}{1 + x}}} \]
  3. Applied egg-rr69.4%

    \[\leadsto \color{blue}{\frac{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x}}}{\sqrt{1 + x}}} \]
  4. Step-by-step derivation
    1. flip--69.8%

      \[\leadsto \frac{\frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    2. div-inv69.8%

      \[\leadsto \frac{\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}}}{\sqrt{1 + x}} \]
    3. add-sqr-sqrt60.4%

      \[\leadsto \frac{\frac{\left(\color{blue}{\left(1 + x\right)} - \sqrt{x} \cdot \sqrt{x}\right) \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    4. +-commutative60.4%

      \[\leadsto \frac{\frac{\left(\color{blue}{\left(x + 1\right)} - \sqrt{x} \cdot \sqrt{x}\right) \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    5. add-sqr-sqrt70.7%

      \[\leadsto \frac{\frac{\left(\left(x + 1\right) - \color{blue}{x}\right) \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    6. associate--l+70.7%

      \[\leadsto \frac{\frac{\color{blue}{\left(x + \left(1 - x\right)\right)} \cdot \frac{1}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    7. +-commutative70.7%

      \[\leadsto \frac{\frac{\left(x + \left(1 - x\right)\right) \cdot \frac{1}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    8. +-commutative70.7%

      \[\leadsto \frac{\frac{\left(x + \left(1 - x\right)\right) \cdot \frac{1}{\sqrt{x} + \sqrt{\color{blue}{x + 1}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  5. Applied egg-rr70.7%

    \[\leadsto \frac{\frac{\color{blue}{\left(x + \left(1 - x\right)\right) \cdot \frac{1}{\sqrt{x} + \sqrt{x + 1}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  6. Step-by-step derivation
    1. associate-*r/70.7%

      \[\leadsto \frac{\frac{\color{blue}{\frac{\left(x + \left(1 - x\right)\right) \cdot 1}{\sqrt{x} + \sqrt{x + 1}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    2. *-rgt-identity70.7%

      \[\leadsto \frac{\frac{\frac{\color{blue}{x + \left(1 - x\right)}}{\sqrt{x} + \sqrt{x + 1}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    3. associate-+r-70.7%

      \[\leadsto \frac{\frac{\frac{\color{blue}{\left(x + 1\right) - x}}{\sqrt{x} + \sqrt{x + 1}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    4. +-commutative70.7%

      \[\leadsto \frac{\frac{\frac{\color{blue}{\left(1 + x\right)} - x}{\sqrt{x} + \sqrt{x + 1}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
    5. associate--l+99.4%

      \[\leadsto \frac{\frac{\frac{\color{blue}{1 + \left(x - x\right)}}{\sqrt{x} + \sqrt{x + 1}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  7. Simplified99.4%

    \[\leadsto \frac{\frac{\color{blue}{\frac{1 + \left(x - x\right)}{\sqrt{x} + \sqrt{x + 1}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  8. Taylor expanded in x around inf 55.1%

    \[\leadsto \frac{\color{blue}{\frac{0.5}{x}}}{\sqrt{1 + x}} \]
  9. Taylor expanded in x around 0 4.7%

    \[\leadsto \color{blue}{0.5 \cdot \frac{1}{x} - 0.25} \]
  10. Step-by-step derivation
    1. sub-neg4.7%

      \[\leadsto \color{blue}{0.5 \cdot \frac{1}{x} + \left(-0.25\right)} \]
    2. associate-*r/4.7%

      \[\leadsto \color{blue}{\frac{0.5 \cdot 1}{x}} + \left(-0.25\right) \]
    3. metadata-eval4.7%

      \[\leadsto \frac{\color{blue}{0.5}}{x} + \left(-0.25\right) \]
    4. metadata-eval4.7%

      \[\leadsto \frac{0.5}{x} + \color{blue}{-0.25} \]
  11. Simplified4.7%

    \[\leadsto \color{blue}{\frac{0.5}{x} + -0.25} \]
  12. Final simplification4.7%

    \[\leadsto \frac{0.5}{x} + -0.25 \]

Alternative 16: 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 69.3%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Taylor expanded in x around 0 47.4%

    \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{1} \]
  3. Taylor expanded in x around inf 2.0%

    \[\leadsto \color{blue}{-1} \]
  4. Final simplification2.0%

    \[\leadsto -1 \]

Developer target: 99.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}} \end{array} \]
(FPCore (x)
 :precision binary64
 (/ 1.0 (+ (* (+ x 1.0) (sqrt x)) (* x (sqrt (+ x 1.0))))))
double code(double x) {
	return 1.0 / (((x + 1.0) * sqrt(x)) + (x * sqrt((x + 1.0))));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = 1.0d0 / (((x + 1.0d0) * sqrt(x)) + (x * sqrt((x + 1.0d0))))
end function
public static double code(double x) {
	return 1.0 / (((x + 1.0) * Math.sqrt(x)) + (x * Math.sqrt((x + 1.0))));
}
def code(x):
	return 1.0 / (((x + 1.0) * math.sqrt(x)) + (x * math.sqrt((x + 1.0))))
function code(x)
	return Float64(1.0 / Float64(Float64(Float64(x + 1.0) * sqrt(x)) + Float64(x * sqrt(Float64(x + 1.0)))))
end
function tmp = code(x)
	tmp = 1.0 / (((x + 1.0) * sqrt(x)) + (x * sqrt((x + 1.0))));
end
code[x_] := N[(1.0 / N[(N[(N[(x + 1.0), $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(x * N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}}
\end{array}

Reproduce

?
herbie shell --seed 2023302 
(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)))))