2isqrt (example 3.6)

Percentage Accurate: 39.2% → 99.7%
Time: 10.8s
Alternatives: 15
Speedup: 1.9×

Specification

?
\[x > 1 \land x < 10^{+308}\]
\[\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 15 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: 39.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.7% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 57.8%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip--57.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5e16 < x

    1. Initial program 42.2%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip--42.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{\color{blue}{e^{\left(-\log x\right) \cdot 0.5}} \cdot 2} \]
      6. distribute-lft-neg-out42.2%

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{e^{\color{blue}{-\log x \cdot 0.5}} \cdot 2} \]
      7. distribute-rgt-neg-in42.2%

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

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{e^{\log x \cdot \color{blue}{-0.5}} \cdot 2} \]
      9. exp-to-pow42.2%

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

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

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

Alternative 2: 99.3% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)}\\
t\_0 \cdot \left(t\_0 \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 43.6%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. flip--43.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \left(\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\right)} \]
  11. Add Preprocessing

Alternative 3: 99.3% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)}\\
t\_0 \cdot \frac{t\_0}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}
\end{array}
\end{array}
Derivation
  1. Initial program 43.6%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. flip--43.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \frac{\frac{1}{\sqrt{\color{blue}{x \cdot x + x}}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    11. add-sqr-sqrt86.1%

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

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

    \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)} \cdot \frac{\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
  11. Add Preprocessing

Alternative 4: 99.1% accurate, 0.3× speedup?

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

\\
{\left(\frac{\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)}}{\mathsf{hypot}\left({x}^{-0.25}, {\left(1 + x\right)}^{-0.25}\right)}\right)}^{2}
\end{array}
Derivation
  1. Initial program 43.6%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. flip--43.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)}}{\mathsf{hypot}\left({x}^{-0.25}, {\left(1 + x\right)}^{-0.25}\right)} \cdot \frac{\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)}}{\mathsf{hypot}\left({x}^{-0.25}, {\left(1 + x\right)}^{-0.25}\right)}} \]
  11. Step-by-step derivation
    1. unpow299.2%

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

    \[\leadsto \color{blue}{{\left(\frac{\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)}}{\mathsf{hypot}\left({x}^{-0.25}, {\left(1 + x\right)}^{-0.25}\right)}\right)}^{2}} \]
  13. Add Preprocessing

Alternative 5: 99.1% accurate, 0.3× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. flip--43.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)}}{\mathsf{hypot}\left({x}^{-0.25}, {\left(1 + x\right)}^{-0.25}\right)} \cdot \frac{\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)}}{\mathsf{hypot}\left({x}^{-0.25}, {\left(1 + x\right)}^{-0.25}\right)}} \]
  11. Step-by-step derivation
    1. unpow299.2%

      \[\leadsto \color{blue}{{\left(\frac{\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right)}}{\mathsf{hypot}\left({x}^{-0.25}, {\left(1 + x\right)}^{-0.25}\right)}\right)}^{2}} \]
    2. associate-/l/99.1%

      \[\leadsto {\color{blue}{\left(\frac{1}{\mathsf{hypot}\left({x}^{-0.25}, {\left(1 + x\right)}^{-0.25}\right) \cdot \mathsf{hypot}\left(x, \sqrt{x}\right)}\right)}}^{2} \]
    3. *-commutative99.1%

      \[\leadsto {\left(\frac{1}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{x}\right) \cdot \mathsf{hypot}\left({x}^{-0.25}, {\left(1 + x\right)}^{-0.25}\right)}}\right)}^{2} \]
  12. Simplified99.1%

    \[\leadsto \color{blue}{{\left(\frac{1}{\mathsf{hypot}\left(x, \sqrt{x}\right) \cdot \mathsf{hypot}\left({x}^{-0.25}, {\left(1 + x\right)}^{-0.25}\right)}\right)}^{2}} \]
  13. Add Preprocessing

Alternative 6: 82.5% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 x)) (/.f64 #s(literal 1 binary64) (sqrt.f64 (+.f64 x #s(literal 1 binary64))))) < 1e-13

    1. Initial program 41.8%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. frac-sub41.8%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\sqrt{\frac{1}{x}} \cdot 0.5}}{\sqrt{x \cdot \left(1 + x\right)}} \]
      2. unpow1/285.0%

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

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

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

        \[\leadsto \frac{\color{blue}{e^{\left(-\log x\right) \cdot 0.5}} \cdot 0.5}{\sqrt{x \cdot \left(1 + x\right)}} \]
      6. distribute-lft-neg-out82.2%

        \[\leadsto \frac{e^{\color{blue}{-\log x \cdot 0.5}} \cdot 0.5}{\sqrt{x \cdot \left(1 + x\right)}} \]
      7. distribute-rgt-neg-in82.2%

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

        \[\leadsto \frac{e^{\log x \cdot \color{blue}{-0.5}} \cdot 0.5}{\sqrt{x \cdot \left(1 + x\right)}} \]
      9. exp-to-pow85.0%

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

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

    if 1e-13 < (-.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 x)) (/.f64 #s(literal 1 binary64) (sqrt.f64 (+.f64 x #s(literal 1 binary64)))))

    1. Initial program 83.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto {x}^{-0.5} + \color{blue}{\frac{-1}{\sqrt{1 + x}} \cdot 1} \]
      2. cancel-sign-sub84.8%

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

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

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

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

        \[\leadsto {x}^{-0.5} - \frac{\color{blue}{1}}{\sqrt{1 + x}} \]
      7. unpow1/284.8%

        \[\leadsto {x}^{-0.5} - \frac{1}{\color{blue}{{\left(1 + x\right)}^{0.5}}} \]
      8. exp-to-pow82.6%

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

        \[\leadsto {x}^{-0.5} - \frac{1}{e^{\color{blue}{\mathsf{log1p}\left(x\right)} \cdot 0.5}} \]
      10. *-commutative82.6%

        \[\leadsto {x}^{-0.5} - \frac{1}{e^{\color{blue}{0.5 \cdot \mathsf{log1p}\left(x\right)}}} \]
      11. exp-neg82.7%

        \[\leadsto {x}^{-0.5} - \color{blue}{e^{-0.5 \cdot \mathsf{log1p}\left(x\right)}} \]
      12. *-commutative82.7%

        \[\leadsto {x}^{-0.5} - e^{-\color{blue}{\mathsf{log1p}\left(x\right) \cdot 0.5}} \]
      13. distribute-rgt-neg-in82.7%

        \[\leadsto {x}^{-0.5} - e^{\color{blue}{\mathsf{log1p}\left(x\right) \cdot \left(-0.5\right)}} \]
      14. log1p-undefine82.7%

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

        \[\leadsto {x}^{-0.5} - e^{\log \left(1 + x\right) \cdot \color{blue}{-0.5}} \]
      16. exp-to-pow85.1%

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

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

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

Alternative 7: 82.4% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 x)) (/.f64 #s(literal 1 binary64) (sqrt.f64 (+.f64 x #s(literal 1 binary64))))) < 1e-13

    1. Initial program 41.8%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip--41.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{\mathsf{fma}\left(x, x, x\right)}}{\color{blue}{2 \cdot \sqrt{\frac{1}{x}}}} \]
    10. Step-by-step derivation
      1. *-commutative41.9%

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

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

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

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

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{\color{blue}{e^{\left(-\log x\right) \cdot 0.5}} \cdot 2} \]
      6. distribute-lft-neg-out41.9%

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{e^{\color{blue}{-\log x \cdot 0.5}} \cdot 2} \]
      7. distribute-rgt-neg-in41.9%

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

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{e^{\log x \cdot \color{blue}{-0.5}} \cdot 2} \]
      9. exp-to-pow41.9%

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{\color{blue}{{x}^{-0.5}} \cdot 2} \]
    11. Simplified84.9%

      \[\leadsto \frac{\frac{1}{\mathsf{fma}\left(x, x, x\right)}}{\color{blue}{{x}^{-0.5} \cdot 2}} \]
    12. Step-by-step derivation
      1. fma-undefine85.6%

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

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

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

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

    if 1e-13 < (-.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 x)) (/.f64 #s(literal 1 binary64) (sqrt.f64 (+.f64 x #s(literal 1 binary64)))))

    1. Initial program 83.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto {x}^{-0.5} + \color{blue}{\frac{-1}{\sqrt{1 + x}} \cdot 1} \]
      2. cancel-sign-sub84.8%

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

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

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

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

        \[\leadsto {x}^{-0.5} - \frac{\color{blue}{1}}{\sqrt{1 + x}} \]
      7. unpow1/284.8%

        \[\leadsto {x}^{-0.5} - \frac{1}{\color{blue}{{\left(1 + x\right)}^{0.5}}} \]
      8. exp-to-pow82.6%

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

        \[\leadsto {x}^{-0.5} - \frac{1}{e^{\color{blue}{\mathsf{log1p}\left(x\right)} \cdot 0.5}} \]
      10. *-commutative82.6%

        \[\leadsto {x}^{-0.5} - \frac{1}{e^{\color{blue}{0.5 \cdot \mathsf{log1p}\left(x\right)}}} \]
      11. exp-neg82.7%

        \[\leadsto {x}^{-0.5} - \color{blue}{e^{-0.5 \cdot \mathsf{log1p}\left(x\right)}} \]
      12. *-commutative82.7%

        \[\leadsto {x}^{-0.5} - e^{-\color{blue}{\mathsf{log1p}\left(x\right) \cdot 0.5}} \]
      13. distribute-rgt-neg-in82.7%

        \[\leadsto {x}^{-0.5} - e^{\color{blue}{\mathsf{log1p}\left(x\right) \cdot \left(-0.5\right)}} \]
      14. log1p-undefine82.7%

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

        \[\leadsto {x}^{-0.5} - e^{\log \left(1 + x\right) \cdot \color{blue}{-0.5}} \]
      16. exp-to-pow85.1%

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

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

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

Alternative 8: 98.2% accurate, 0.5× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. frac-sub43.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{1 \cdot \frac{1}{\mathsf{hypot}\left(\sqrt{x}, x\right) \cdot \left(\sqrt{x} + \sqrt{1 + x}\right)}} \]
  11. Step-by-step derivation
    1. *-lft-identity98.8%

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

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

    \[\leadsto \color{blue}{\frac{1}{\left(\sqrt{x} + \sqrt{1 + x}\right) \cdot \mathsf{hypot}\left(\sqrt{x}, x\right)}} \]
  13. Add Preprocessing

Alternative 9: 99.6% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 17.7%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip--17.7%

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      9. inv-pow18.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000008e99 < x

    1. Initial program 57.6%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. frac-sub57.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 83.4% accurate, 1.0× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. flip--43.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 38.2% accurate, 1.8× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0\\


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

    1. Initial program 14.1%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip--14.1%

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      9. inv-pow14.6%

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

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

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

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

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

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

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

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

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

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

    if 4.69999999999999968e153 < x

    1. Initial program 72.6%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. inv-pow72.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{0} \cdot \sqrt{\frac{1}{x}} \]
      3. mul0-lft72.6%

        \[\leadsto \color{blue}{0} \]
    7. Simplified72.6%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification41.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 4.7 \cdot 10^{+153}:\\ \;\;\;\;\frac{\frac{1}{x}}{1 + {x}^{-0.5}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 81.3% accurate, 1.9× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. flip--43.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\frac{1}{\mathsf{fma}\left(x, x, x\right)}}{\color{blue}{2 \cdot \sqrt{\frac{1}{x}}}} \]
  10. Step-by-step derivation
    1. *-commutative41.8%

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

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

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

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

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{\color{blue}{e^{\left(-\log x\right) \cdot 0.5}} \cdot 2} \]
    6. distribute-lft-neg-out41.8%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{e^{\color{blue}{-\log x \cdot 0.5}} \cdot 2} \]
    7. distribute-rgt-neg-in41.8%

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

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{e^{\log x \cdot \color{blue}{-0.5}} \cdot 2} \]
    9. exp-to-pow41.8%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{\color{blue}{{x}^{-0.5}} \cdot 2} \]
  11. Simplified82.9%

    \[\leadsto \frac{\frac{1}{\mathsf{fma}\left(x, x, x\right)}}{\color{blue}{{x}^{-0.5} \cdot 2}} \]
  12. Step-by-step derivation
    1. fma-undefine86.2%

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

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

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

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

    \[\leadsto \frac{\frac{1}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} \cdot 2} \]
  15. Add Preprocessing

Alternative 13: 37.6% accurate, 1.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0\\


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

    1. Initial program 15.8%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip--15.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}} \]
    7. Step-by-step derivation
      1. *-commutative7.9%

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

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

    if 1.12e123 < x

    1. Initial program 63.2%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. inv-pow63.2%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} + -1 \cdot \sqrt{\frac{1}{x}}} \]
    6. Step-by-step derivation
      1. distribute-rgt1-in63.2%

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

        \[\leadsto \color{blue}{0} \cdot \sqrt{\frac{1}{x}} \]
      3. mul0-lft63.2%

        \[\leadsto \color{blue}{0} \]
    7. Simplified63.2%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification40.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.12 \cdot 10^{+123}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{x}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 37.5% accurate, 2.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0\\


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

    1. Initial program 15.8%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip--15.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \]
    6. Step-by-step derivation
      1. unpow1/27.8%

        \[\leadsto \color{blue}{{\left(\frac{1}{x}\right)}^{0.5}} \]
      2. rem-exp-log7.8%

        \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log x}}}\right)}^{0.5} \]
      3. exp-neg7.8%

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

        \[\leadsto \color{blue}{e^{\left(-\log x\right) \cdot 0.5}} \]
      5. distribute-lft-neg-out7.8%

        \[\leadsto e^{\color{blue}{-\log x \cdot 0.5}} \]
      6. distribute-rgt-neg-in7.8%

        \[\leadsto e^{\color{blue}{\log x \cdot \left(-0.5\right)}} \]
      7. metadata-eval7.8%

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

        \[\leadsto \color{blue}{{x}^{-0.5}} \]
    7. Simplified7.8%

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

    if 8.2000000000000004e122 < x

    1. Initial program 63.2%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. inv-pow63.2%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} + -1 \cdot \sqrt{\frac{1}{x}}} \]
    6. Step-by-step derivation
      1. distribute-rgt1-in63.2%

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

        \[\leadsto \color{blue}{0} \cdot \sqrt{\frac{1}{x}} \]
      3. mul0-lft63.2%

        \[\leadsto \color{blue}{0} \]
    7. Simplified63.2%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 15: 36.2% accurate, 209.0× speedup?

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

\\
0
\end{array}
Derivation
  1. Initial program 43.6%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. inv-pow43.6%

      \[\leadsto \color{blue}{{\left(\sqrt{x}\right)}^{-1}} - \frac{1}{\sqrt{x + 1}} \]
    2. add-cube-cbrt20.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} + -1 \cdot \sqrt{\frac{1}{x}}} \]
  6. Step-by-step derivation
    1. distribute-rgt1-in38.7%

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

      \[\leadsto \color{blue}{0} \cdot \sqrt{\frac{1}{x}} \]
    3. mul0-lft38.7%

      \[\leadsto \color{blue}{0} \]
  7. Simplified38.7%

    \[\leadsto \color{blue}{0} \]
  8. Add Preprocessing

Developer Target 1: 98.2% 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 2024152 
(FPCore (x)
  :name "2isqrt (example 3.6)"
  :precision binary64
  :pre (and (> x 1.0) (< x 1e+308))

  :alt
  (! :herbie-platform default (/ 1 (+ (* (+ x 1) (sqrt x)) (* x (sqrt (+ x 1))))))

  (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))