2isqrt (example 3.6)

Percentage Accurate: 69.2% → 99.6%
Time: 9.9s
Alternatives: 18
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

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

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

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


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

    1. Initial program 38.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x + x \cdot x}} \]
    9. Simplified79.6%

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{\sqrt{1 + x} + \sqrt{x}}}{x + \left(0.5 + \left(-\frac{\color{blue}{0.125}}{x}\right)\right)} \]
      6. distribute-neg-frac99.6%

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

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

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

    if 5.00000000000000018e-11 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1))))

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

        \[\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}} \]
    6. Step-by-step derivation
      1. add-sqr-sqrt99.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto {x}^{-0.5} - \sqrt{\frac{\color{blue}{1}}{\sqrt{1 + x} \cdot \sqrt{1 + x}}} \]
      11. add-sqr-sqrt99.9%

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

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

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

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

Alternative 2: 98.9% accurate, 0.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x + x \cdot x}} \]
  9. Simplified90.7%

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

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

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

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

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

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

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

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

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

Alternative 3: 99.6% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 38.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x + x \cdot x}} \]
    9. Simplified79.6%

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

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

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

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

    if 5.00000000000000018e-11 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1))))

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

        \[\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}} \]
    6. Step-by-step derivation
      1. add-sqr-sqrt99.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto {x}^{-0.5} - \sqrt{\frac{\color{blue}{1}}{\sqrt{1 + x} \cdot \sqrt{1 + x}}} \]
      11. add-sqr-sqrt99.9%

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

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

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

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

Alternative 4: 99.3% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 38.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4e-14 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1))))

    1. Initial program 99.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {x}^{-0.5} - \sqrt{\color{blue}{\frac{1 \cdot 1}{\sqrt{1 + x} \cdot \sqrt{1 + x}}}} \]
      10. metadata-eval99.4%

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

        \[\leadsto {x}^{-0.5} - \sqrt{\frac{1}{\color{blue}{1 + x}}} \]
      12. +-commutative99.4%

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

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

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

Alternative 5: 99.6% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x + x \cdot x}} \]
  9. Simplified90.7%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{-1}}{-\mathsf{hypot}\left(x, \sqrt{x}\right)}}{\sqrt{1 + x} + \sqrt{x}} \]
    4. neg-mul-199.5%

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

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

      \[\leadsto \frac{\frac{\color{blue}{1}}{\mathsf{hypot}\left(x, \sqrt{x}\right)}}{\sqrt{1 + x} + \sqrt{x}} \]
  13. Simplified99.5%

    \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)}}{\sqrt{1 + x} + \sqrt{x}}} \]
  14. Final simplification99.5%

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

Alternative 6: 83.3% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 99.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {x}^{-0.5} - \sqrt{\color{blue}{\frac{1 \cdot 1}{\sqrt{1 + x} \cdot \sqrt{1 + x}}}} \]
      10. metadata-eval99.4%

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

        \[\leadsto {x}^{-0.5} - \sqrt{\frac{1}{\color{blue}{1 + x}}} \]
      12. +-commutative99.4%

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

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

    if 1.1e8 < x

    1. Initial program 38.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 83.3% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 99.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9e7 < x

    1. Initial program 38.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 82.4% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 99.6%

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

      \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{0.5 \cdot x + 1}} \]
    3. Step-by-step derivation
      1. add-log-exp4.2%

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

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

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

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

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

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

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

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

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

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

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

    if 1.69999999999999996 < x

    1. Initial program 39.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({x}^{-0.5} - \frac{1}{\color{blue}{{\left(x + 1\right)}^{0.5}}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
      12. pow-flip39.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. +-commutative39.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-eval39.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-rr39.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-udef39.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-in39.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-eval39.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-lft39.0%

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

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

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

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

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

Alternative 9: 68.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 5.8:\\ \;\;\;\;{x}^{-0.5} + \frac{-1}{1 + x \cdot 0.5}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(x, x, x\right)}}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 5.8)
   (+ (pow x -0.5) (/ -1.0 (+ 1.0 (* x 0.5))))
   (sqrt (/ 1.0 (fma x x x)))))
double code(double x) {
	double tmp;
	if (x <= 5.8) {
		tmp = pow(x, -0.5) + (-1.0 / (1.0 + (x * 0.5)));
	} else {
		tmp = sqrt((1.0 / fma(x, x, x)));
	}
	return tmp;
}
function code(x)
	tmp = 0.0
	if (x <= 5.8)
		tmp = Float64((x ^ -0.5) + Float64(-1.0 / Float64(1.0 + Float64(x * 0.5))));
	else
		tmp = sqrt(Float64(1.0 / fma(x, x, x)));
	end
	return tmp
end
code[x_] := If[LessEqual[x, 5.8], N[(N[Power[x, -0.5], $MachinePrecision] + N[(-1.0 / N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(1.0 / N[(x * x + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(x, x, x\right)}}\\


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

    1. Initial program 99.6%

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

      \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{0.5 \cdot x + 1}} \]
    3. Step-by-step derivation
      1. add-log-exp4.2%

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

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

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

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

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

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

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

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

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

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

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

    if 5.79999999999999982 < x

    1. Initial program 39.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{1}}{\sqrt{x + x \cdot x}} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt38.1%

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, x, x\right)}}} \]
    8. Applied egg-rr38.1%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\mathsf{fma}\left(x, x, x\right)}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification72.3%

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

Alternative 10: 68.6% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 99.6%

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

      \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\color{blue}{0.5 \cdot x + 1}} \]
    3. Step-by-step derivation
      1. add-log-exp4.2%

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

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

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

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

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

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

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

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

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

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

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

    if 5.79999999999999982 < x

    1. Initial program 39.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 68.5% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
      2. 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.6%

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

    if 1.3999999999999999 < x

    1. Initial program 39.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 68.3% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
      2. 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.0%

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

    if 0.69999999999999996 < x

    1. Initial program 39.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 68.3% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
      2. 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.0%

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

    if 0.80000000000000004 < x

    1. Initial program 39.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt{\color{blue}{x \cdot x}}} \]
    9. Simplified38.1%

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

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

Alternative 14: 52.8% accurate, 2.0× speedup?

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

\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.599999999999999978

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
      2. 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.0%

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

    if 0.599999999999999978 < x

    1. Initial program 39.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{x} - 0.5 \cdot \frac{1}{{x}^{2}}} \]
    8. Step-by-step derivation
      1. unpow27.5%

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

        \[\leadsto \frac{1}{x} - \color{blue}{\frac{0.5 \cdot 1}{x \cdot x}} \]
      3. metadata-eval7.5%

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

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

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

Alternative 15: 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 72.6%

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

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

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

      \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]
    4. prod-diff72.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-identity72.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-neg72.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-identity72.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-pow72.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-pow270.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {x}^{-0.5} - \sqrt{\frac{\color{blue}{1}}{\sqrt{1 + x} \cdot \sqrt{1 + x}}} \]
    11. add-sqr-sqrt70.2%

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

      \[\leadsto {x}^{-0.5} - \sqrt{\frac{1}{\color{blue}{x + 1}}} \]
  7. Applied egg-rr70.2%

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

    \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \]
  9. Step-by-step derivation
    1. expm1-log1p-u51.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{x}^{-0.5}} \]
  12. Simplified54.7%

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

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

Alternative 16: 7.4% 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 72.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{x + 0.5}} \]
  9. Simplified7.3%

    \[\leadsto \frac{1}{\color{blue}{x + 0.5}} \]
  10. Final simplification7.3%

    \[\leadsto \frac{1}{x + 0.5} \]

Alternative 17: 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 72.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{x}} \]
  8. Final simplification7.2%

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

Alternative 18: 1.9% accurate, 209.0× speedup?

\[\begin{array}{l} \\ -1 \end{array} \]
(FPCore (x) :precision binary64 -1.0)
double code(double x) {
	return -1.0;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = -1.0d0
end function
public static double code(double x) {
	return -1.0;
}
def code(x):
	return -1.0
function code(x)
	return -1.0
end
function tmp = code(x)
	tmp = -1.0;
end
code[x_] := -1.0
\begin{array}{l}

\\
-1
\end{array}
Derivation
  1. Initial program 72.6%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt[3]{{x}^{-0.5}} \cdot \sqrt[3]{\frac{1}{x}} + \left(-\frac{-1}{\sqrt{1 + x}} \cdot -1\right)\right)} + \mathsf{fma}\left(-\frac{-1}{\sqrt{1 + x}}, -1, \frac{-1}{\sqrt{1 + x}} \cdot -1\right) \]
    2. distribute-rgt-neg-in60.0%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{{x}^{-0.5}}, \sqrt[3]{\frac{1}{x}}, \frac{-1}{\sqrt{1 + x}}\right)} \]
  6. Taylor expanded in x around 0 1.9%

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

    \[\leadsto -1 \]

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