2isqrt (example 3.6)

Percentage Accurate: 38.8% → 99.0%
Time: 14.3s
Alternatives: 6
Speedup: 2.0×

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 6 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: 38.8% 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.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ 0.3125 \cdot {x}^{-3.5} - \mathsf{fma}\left(-0.5, \frac{{x}^{-0.5}}{x}, \frac{{x}^{-0.5}}{{x}^{2}} \cdot 0.375\right) \end{array} \]
(FPCore (x)
 :precision binary64
 (-
  (* 0.3125 (pow x -3.5))
  (fma -0.5 (/ (pow x -0.5) x) (* (/ (pow x -0.5) (pow x 2.0)) 0.375))))
double code(double x) {
	return (0.3125 * pow(x, -3.5)) - fma(-0.5, (pow(x, -0.5) / x), ((pow(x, -0.5) / pow(x, 2.0)) * 0.375));
}
function code(x)
	return Float64(Float64(0.3125 * (x ^ -3.5)) - fma(-0.5, Float64((x ^ -0.5) / x), Float64(Float64((x ^ -0.5) / (x ^ 2.0)) * 0.375)))
end
code[x_] := N[(N[(0.3125 * N[Power[x, -3.5], $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(N[Power[x, -0.5], $MachinePrecision] / x), $MachinePrecision] + N[(N[(N[Power[x, -0.5], $MachinePrecision] / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
0.3125 \cdot {x}^{-3.5} - \mathsf{fma}\left(-0.5, \frac{{x}^{-0.5}}{x}, \frac{{x}^{-0.5}}{{x}^{2}} \cdot 0.375\right)
\end{array}
Derivation
  1. Initial program 46.0%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-exp-log7.4%

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

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

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

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

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

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

    \[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{e^{-0.5 \cdot \mathsf{log1p}\left(x\right)}} \]
  5. Taylor expanded in x around inf 7.1%

    \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{x}} + 0.3125 \cdot \frac{e^{--0.5 \cdot \log \left(\frac{1}{x}\right)}}{{x}^{3}}\right) - \left(e^{--0.5 \cdot \log \left(\frac{1}{x}\right)} + \left(-0.5 \cdot \frac{e^{--0.5 \cdot \log \left(\frac{1}{x}\right)}}{x} + 0.375 \cdot \frac{e^{--0.5 \cdot \log \left(\frac{1}{x}\right)}}{{x}^{2}}\right)\right)} \]
  6. Step-by-step derivation
    1. associate--r+7.8%

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

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.3125, \frac{{x}^{-0.5}}{{x}^{3}}, {x}^{-0.5}\right) - {x}^{-0.5}\right) - \mathsf{fma}\left(-0.5, \frac{{x}^{-0.5}}{x}, \frac{{x}^{-0.5}}{{x}^{2}} \cdot 0.375\right)} \]
  8. Step-by-step derivation
    1. sub-neg99.0%

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.3125, \frac{{x}^{-0.5}}{{x}^{3}}, {x}^{-0.5}\right) + \left(-{x}^{-0.5}\right)\right)} - \mathsf{fma}\left(-0.5, \frac{{x}^{-0.5}}{x}, \frac{{x}^{-0.5}}{{x}^{2}} \cdot 0.375\right) \]
    2. pow-div99.0%

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

      \[\leadsto \left(\mathsf{fma}\left(0.3125, {x}^{\color{blue}{-3.5}}, {x}^{-0.5}\right) + \left(-{x}^{-0.5}\right)\right) - \mathsf{fma}\left(-0.5, \frac{{x}^{-0.5}}{x}, \frac{{x}^{-0.5}}{{x}^{2}} \cdot 0.375\right) \]
  9. Applied egg-rr99.0%

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.3125, {x}^{-3.5}, {x}^{-0.5}\right) + \left(-{x}^{-0.5}\right)\right)} - \mathsf{fma}\left(-0.5, \frac{{x}^{-0.5}}{x}, \frac{{x}^{-0.5}}{{x}^{2}} \cdot 0.375\right) \]
  10. Step-by-step derivation
    1. fma-undefine99.0%

      \[\leadsto \left(\color{blue}{\left(0.3125 \cdot {x}^{-3.5} + {x}^{-0.5}\right)} + \left(-{x}^{-0.5}\right)\right) - \mathsf{fma}\left(-0.5, \frac{{x}^{-0.5}}{x}, \frac{{x}^{-0.5}}{{x}^{2}} \cdot 0.375\right) \]
    2. associate-+r+99.4%

      \[\leadsto \color{blue}{\left(0.3125 \cdot {x}^{-3.5} + \left({x}^{-0.5} + \left(-{x}^{-0.5}\right)\right)\right)} - \mathsf{fma}\left(-0.5, \frac{{x}^{-0.5}}{x}, \frac{{x}^{-0.5}}{{x}^{2}} \cdot 0.375\right) \]
    3. sub-neg99.4%

      \[\leadsto \left(0.3125 \cdot {x}^{-3.5} + \color{blue}{\left({x}^{-0.5} - {x}^{-0.5}\right)}\right) - \mathsf{fma}\left(-0.5, \frac{{x}^{-0.5}}{x}, \frac{{x}^{-0.5}}{{x}^{2}} \cdot 0.375\right) \]
    4. +-inverses99.4%

      \[\leadsto \left(0.3125 \cdot {x}^{-3.5} + \color{blue}{0}\right) - \mathsf{fma}\left(-0.5, \frac{{x}^{-0.5}}{x}, \frac{{x}^{-0.5}}{{x}^{2}} \cdot 0.375\right) \]
    5. +-commutative99.4%

      \[\leadsto \color{blue}{\left(0 + 0.3125 \cdot {x}^{-3.5}\right)} - \mathsf{fma}\left(-0.5, \frac{{x}^{-0.5}}{x}, \frac{{x}^{-0.5}}{{x}^{2}} \cdot 0.375\right) \]
    6. +-lft-identity99.4%

      \[\leadsto \color{blue}{0.3125 \cdot {x}^{-3.5}} - \mathsf{fma}\left(-0.5, \frac{{x}^{-0.5}}{x}, \frac{{x}^{-0.5}}{{x}^{2}} \cdot 0.375\right) \]
  11. Simplified99.4%

    \[\leadsto \color{blue}{0.3125 \cdot {x}^{-3.5}} - \mathsf{fma}\left(-0.5, \frac{{x}^{-0.5}}{x}, \frac{{x}^{-0.5}}{{x}^{2}} \cdot 0.375\right) \]
  12. Final simplification99.4%

    \[\leadsto 0.3125 \cdot {x}^{-3.5} - \mathsf{fma}\left(-0.5, \frac{{x}^{-0.5}}{x}, \frac{{x}^{-0.5}}{{x}^{2}} \cdot 0.375\right) \]
  13. Add Preprocessing

Alternative 2: 99.1% accurate, 0.7× speedup?

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

\\
\frac{\frac{\left(0.5 + \frac{0.3125}{{x}^{2}}\right) - \left(\frac{0.375}{x} + \frac{0.2734375}{{x}^{3}}\right)}{x}}{\sqrt{x}}
\end{array}
Derivation
  1. Initial program 46.0%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. expm1-log1p-u46.0%

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

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

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

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

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

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

    \[\leadsto \color{blue}{{x}^{-0.5}} - \frac{1}{\sqrt{x + 1}} \]
  6. Step-by-step derivation
    1. metadata-eval33.1%

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

      \[\leadsto \color{blue}{\frac{1}{{x}^{0.5}}} - \frac{1}{\sqrt{x + 1}} \]
    3. pow1/246.0%

      \[\leadsto \frac{1}{\color{blue}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
    4. clear-num46.0%

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

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

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

      \[\leadsto \frac{\color{blue}{\sqrt{1 + x}} - \frac{\sqrt{x}}{1} \cdot 1}{\frac{\sqrt{x}}{1} \cdot \sqrt{1 + x}} \]
  7. Applied egg-rr46.1%

    \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \frac{\sqrt{x}}{1} \cdot 1}{\frac{\sqrt{x}}{1} \cdot \sqrt{1 + x}}} \]
  8. Step-by-step derivation
    1. div-sub46.0%

      \[\leadsto \color{blue}{\frac{\sqrt{1 + x}}{\frac{\sqrt{x}}{1} \cdot \sqrt{1 + x}} - \frac{\frac{\sqrt{x}}{1} \cdot 1}{\frac{\sqrt{x}}{1} \cdot \sqrt{1 + x}}} \]
    2. /-rgt-identity46.0%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x} \cdot \sqrt{1 + x}}} \]
    7. rem-square-sqrt46.1%

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

      \[\leadsto \color{blue}{\frac{\sqrt{\sqrt{1 + x} - \sqrt{x}}}{\sqrt{x}} \cdot \frac{\sqrt{\sqrt{1 + x} - \sqrt{x}}}{\sqrt{1 + x}}} \]
    9. associate-*l/46.1%

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

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

    \[\leadsto \frac{\color{blue}{\frac{\left(0.5 + \frac{0.3125}{{x}^{2}}\right) - \left(0.375 \cdot \frac{1}{x} + 0.2734375 \cdot \frac{1}{{x}^{3}}\right)}{x}}}{\sqrt{x}} \]
  11. Step-by-step derivation
    1. associate-*r/99.3%

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

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

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

      \[\leadsto \frac{\frac{\left(0.5 + \frac{0.3125}{{x}^{2}}\right) - \left(\frac{0.375}{x} + \frac{\color{blue}{0.2734375}}{{x}^{3}}\right)}{x}}{\sqrt{x}} \]
  12. Simplified99.3%

    \[\leadsto \frac{\color{blue}{\frac{\left(0.5 + \frac{0.3125}{{x}^{2}}\right) - \left(\frac{0.375}{x} + \frac{0.2734375}{{x}^{3}}\right)}{x}}}{\sqrt{x}} \]
  13. Final simplification99.3%

    \[\leadsto \frac{\frac{\left(0.5 + \frac{0.3125}{{x}^{2}}\right) - \left(\frac{0.375}{x} + \frac{0.2734375}{{x}^{3}}\right)}{x}}{\sqrt{x}} \]
  14. Add Preprocessing

Alternative 3: 99.0% accurate, 1.0× speedup?

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

\\
\frac{\frac{0.5 + \left(\frac{0.3125}{{x}^{2}} - \frac{0.375}{x}\right)}{x}}{\sqrt{x}}
\end{array}
Derivation
  1. Initial program 46.0%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. expm1-log1p-u46.0%

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

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

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

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

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

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

    \[\leadsto \color{blue}{{x}^{-0.5}} - \frac{1}{\sqrt{x + 1}} \]
  6. Step-by-step derivation
    1. metadata-eval33.1%

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

      \[\leadsto \color{blue}{\frac{1}{{x}^{0.5}}} - \frac{1}{\sqrt{x + 1}} \]
    3. pow1/246.0%

      \[\leadsto \frac{1}{\color{blue}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
    4. clear-num46.0%

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

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

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

      \[\leadsto \frac{\color{blue}{\sqrt{1 + x}} - \frac{\sqrt{x}}{1} \cdot 1}{\frac{\sqrt{x}}{1} \cdot \sqrt{1 + x}} \]
  7. Applied egg-rr46.1%

    \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \frac{\sqrt{x}}{1} \cdot 1}{\frac{\sqrt{x}}{1} \cdot \sqrt{1 + x}}} \]
  8. Step-by-step derivation
    1. div-sub46.0%

      \[\leadsto \color{blue}{\frac{\sqrt{1 + x}}{\frac{\sqrt{x}}{1} \cdot \sqrt{1 + x}} - \frac{\frac{\sqrt{x}}{1} \cdot 1}{\frac{\sqrt{x}}{1} \cdot \sqrt{1 + x}}} \]
    2. /-rgt-identity46.0%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x} \cdot \sqrt{1 + x}}} \]
    7. rem-square-sqrt46.1%

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

      \[\leadsto \color{blue}{\frac{\sqrt{\sqrt{1 + x} - \sqrt{x}}}{\sqrt{x}} \cdot \frac{\sqrt{\sqrt{1 + x} - \sqrt{x}}}{\sqrt{1 + x}}} \]
    9. associate-*l/46.1%

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

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

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

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

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

      \[\leadsto \frac{\frac{0.5 + \left(\frac{0.3125}{{x}^{2}} - \frac{\color{blue}{0.375}}{x}\right)}{x}}{\sqrt{x}} \]
  12. Simplified99.2%

    \[\leadsto \frac{\color{blue}{\frac{0.5 + \left(\frac{0.3125}{{x}^{2}} - \frac{0.375}{x}\right)}{x}}}{\sqrt{x}} \]
  13. Final simplification99.2%

    \[\leadsto \frac{\frac{0.5 + \left(\frac{0.3125}{{x}^{2}} - \frac{0.375}{x}\right)}{x}}{\sqrt{x}} \]
  14. Add Preprocessing

Alternative 4: 98.6% accurate, 1.9× speedup?

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

\\
\frac{\frac{0.5 - \frac{0.375}{x}}{x}}{\sqrt{x}}
\end{array}
Derivation
  1. Initial program 46.0%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. expm1-log1p-u46.0%

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

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

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

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

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

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

    \[\leadsto \color{blue}{{x}^{-0.5}} - \frac{1}{\sqrt{x + 1}} \]
  6. Step-by-step derivation
    1. metadata-eval33.1%

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

      \[\leadsto \color{blue}{\frac{1}{{x}^{0.5}}} - \frac{1}{\sqrt{x + 1}} \]
    3. pow1/246.0%

      \[\leadsto \frac{1}{\color{blue}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
    4. clear-num46.0%

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

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

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

      \[\leadsto \frac{\color{blue}{\sqrt{1 + x}} - \frac{\sqrt{x}}{1} \cdot 1}{\frac{\sqrt{x}}{1} \cdot \sqrt{1 + x}} \]
  7. Applied egg-rr46.1%

    \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \frac{\sqrt{x}}{1} \cdot 1}{\frac{\sqrt{x}}{1} \cdot \sqrt{1 + x}}} \]
  8. Step-by-step derivation
    1. div-sub46.0%

      \[\leadsto \color{blue}{\frac{\sqrt{1 + x}}{\frac{\sqrt{x}}{1} \cdot \sqrt{1 + x}} - \frac{\frac{\sqrt{x}}{1} \cdot 1}{\frac{\sqrt{x}}{1} \cdot \sqrt{1 + x}}} \]
    2. /-rgt-identity46.0%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x} \cdot \sqrt{1 + x}}} \]
    7. rem-square-sqrt46.1%

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

      \[\leadsto \color{blue}{\frac{\sqrt{\sqrt{1 + x} - \sqrt{x}}}{\sqrt{x}} \cdot \frac{\sqrt{\sqrt{1 + x} - \sqrt{x}}}{\sqrt{1 + x}}} \]
    9. associate-*l/46.1%

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

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

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

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

      \[\leadsto \frac{\frac{0.5 - \frac{\color{blue}{0.375}}{x}}{x}}{\sqrt{x}} \]
  12. Simplified98.8%

    \[\leadsto \frac{\color{blue}{\frac{0.5 - \frac{0.375}{x}}{x}}}{\sqrt{x}} \]
  13. Final simplification98.8%

    \[\leadsto \frac{\frac{0.5 - \frac{0.375}{x}}{x}}{\sqrt{x}} \]
  14. Add Preprocessing

Alternative 5: 97.8% accurate, 2.0× speedup?

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

\\
0.5 \cdot {x}^{-1.5}
\end{array}
Derivation
  1. Initial program 46.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}} \]
  7. Step-by-step derivation
    1. *-commutative70.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{{x}^{3}}} \cdot 0.5} \]
  8. Simplified70.0%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{{x}^{3}}} \cdot 0.5} \]
  9. Step-by-step derivation
    1. *-un-lft-identity70.0%

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

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

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

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

      \[\leadsto \left(1 \cdot {x}^{\color{blue}{-1.5}}\right) \cdot 0.5 \]
  10. Applied egg-rr97.8%

    \[\leadsto \color{blue}{\left(1 \cdot {x}^{-1.5}\right)} \cdot 0.5 \]
  11. Step-by-step derivation
    1. *-lft-identity97.8%

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

    \[\leadsto \color{blue}{{x}^{-1.5}} \cdot 0.5 \]
  13. Final simplification97.8%

    \[\leadsto 0.5 \cdot {x}^{-1.5} \]
  14. Add Preprocessing

Alternative 6: 5.6% accurate, 2.0× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. expm1-log1p-u46.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto e^{\color{blue}{-\log x \cdot 0.5}} \]
    7. distribute-rgt-neg-in5.5%

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

      \[\leadsto e^{\log x \cdot \color{blue}{-0.5}} \]
    9. exp-to-pow5.5%

      \[\leadsto \color{blue}{{x}^{-0.5}} \]
  8. Simplified5.5%

    \[\leadsto \color{blue}{{x}^{-0.5}} \]
  9. Final simplification5.5%

    \[\leadsto {x}^{-0.5} \]
  10. Add Preprocessing

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

  :alt
  (/ 1.0 (+ (* (+ x 1.0) (sqrt x)) (* x (sqrt (+ x 1.0)))))

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