2isqrt (example 3.6)

Percentage Accurate: 69.2% → 99.8%
Time: 10.5s
Alternatives: 17
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 17 alternatives:

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

Initial Program: 69.2% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 76.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1 + \left(x - x\right)}{\sqrt{x}}}{\color{blue}{\sqrt{x + 1} \cdot \sqrt{x + 1} + \sqrt{x + 1} \cdot \sqrt{x}}} \]
      11. rem-square-sqrt99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000003e129 < x

    1. Initial program 56.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{0.5}{x}}}{\sqrt{x}} \]
    9. Step-by-step derivation
      1. div-inv99.8%

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

        \[\leadsto \frac{0.5 \cdot \frac{\color{blue}{1 \cdot 1}}{x}}{\sqrt{x}} \]
      3. add-sqr-sqrt99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot {\left({x}^{-0.5}\right)}^{3}} \]
    11. Step-by-step derivation
      1. unpow399.5%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\left({x}^{-0.5} \cdot {x}^{-0.5}\right) \cdot {x}^{-0.5}\right)} \]
      2. pow-sqr99.8%

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

        \[\leadsto 0.5 \cdot \left({x}^{\color{blue}{-1}} \cdot {x}^{-0.5}\right) \]
      4. unpow-199.8%

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

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot 1}{x}} \cdot {x}^{-0.5} \]
      7. metadata-eval99.8%

        \[\leadsto \frac{\color{blue}{0.5}}{x} \cdot {x}^{-0.5} \]
    12. Simplified99.8%

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

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

Alternative 2: 99.5% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1 + \left(x - x\right)}{\sqrt{x}}}{\color{blue}{\sqrt{x + 1} \cdot \sqrt{x + 1} + \sqrt{x + 1} \cdot \sqrt{x}}} \]
    11. rem-square-sqrt99.6%

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

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

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

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

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

Alternative 3: 99.7% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6e3 < x

    1. Initial program 37.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 99.1% accurate, 1.6× speedup?

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

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.429999999999999993 < x

    1. Initial program 38.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 99.0% accurate, 1.7× speedup?

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

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.429999999999999993 < x

    1. Initial program 38.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1 + \left(x - x\right)}{\sqrt{x}}}{\left(1 + x\right) + \left(0.5 + \color{blue}{\left(x + \left(-\frac{1}{x}\right) \cdot 0.125\right)}\right)} \]
      4. *-lft-identity98.8%

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

        \[\leadsto \frac{\frac{1 + \left(x - x\right)}{\sqrt{x}}}{\left(1 + x\right) + \left(0.5 + \left(\color{blue}{\left(-1 \cdot -1\right)} \cdot x + \left(-\frac{1}{x}\right) \cdot 0.125\right)\right)} \]
      6. rem-square-sqrt0.0%

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

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

        \[\leadsto \frac{\frac{1 + \left(x - x\right)}{\sqrt{x}}}{\left(1 + x\right) + \left(0.5 + \left(\color{blue}{-1 \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot x\right)} + \left(-\frac{1}{x}\right) \cdot 0.125\right)\right)} \]
      9. distribute-neg-frac0.0%

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 99.0% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.429999999999999993 < x

    1. Initial program 38.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1 + \left(x - x\right)}{\sqrt{x}}}{1.5 + \left(x \cdot 2 - \color{blue}{\frac{0.125 \cdot 1}{x}}\right)} \]
      4. metadata-eval98.8%

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

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

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

Alternative 7: 98.8% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.40000000000000002 < x

    1. Initial program 38.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 98.7% accurate, 1.8× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5}{x} - \frac{0.375}{x \cdot x}}{\sqrt{x}}\\


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.1000000000000001 < x

    1. Initial program 38.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{0.5 \cdot 1}{x}} - 0.375 \cdot \frac{1}{{x}^{2}}}{\sqrt{x}} \]
      2. metadata-eval98.5%

        \[\leadsto \frac{\frac{\color{blue}{0.5}}{x} - 0.375 \cdot \frac{1}{{x}^{2}}}{\sqrt{x}} \]
      3. unpow298.5%

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

        \[\leadsto \frac{\frac{0.5}{x} - \color{blue}{\frac{0.375 \cdot 1}{x \cdot x}}}{\sqrt{x}} \]
      5. metadata-eval98.5%

        \[\leadsto \frac{\frac{0.5}{x} - \frac{\color{blue}{0.375}}{x \cdot x}}{\sqrt{x}} \]
    10. Simplified98.5%

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

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

Alternative 9: 98.1% accurate, 1.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5}{x}}{\sqrt{x}}\\


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1 < x

    1. Initial program 38.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{0.5}{x}}}{\sqrt{x}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.5%

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

Alternative 10: 97.1% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.660000000000000031 < x

    1. Initial program 38.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{0.5}{x}}}{\sqrt{x}} \]
    9. Step-by-step derivation
      1. add-cube-cbrt96.3%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{\frac{0.5}{x}}{\sqrt{x}}} \cdot \sqrt[3]{\frac{\frac{0.5}{x}}{\sqrt{x}}}\right) \cdot \sqrt[3]{\frac{\frac{0.5}{x}}{\sqrt{x}}}} \]
      2. pow396.3%

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

        \[\leadsto {\left(\sqrt[3]{\color{blue}{\frac{0.5}{\sqrt{x} \cdot x}}}\right)}^{3} \]
      4. cbrt-div95.6%

        \[\leadsto {\color{blue}{\left(\frac{\sqrt[3]{0.5}}{\sqrt[3]{\sqrt{x} \cdot x}}\right)}}^{3} \]
      5. add-sqr-sqrt95.4%

        \[\leadsto {\left(\frac{\sqrt[3]{0.5}}{\sqrt[3]{\sqrt{x} \cdot \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}}}\right)}^{3} \]
      6. cube-unmult95.4%

        \[\leadsto {\left(\frac{\sqrt[3]{0.5}}{\sqrt[3]{\color{blue}{{\left(\sqrt{x}\right)}^{3}}}}\right)}^{3} \]
      7. pow395.4%

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

        \[\leadsto {\left(\frac{\sqrt[3]{0.5}}{\color{blue}{\sqrt{x}}}\right)}^{3} \]
    10. Applied egg-rr96.5%

      \[\leadsto \color{blue}{{\left(\frac{\sqrt[3]{0.5}}{\sqrt{x}}\right)}^{3}} \]
    11. Step-by-step derivation
      1. cube-div95.7%

        \[\leadsto \color{blue}{\frac{{\left(\sqrt[3]{0.5}\right)}^{3}}{{\left(\sqrt{x}\right)}^{3}}} \]
      2. rem-cube-cbrt96.2%

        \[\leadsto \frac{\color{blue}{0.5}}{{\left(\sqrt{x}\right)}^{3}} \]
      3. unpow396.3%

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

        \[\leadsto \frac{0.5}{\color{blue}{x} \cdot \sqrt{x}} \]
    12. Simplified96.6%

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

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

Alternative 11: 97.8% accurate, 2.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.5}{x}}{\sqrt{x}}\\


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.660000000000000031 < x

    1. Initial program 38.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 52.8% accurate, 2.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{x} - \frac{0.5}{x \cdot x}\\


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.619999999999999996 < x

    1. Initial program 38.7%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{1}}{x + 0.5} \]
    8. Taylor expanded in x around inf 7.8%

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

        \[\leadsto \frac{1}{x} - \color{blue}{\frac{0.5 \cdot 1}{{x}^{2}}} \]
      2. metadata-eval7.8%

        \[\leadsto \frac{1}{x} - \frac{\color{blue}{0.5}}{{x}^{2}} \]
      3. unpow27.8%

        \[\leadsto \frac{1}{x} - \frac{0.5}{\color{blue}{x \cdot x}} \]
    10. Simplified7.8%

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

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

Alternative 13: 97.1% accurate, 2.0× speedup?

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

\mathbf{else}:\\
\;\;\;\;\frac{0.5}{{x}^{1.5}}\\


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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.660000000000000031 < x

    1. Initial program 38.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{0.5}{x}}}{\sqrt{x}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u97.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{0.5}{{x}^{1.5}}\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def96.6%

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

        \[\leadsto \color{blue}{\frac{0.5}{{x}^{1.5}}} \]
    12. Simplified96.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{x}^{-0.5}} \]
  8. Simplified52.9%

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

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

Alternative 15: 7.5% accurate, 41.8× speedup?

\[\begin{array}{l} \\ \frac{1}{x + 0.5} \end{array} \]
(FPCore (x) :precision binary64 (/ 1.0 (+ x 0.5)))
double code(double x) {
	return 1.0 / (x + 0.5);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = 1.0d0 / (x + 0.5d0)
end function
public static double code(double x) {
	return 1.0 / (x + 0.5);
}
def code(x):
	return 1.0 / (x + 0.5)
function code(x)
	return Float64(1.0 / Float64(x + 0.5))
end
function tmp = code(x)
	tmp = 1.0 / (x + 0.5);
end
code[x_] := N[(1.0 / N[(x + 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{x + 0.5}
\end{array}
Derivation
  1. Initial program 70.6%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Step-by-step derivation
    1. frac-sub70.6%

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. *-un-lft-identity70.6%

      \[\leadsto \frac{\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    3. +-commutative70.6%

      \[\leadsto \frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    4. *-rgt-identity70.6%

      \[\leadsto \frac{\sqrt{1 + x} - \color{blue}{\sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    5. sqrt-unprod70.6%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{\sqrt{x \cdot \left(x + 1\right)}}} \]
    6. +-commutative70.6%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \color{blue}{\left(1 + x\right)}}} \]
  3. Applied egg-rr70.6%

    \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \left(1 + x\right)}}} \]
  4. Taylor expanded in x around inf 21.6%

    \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{0.5 + x}} \]
  5. Step-by-step derivation
    1. +-commutative21.6%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{x + 0.5}} \]
  6. Simplified21.6%

    \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{x + 0.5}} \]
  7. Taylor expanded in x around 0 7.3%

    \[\leadsto \frac{\color{blue}{1}}{x + 0.5} \]
  8. Final simplification7.3%

    \[\leadsto \frac{1}{x + 0.5} \]

Alternative 16: 7.4% accurate, 69.7× speedup?

\[\begin{array}{l} \\ \frac{1}{x} \end{array} \]
(FPCore (x) :precision binary64 (/ 1.0 x))
double code(double x) {
	return 1.0 / x;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = 1.0d0 / x
end function
public static double code(double x) {
	return 1.0 / x;
}
def code(x):
	return 1.0 / x
function code(x)
	return Float64(1.0 / x)
end
function tmp = code(x)
	tmp = 1.0 / x;
end
code[x_] := N[(1.0 / x), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{x}
\end{array}
Derivation
  1. Initial program 70.6%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Step-by-step derivation
    1. frac-sub70.6%

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. *-un-lft-identity70.6%

      \[\leadsto \frac{\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    3. +-commutative70.6%

      \[\leadsto \frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    4. *-rgt-identity70.6%

      \[\leadsto \frac{\sqrt{1 + x} - \color{blue}{\sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    5. sqrt-unprod70.6%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{\sqrt{x \cdot \left(x + 1\right)}}} \]
    6. +-commutative70.6%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \color{blue}{\left(1 + x\right)}}} \]
  3. Applied egg-rr70.6%

    \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \left(1 + x\right)}}} \]
  4. Taylor expanded in x around inf 21.6%

    \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{0.5 + x}} \]
  5. Step-by-step derivation
    1. +-commutative21.6%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{x + 0.5}} \]
  6. Simplified21.6%

    \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{x + 0.5}} \]
  7. Taylor expanded in x around 0 7.3%

    \[\leadsto \frac{\color{blue}{1}}{x + 0.5} \]
  8. Taylor expanded in x around inf 7.3%

    \[\leadsto \color{blue}{\frac{1}{x}} \]
  9. Final simplification7.3%

    \[\leadsto \frac{1}{x} \]

Alternative 17: 5.8% accurate, 209.0× speedup?

\[\begin{array}{l} \\ 2 \end{array} \]
(FPCore (x) :precision binary64 2.0)
double code(double x) {
	return 2.0;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = 2.0d0
end function
public static double code(double x) {
	return 2.0;
}
def code(x):
	return 2.0
function code(x)
	return 2.0
end
function tmp = code(x)
	tmp = 2.0;
end
code[x_] := 2.0
\begin{array}{l}

\\
2
\end{array}
Derivation
  1. Initial program 70.6%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Step-by-step derivation
    1. frac-sub70.6%

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. *-un-lft-identity70.6%

      \[\leadsto \frac{\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    3. +-commutative70.6%

      \[\leadsto \frac{\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    4. *-rgt-identity70.6%

      \[\leadsto \frac{\sqrt{1 + x} - \color{blue}{\sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    5. sqrt-unprod70.6%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{\sqrt{x \cdot \left(x + 1\right)}}} \]
    6. +-commutative70.6%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \color{blue}{\left(1 + x\right)}}} \]
  3. Applied egg-rr70.6%

    \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \left(1 + x\right)}}} \]
  4. Taylor expanded in x around inf 21.6%

    \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{0.5 + x}} \]
  5. Step-by-step derivation
    1. +-commutative21.6%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{x + 0.5}} \]
  6. Simplified21.6%

    \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{x + 0.5}} \]
  7. Taylor expanded in x around 0 5.8%

    \[\leadsto \color{blue}{2} \]
  8. Final simplification5.8%

    \[\leadsto 2 \]

Developer target: 98.9% 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 2023200 
(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)))))