2isqrt (example 3.6)

Percentage Accurate: 38.1% → 99.2%
Time: 11.5s
Alternatives: 5
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 5 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.1% 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.2% accurate, 1.8× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Applied egg-rr41.0%

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

    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \color{blue}{\left(x \cdot \left(\left(2 + \frac{1}{2} \cdot \frac{1}{x}\right) - \frac{\frac{1}{8}}{{x}^{2}}\right)\right)}\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
  5. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \left(x \cdot \left(\left(\frac{1}{2} \cdot \frac{1}{x} + 2\right) - \frac{\frac{1}{8}}{{x}^{2}}\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    2. associate--l+N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{x} + \left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right)\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    3. distribute-rgt-inN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \left(\left(\frac{1}{2} \cdot \frac{1}{x}\right) \cdot x + \left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right) \cdot x\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, \color{blue}{x}\right), \frac{-1}{2}\right)\right) \]
    4. associate-*l*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \left(\frac{1}{2} \cdot \left(\frac{1}{x} \cdot x\right) + \left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right) \cdot x\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    5. lft-mult-inverseN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \left(\frac{1}{2} \cdot 1 + \left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right) \cdot x\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    6. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \left(\frac{1}{2} + \left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right) \cdot x\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    7. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right) \cdot x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, \color{blue}{x}\right), \frac{-1}{2}\right)\right) \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    9. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\left(2 + \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{{x}^{2}}\right)\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    10. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{{x}^{2}}\right)\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    11. distribute-neg-fracN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(\frac{\mathsf{neg}\left(\frac{1}{8}\right)}{{x}^{2}}\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(\frac{\frac{-1}{8}}{{x}^{2}}\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    13. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\frac{-1}{8}, \left({x}^{2}\right)\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    14. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\frac{-1}{8}, \left(x \cdot x\right)\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    15. *-lowering-*.f6440.7%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(x, x\right)\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
  6. Simplified40.7%

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

      \[\leadsto {\left(1 + x\right)}^{\frac{-1}{2}} \cdot \color{blue}{\frac{\left(1 + x\right) - x}{\frac{1}{2} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}} \]
    2. clear-numN/A

      \[\leadsto {\left(1 + x\right)}^{\frac{-1}{2}} \cdot \frac{1}{\color{blue}{\frac{\frac{1}{2} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}{\left(1 + x\right) - x}}} \]
    3. un-div-invN/A

      \[\leadsto \frac{{\left(1 + x\right)}^{\frac{-1}{2}}}{\color{blue}{\frac{\frac{1}{2} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}{\left(1 + x\right) - x}}} \]
    4. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\left({\left(1 + x\right)}^{\frac{-1}{2}}\right), \color{blue}{\left(\frac{\frac{1}{2} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}{\left(1 + x\right) - x}\right)}\right) \]
    5. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\left(1 + x\right), \frac{-1}{2}\right), \left(\frac{\color{blue}{\frac{1}{2} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}}{\left(1 + x\right) - x}\right)\right) \]
    6. +-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\left(x + 1\right), \frac{-1}{2}\right), \left(\frac{\color{blue}{\frac{1}{2}} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}{\left(1 + x\right) - x}\right)\right) \]
    7. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \left(\frac{\color{blue}{\frac{1}{2}} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}{\left(1 + x\right) - x}\right)\right) \]
    8. associate--l+N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \left(\frac{\frac{1}{2} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}{1 + \color{blue}{\left(x - x\right)}}\right)\right) \]
    9. +-inversesN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \left(\frac{\frac{1}{2} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}{1 + 0}\right)\right) \]
    10. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \left(\frac{\frac{1}{2} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}{1}\right)\right) \]
    11. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{/.f64}\left(\left(\frac{1}{2} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x\right), \color{blue}{1}\right)\right) \]
  8. Applied egg-rr99.5%

    \[\leadsto \color{blue}{\frac{{\left(x + 1\right)}^{-0.5}}{\frac{0.5 + x \cdot \left(2 + \frac{-0.125}{x \cdot x}\right)}{1}}} \]
  9. Step-by-step derivation
    1. /-rgt-identityN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \left(\frac{1}{2} + \color{blue}{x \cdot \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right)}\right)\right) \]
    2. +-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \left(x \cdot \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) + \color{blue}{\frac{1}{2}}\right)\right) \]
    3. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\left(x \cdot \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right)\right), \color{blue}{\frac{1}{2}}\right)\right) \]
    4. distribute-rgt-inN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\left(2 \cdot x + \frac{\frac{-1}{8}}{x \cdot x} \cdot x\right), \frac{1}{2}\right)\right) \]
    5. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\left(x \cdot 2 + \frac{\frac{-1}{8}}{x \cdot x} \cdot x\right), \frac{1}{2}\right)\right) \]
    6. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(\left(x \cdot 2\right), \left(\frac{\frac{-1}{8}}{x \cdot x} \cdot x\right)\right), \frac{1}{2}\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, 2\right), \left(\frac{\frac{-1}{8}}{x \cdot x} \cdot x\right)\right), \frac{1}{2}\right)\right) \]
    8. div-invN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, 2\right), \left(\left(\frac{-1}{8} \cdot \frac{1}{x \cdot x}\right) \cdot x\right)\right), \frac{1}{2}\right)\right) \]
    9. associate-*l*N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, 2\right), \left(\frac{-1}{8} \cdot \left(\frac{1}{x \cdot x} \cdot x\right)\right)\right), \frac{1}{2}\right)\right) \]
    10. pow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, 2\right), \left(\frac{-1}{8} \cdot \left(\frac{1}{{x}^{2}} \cdot x\right)\right)\right), \frac{1}{2}\right)\right) \]
    11. pow-flipN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, 2\right), \left(\frac{-1}{8} \cdot \left({x}^{\left(\mathsf{neg}\left(2\right)\right)} \cdot x\right)\right)\right), \frac{1}{2}\right)\right) \]
    12. pow-plusN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, 2\right), \left(\frac{-1}{8} \cdot {x}^{\left(\left(\mathsf{neg}\left(2\right)\right) + 1\right)}\right)\right), \frac{1}{2}\right)\right) \]
    13. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, 2\right), \left(\frac{-1}{8} \cdot {x}^{\left(-2 + 1\right)}\right)\right), \frac{1}{2}\right)\right) \]
    14. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, 2\right), \left(\frac{-1}{8} \cdot {x}^{-1}\right)\right), \frac{1}{2}\right)\right) \]
    15. inv-powN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, 2\right), \left(\frac{-1}{8} \cdot \frac{1}{x}\right)\right), \frac{1}{2}\right)\right) \]
    16. div-invN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, 2\right), \left(\frac{\frac{-1}{8}}{x}\right)\right), \frac{1}{2}\right)\right) \]
    17. /-lowering-/.f6499.5%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, 2\right), \mathsf{/.f64}\left(\frac{-1}{8}, x\right)\right), \frac{1}{2}\right)\right) \]
  10. Applied egg-rr99.5%

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

Alternative 2: 98.8% accurate, 1.9× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Applied egg-rr41.0%

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

    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \color{blue}{\left(x \cdot \left(\left(2 + \frac{1}{2} \cdot \frac{1}{x}\right) - \frac{\frac{1}{8}}{{x}^{2}}\right)\right)}\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
  5. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \left(x \cdot \left(\left(\frac{1}{2} \cdot \frac{1}{x} + 2\right) - \frac{\frac{1}{8}}{{x}^{2}}\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    2. associate--l+N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{x} + \left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right)\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    3. distribute-rgt-inN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \left(\left(\frac{1}{2} \cdot \frac{1}{x}\right) \cdot x + \left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right) \cdot x\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, \color{blue}{x}\right), \frac{-1}{2}\right)\right) \]
    4. associate-*l*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \left(\frac{1}{2} \cdot \left(\frac{1}{x} \cdot x\right) + \left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right) \cdot x\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    5. lft-mult-inverseN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \left(\frac{1}{2} \cdot 1 + \left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right) \cdot x\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    6. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \left(\frac{1}{2} + \left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right) \cdot x\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    7. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right) \cdot x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, \color{blue}{x}\right), \frac{-1}{2}\right)\right) \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    9. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\left(2 + \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{{x}^{2}}\right)\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    10. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{{x}^{2}}\right)\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    11. distribute-neg-fracN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(\frac{\mathsf{neg}\left(\frac{1}{8}\right)}{{x}^{2}}\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(\frac{\frac{-1}{8}}{{x}^{2}}\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    13. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\frac{-1}{8}, \left({x}^{2}\right)\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    14. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\frac{-1}{8}, \left(x \cdot x\right)\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    15. *-lowering-*.f6440.7%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(x, x\right)\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
  6. Simplified40.7%

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

      \[\leadsto {\left(1 + x\right)}^{\frac{-1}{2}} \cdot \color{blue}{\frac{\left(1 + x\right) - x}{\frac{1}{2} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}} \]
    2. clear-numN/A

      \[\leadsto {\left(1 + x\right)}^{\frac{-1}{2}} \cdot \frac{1}{\color{blue}{\frac{\frac{1}{2} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}{\left(1 + x\right) - x}}} \]
    3. un-div-invN/A

      \[\leadsto \frac{{\left(1 + x\right)}^{\frac{-1}{2}}}{\color{blue}{\frac{\frac{1}{2} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}{\left(1 + x\right) - x}}} \]
    4. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\left({\left(1 + x\right)}^{\frac{-1}{2}}\right), \color{blue}{\left(\frac{\frac{1}{2} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}{\left(1 + x\right) - x}\right)}\right) \]
    5. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\left(1 + x\right), \frac{-1}{2}\right), \left(\frac{\color{blue}{\frac{1}{2} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}}{\left(1 + x\right) - x}\right)\right) \]
    6. +-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\left(x + 1\right), \frac{-1}{2}\right), \left(\frac{\color{blue}{\frac{1}{2}} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}{\left(1 + x\right) - x}\right)\right) \]
    7. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \left(\frac{\color{blue}{\frac{1}{2}} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}{\left(1 + x\right) - x}\right)\right) \]
    8. associate--l+N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \left(\frac{\frac{1}{2} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}{1 + \color{blue}{\left(x - x\right)}}\right)\right) \]
    9. +-inversesN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \left(\frac{\frac{1}{2} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}{1 + 0}\right)\right) \]
    10. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \left(\frac{\frac{1}{2} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x}{1}\right)\right) \]
    11. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{/.f64}\left(\left(\frac{1}{2} + \left(2 + \frac{\frac{-1}{8}}{x \cdot x}\right) \cdot x\right), \color{blue}{1}\right)\right) \]
  8. Applied egg-rr99.5%

    \[\leadsto \color{blue}{\frac{{\left(x + 1\right)}^{-0.5}}{\frac{0.5 + x \cdot \left(2 + \frac{-0.125}{x \cdot x}\right)}{1}}} \]
  9. Taylor expanded in x around inf

    \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \color{blue}{\left(x \cdot \left(2 + \frac{1}{2} \cdot \frac{1}{x}\right)\right)}\right) \]
  10. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{x} + \color{blue}{2}\right)\right)\right) \]
    2. distribute-rgt-inN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \left(\left(\frac{1}{2} \cdot \frac{1}{x}\right) \cdot x + \color{blue}{2 \cdot x}\right)\right) \]
    3. associate-*l*N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \left(\frac{1}{2} \cdot \left(\frac{1}{x} \cdot x\right) + \color{blue}{2} \cdot x\right)\right) \]
    4. lft-mult-inverseN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \left(\frac{1}{2} \cdot 1 + 2 \cdot x\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \left(\frac{1}{2} + \color{blue}{2} \cdot x\right)\right) \]
    6. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\frac{1}{2}, \color{blue}{\left(2 \cdot x\right)}\right)\right) \]
    7. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(x \cdot \color{blue}{2}\right)\right)\right) \]
    8. *-lowering-*.f6499.2%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \color{blue}{2}\right)\right)\right) \]
  11. Simplified99.2%

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

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

Alternative 3: 97.9% 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 39.1%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Taylor expanded in x around inf

    \[\leadsto \color{blue}{\frac{\frac{-1}{2} \cdot \sqrt{\frac{1}{x}} - \frac{-1}{2} \cdot \sqrt{x}}{{x}^{2}}} \]
  4. Step-by-step derivation
    1. distribute-lft-out--N/A

      \[\leadsto \frac{\frac{-1}{2} \cdot \left(\sqrt{\frac{1}{x}} - \sqrt{x}\right)}{{\color{blue}{x}}^{2}} \]
    2. *-commutativeN/A

      \[\leadsto \frac{\left(\sqrt{\frac{1}{x}} - \sqrt{x}\right) \cdot \frac{-1}{2}}{{\color{blue}{x}}^{2}} \]
    3. associate-/l*N/A

      \[\leadsto \left(\sqrt{\frac{1}{x}} - \sqrt{x}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{{x}^{2}}} \]
    4. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\frac{1}{x}} - \sqrt{x}\right), \color{blue}{\left(\frac{\frac{-1}{2}}{{x}^{2}}\right)}\right) \]
    5. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sqrt{\frac{1}{x}}\right), \left(\sqrt{x}\right)\right), \left(\frac{\color{blue}{\frac{-1}{2}}}{{x}^{2}}\right)\right) \]
    6. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{1}{x}\right)\right), \left(\sqrt{x}\right)\right), \left(\frac{\frac{-1}{2}}{{x}^{2}}\right)\right) \]
    7. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, x\right)\right), \left(\sqrt{x}\right)\right), \left(\frac{\frac{-1}{2}}{{x}^{2}}\right)\right) \]
    8. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, x\right)\right), \mathsf{sqrt.f64}\left(x\right)\right), \left(\frac{\frac{-1}{2}}{{x}^{2}}\right)\right) \]
    9. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, x\right)\right), \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{/.f64}\left(\frac{-1}{2}, \color{blue}{\left({x}^{2}\right)}\right)\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, x\right)\right), \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{/.f64}\left(\frac{-1}{2}, \left(x \cdot \color{blue}{x}\right)\right)\right) \]
    11. *-lowering-*.f6483.0%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, x\right)\right), \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{/.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
  5. Simplified83.0%

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

    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(-1 \cdot \sqrt{x}\right)}, \mathsf{/.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(x, x\right)\right)\right) \]
  7. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{*.f64}\left(\left(\mathsf{neg}\left(\sqrt{x}\right)\right), \mathsf{/.f64}\left(\color{blue}{\frac{-1}{2}}, \mathsf{*.f64}\left(x, x\right)\right)\right) \]
    2. neg-sub0N/A

      \[\leadsto \mathsf{*.f64}\left(\left(0 - \sqrt{x}\right), \mathsf{/.f64}\left(\color{blue}{\frac{-1}{2}}, \mathsf{*.f64}\left(x, x\right)\right)\right) \]
    3. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(0, \left(\sqrt{x}\right)\right), \mathsf{/.f64}\left(\color{blue}{\frac{-1}{2}}, \mathsf{*.f64}\left(x, x\right)\right)\right) \]
    4. sqrt-lowering-sqrt.f6482.9%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{/.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(x, x\right)\right)\right) \]
  8. Simplified82.9%

    \[\leadsto \color{blue}{\left(0 - \sqrt{x}\right)} \cdot \frac{-0.5}{x \cdot x} \]
  9. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \frac{\frac{-1}{2}}{x \cdot x} \cdot \color{blue}{\left(0 - \sqrt{x}\right)} \]
    2. frac-2negN/A

      \[\leadsto \frac{\mathsf{neg}\left(\frac{-1}{2}\right)}{\mathsf{neg}\left(x \cdot x\right)} \cdot \left(\color{blue}{0} - \sqrt{x}\right) \]
    3. metadata-evalN/A

      \[\leadsto \frac{\frac{1}{2}}{\mathsf{neg}\left(x \cdot x\right)} \cdot \left(0 - \sqrt{x}\right) \]
    4. flip3--N/A

      \[\leadsto \frac{\frac{1}{2}}{\mathsf{neg}\left(x \cdot x\right)} \cdot \frac{{0}^{3} - {\left(\sqrt{x}\right)}^{3}}{\color{blue}{0 \cdot 0 + \left(\sqrt{x} \cdot \sqrt{x} + 0 \cdot \sqrt{x}\right)}} \]
    5. frac-timesN/A

      \[\leadsto \frac{\frac{1}{2} \cdot \left({0}^{3} - {\left(\sqrt{x}\right)}^{3}\right)}{\color{blue}{\left(\mathsf{neg}\left(x \cdot x\right)\right) \cdot \left(0 \cdot 0 + \left(\sqrt{x} \cdot \sqrt{x} + 0 \cdot \sqrt{x}\right)\right)}} \]
    6. metadata-evalN/A

      \[\leadsto \frac{\frac{1}{2} \cdot \left({0}^{3} - {\left(\sqrt{x}\right)}^{3}\right)}{\left(\mathsf{neg}\left(x \cdot x\right)\right) \cdot \left(0 + \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + 0 \cdot \sqrt{x}\right)\right)} \]
    7. +-lft-identityN/A

      \[\leadsto \frac{\frac{1}{2} \cdot \left({0}^{3} - {\left(\sqrt{x}\right)}^{3}\right)}{\left(\mathsf{neg}\left(x \cdot x\right)\right) \cdot \left(\sqrt{x} \cdot \sqrt{x} + \color{blue}{0 \cdot \sqrt{x}}\right)} \]
    8. +-lft-identityN/A

      \[\leadsto \frac{\frac{1}{2} \cdot \left({0}^{3} - {\left(\sqrt{x}\right)}^{3}\right)}{\left(\mathsf{neg}\left(x \cdot x\right)\right) \cdot \left(\left(0 + \sqrt{x}\right) \cdot \sqrt{x} + 0 \cdot \sqrt{x}\right)} \]
    9. +-lft-identityN/A

      \[\leadsto \frac{\frac{1}{2} \cdot \left({0}^{3} - {\left(\sqrt{x}\right)}^{3}\right)}{\left(\mathsf{neg}\left(x \cdot x\right)\right) \cdot \left(\left(0 + \sqrt{x}\right) \cdot \left(0 + \sqrt{x}\right) + 0 \cdot \sqrt{x}\right)} \]
    10. +-lft-identityN/A

      \[\leadsto \frac{\frac{1}{2} \cdot \left({0}^{3} - {\left(\sqrt{x}\right)}^{3}\right)}{\left(\mathsf{neg}\left(x \cdot x\right)\right) \cdot \left(\left(0 + \sqrt{x}\right) \cdot \left(0 + \sqrt{x}\right) + 0 \cdot \left(0 + \color{blue}{\sqrt{x}}\right)\right)} \]
    11. distribute-rgt-outN/A

      \[\leadsto \frac{\frac{1}{2} \cdot \left({0}^{3} - {\left(\sqrt{x}\right)}^{3}\right)}{\left(\mathsf{neg}\left(x \cdot x\right)\right) \cdot \left(\left(0 + \sqrt{x}\right) \cdot \color{blue}{\left(\left(0 + \sqrt{x}\right) + 0\right)}\right)} \]
    12. +-lft-identityN/A

      \[\leadsto \frac{\frac{1}{2} \cdot \left({0}^{3} - {\left(\sqrt{x}\right)}^{3}\right)}{\left(\mathsf{neg}\left(x \cdot x\right)\right) \cdot \left(\sqrt{x} \cdot \left(\color{blue}{\left(0 + \sqrt{x}\right)} + 0\right)\right)} \]
    13. +-commutativeN/A

      \[\leadsto \frac{\frac{1}{2} \cdot \left({0}^{3} - {\left(\sqrt{x}\right)}^{3}\right)}{\left(\mathsf{neg}\left(x \cdot x\right)\right) \cdot \left(\sqrt{x} \cdot \left(0 + \color{blue}{\left(0 + \sqrt{x}\right)}\right)\right)} \]
    14. +-lft-identityN/A

      \[\leadsto \frac{\frac{1}{2} \cdot \left({0}^{3} - {\left(\sqrt{x}\right)}^{3}\right)}{\left(\mathsf{neg}\left(x \cdot x\right)\right) \cdot \left(\sqrt{x} \cdot \left(0 + \sqrt{x}\right)\right)} \]
    15. +-lft-identityN/A

      \[\leadsto \frac{\frac{1}{2} \cdot \left({0}^{3} - {\left(\sqrt{x}\right)}^{3}\right)}{\left(\mathsf{neg}\left(x \cdot x\right)\right) \cdot \left(\sqrt{x} \cdot \sqrt{x}\right)} \]
    16. rem-square-sqrtN/A

      \[\leadsto \frac{\frac{1}{2} \cdot \left({0}^{3} - {\left(\sqrt{x}\right)}^{3}\right)}{\left(\mathsf{neg}\left(x \cdot x\right)\right) \cdot x} \]
  10. Applied egg-rr82.9%

    \[\leadsto \color{blue}{\frac{0.5}{x \cdot x} \cdot \sqrt{x}} \]
  11. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \sqrt{x} \cdot \color{blue}{\frac{\frac{1}{2}}{x \cdot x}} \]
    2. clear-numN/A

      \[\leadsto \sqrt{x} \cdot \frac{1}{\color{blue}{\frac{x \cdot x}{\frac{1}{2}}}} \]
    3. associate-*r/N/A

      \[\leadsto \frac{\sqrt{x} \cdot 1}{\color{blue}{\frac{x \cdot x}{\frac{1}{2}}}} \]
    4. div-invN/A

      \[\leadsto \frac{\sqrt{x} \cdot 1}{\left(x \cdot x\right) \cdot \color{blue}{\frac{1}{\frac{1}{2}}}} \]
    5. metadata-evalN/A

      \[\leadsto \frac{\sqrt{x} \cdot 1}{\left(x \cdot x\right) \cdot 2} \]
    6. times-fracN/A

      \[\leadsto \frac{\sqrt{x}}{x \cdot x} \cdot \color{blue}{\frac{1}{2}} \]
    7. metadata-evalN/A

      \[\leadsto \frac{\sqrt{x}}{x \cdot x} \cdot \frac{1}{2} \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(\frac{\sqrt{x}}{x \cdot x}\right), \color{blue}{\frac{1}{2}}\right) \]
    9. pow1/2N/A

      \[\leadsto \mathsf{*.f64}\left(\left(\frac{{x}^{\frac{1}{2}}}{x \cdot x}\right), \frac{1}{2}\right) \]
    10. pow2N/A

      \[\leadsto \mathsf{*.f64}\left(\left(\frac{{x}^{\frac{1}{2}}}{{x}^{2}}\right), \frac{1}{2}\right) \]
    11. pow-divN/A

      \[\leadsto \mathsf{*.f64}\left(\left({x}^{\left(\frac{1}{2} - 2\right)}\right), \frac{1}{2}\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\left({x}^{\frac{-3}{2}}\right), \frac{1}{2}\right) \]
    13. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\left({x}^{\left(-1 \cdot \frac{3}{2}\right)}\right), \frac{1}{2}\right) \]
    14. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\left({x}^{\left(\left(\mathsf{neg}\left(1\right)\right) \cdot \frac{3}{2}\right)}\right), \frac{1}{2}\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\left({x}^{\left(\left(\mathsf{neg}\left(1\right)\right) \cdot \left(\frac{1}{2} \cdot 3\right)\right)}\right), \frac{1}{2}\right) \]
    16. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(x, \left(\left(\mathsf{neg}\left(1\right)\right) \cdot \left(\frac{1}{2} \cdot 3\right)\right)\right), \frac{1}{2}\right) \]
    17. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(x, \left(-1 \cdot \left(\frac{1}{2} \cdot 3\right)\right)\right), \frac{1}{2}\right) \]
    18. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(x, \left(-1 \cdot \frac{3}{2}\right)\right), \frac{1}{2}\right) \]
    19. metadata-eval98.2%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(x, \frac{-3}{2}\right), \frac{1}{2}\right) \]
  12. Applied egg-rr98.2%

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

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

Alternative 4: 36.2% accurate, 29.9× speedup?

\[\begin{array}{l} \\ \frac{\frac{0.0625}{x \cdot x}}{x} \end{array} \]
(FPCore (x) :precision binary64 (/ (/ 0.0625 (* x x)) x))
double code(double x) {
	return (0.0625 / (x * x)) / x;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (0.0625d0 / (x * x)) / x
end function
public static double code(double x) {
	return (0.0625 / (x * x)) / x;
}
def code(x):
	return (0.0625 / (x * x)) / x
function code(x)
	return Float64(Float64(0.0625 / Float64(x * x)) / x)
end
function tmp = code(x)
	tmp = (0.0625 / (x * x)) / x;
end
code[x_] := N[(N[(0.0625 / N[(x * x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{0.0625}{x \cdot x}}{x}
\end{array}
Derivation
  1. Initial program 39.1%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Applied egg-rr41.0%

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

    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{\left(\frac{1}{2} + \frac{\frac{1}{16}}{{x}^{2}}\right) - \left(\frac{1}{8} \cdot \frac{1}{x} + \frac{5}{128} \cdot \frac{1}{{x}^{3}}\right)}{x}\right)}, \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
  5. Step-by-step derivation
    1. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\left(\frac{1}{2} + \frac{\frac{1}{16}}{{x}^{2}}\right) - \left(\frac{1}{8} \cdot \frac{1}{x} + \frac{5}{128} \cdot \frac{1}{{x}^{3}}\right)\right), x\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{+.f64}\left(1, x\right)}, \frac{-1}{2}\right)\right) \]
  6. Simplified99.5%

    \[\leadsto \color{blue}{\frac{0.5 + \left(\frac{-0.125 + \frac{0.0625}{x}}{x} + \frac{-0.0390625}{x \cdot \left(x \cdot x\right)}\right)}{x}} \cdot {\left(1 + x\right)}^{-0.5} \]
  7. Taylor expanded in x around inf

    \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{\left(\frac{1}{2} + \frac{\frac{1}{16}}{{x}^{2}}\right) - \frac{1}{8} \cdot \frac{1}{x}}{x}\right)}, \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
  8. Step-by-step derivation
    1. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\left(\frac{1}{2} + \frac{\frac{1}{16}}{{x}^{2}}\right) - \frac{1}{8} \cdot \frac{1}{x}\right), x\right), \mathsf{pow.f64}\left(\color{blue}{\mathsf{+.f64}\left(1, x\right)}, \frac{-1}{2}\right)\right) \]
  9. Simplified99.3%

    \[\leadsto \color{blue}{\frac{0.5 - \frac{0.125 + \frac{-0.0625}{x}}{x}}{x}} \cdot {\left(1 + x\right)}^{-0.5} \]
  10. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\frac{\frac{1}{16}}{{x}^{3}}} \]
  11. Step-by-step derivation
    1. unpow3N/A

      \[\leadsto \frac{\frac{1}{16}}{\left(x \cdot x\right) \cdot \color{blue}{x}} \]
    2. unpow2N/A

      \[\leadsto \frac{\frac{1}{16}}{{x}^{2} \cdot x} \]
    3. associate-/r*N/A

      \[\leadsto \frac{\frac{\frac{1}{16}}{{x}^{2}}}{\color{blue}{x}} \]
    4. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1}{16}}{{x}^{2}}\right), \color{blue}{x}\right) \]
    5. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \left({x}^{2}\right)\right), x\right) \]
    6. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \left(x \cdot x\right)\right), x\right) \]
    7. *-lowering-*.f6437.5%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{16}, \mathsf{*.f64}\left(x, x\right)\right), x\right) \]
  12. Simplified37.5%

    \[\leadsto \color{blue}{\frac{\frac{0.0625}{x \cdot x}}{x}} \]
  13. Add Preprocessing

Alternative 5: 1.8% accurate, 69.7× speedup?

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

\\
x \cdot -8
\end{array}
Derivation
  1. Initial program 39.1%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Add Preprocessing
  3. Applied egg-rr41.0%

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

    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \color{blue}{\left(x \cdot \left(\left(2 + \frac{1}{2} \cdot \frac{1}{x}\right) - \frac{\frac{1}{8}}{{x}^{2}}\right)\right)}\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
  5. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \left(x \cdot \left(\left(\frac{1}{2} \cdot \frac{1}{x} + 2\right) - \frac{\frac{1}{8}}{{x}^{2}}\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    2. associate--l+N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \left(x \cdot \left(\frac{1}{2} \cdot \frac{1}{x} + \left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right)\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    3. distribute-rgt-inN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \left(\left(\frac{1}{2} \cdot \frac{1}{x}\right) \cdot x + \left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right) \cdot x\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, \color{blue}{x}\right), \frac{-1}{2}\right)\right) \]
    4. associate-*l*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \left(\frac{1}{2} \cdot \left(\frac{1}{x} \cdot x\right) + \left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right) \cdot x\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    5. lft-mult-inverseN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \left(\frac{1}{2} \cdot 1 + \left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right) \cdot x\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    6. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \left(\frac{1}{2} + \left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right) \cdot x\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    7. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right) \cdot x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, \color{blue}{x}\right), \frac{-1}{2}\right)\right) \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\left(2 - \frac{\frac{1}{8}}{{x}^{2}}\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    9. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\left(2 + \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{{x}^{2}}\right)\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    10. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(\mathsf{neg}\left(\frac{\frac{1}{8}}{{x}^{2}}\right)\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    11. distribute-neg-fracN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(\frac{\mathsf{neg}\left(\frac{1}{8}\right)}{{x}^{2}}\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \left(\frac{\frac{-1}{8}}{{x}^{2}}\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    13. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\frac{-1}{8}, \left({x}^{2}\right)\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    14. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\frac{-1}{8}, \left(x \cdot x\right)\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
    15. *-lowering-*.f6440.7%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(2, \mathsf{/.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(x, x\right)\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{-1}{2}\right)\right) \]
  6. Simplified40.7%

    \[\leadsto \frac{\left(1 + x\right) - x}{\color{blue}{0.5 + \left(2 + \frac{-0.125}{x \cdot x}\right) \cdot x}} \cdot {\left(1 + x\right)}^{-0.5} \]
  7. Taylor expanded in x around 0

    \[\leadsto \color{blue}{-8 \cdot x} \]
  8. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto x \cdot \color{blue}{-8} \]
    2. *-lowering-*.f641.8%

      \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{-8}\right) \]
  9. Simplified1.8%

    \[\leadsto \color{blue}{x \cdot -8} \]
  10. Add Preprocessing

Developer Target 1: 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}

Developer Target 2: 38.1% accurate, 1.0× speedup?

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

\\
{x}^{-0.5} - {\left(x + 1\right)}^{-0.5}
\end{array}

Reproduce

?
herbie shell --seed 2024192 
(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))))))

  :alt
  (! :herbie-platform default (- (pow x -1/2) (pow (+ x 1) -1/2)))

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