2isqrt (example 3.6)

Percentage Accurate: 38.6% → 99.2%
Time: 10.5s
Alternatives: 13
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 13 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.6% 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.7× speedup?

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{\left(1 + x\right) - x}{x + \sqrt{x \cdot \left(1 + x\right)}}}{{\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. Simplified99.2%

    \[\leadsto \frac{\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}}}{{\left(1 + x\right)}^{0.5}} \]
  6. Step-by-step derivation
    1. clear-numN/A

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\left(\left(\frac{-1}{8} + \frac{\frac{1}{16}}{x}\right) - \frac{\frac{5}{128}}{x \cdot x}\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(1, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\frac{-1}{8} + \frac{\frac{1}{16}}{x}\right), \left(\frac{\frac{5}{128}}{x \cdot x}\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{1}{2}\right)\right) \]
    11. +-lowering-+.f64N/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\frac{-1}{8}, \mathsf{/.f64}\left(\frac{1}{16}, x\right)\right), \left(\frac{\frac{5}{128}}{x \cdot x}\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(1, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\frac{-1}{8}, \mathsf{/.f64}\left(\frac{1}{16}, x\right)\right), \mathsf{/.f64}\left(\frac{5}{128}, \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) \]
    14. *-lowering-*.f6499.2%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\frac{-1}{8}, \mathsf{/.f64}\left(\frac{1}{16}, x\right)\right), \mathsf{/.f64}\left(\frac{5}{128}, \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) \]
  7. Applied egg-rr99.2%

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

Alternative 2: 99.2% accurate, 1.7× speedup?

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

\\
\frac{\frac{\frac{-0.125 + \frac{0.0625 - \frac{0.0390625}{x}}{x}}{x}}{x} + \frac{0.5}{x}}{{\left(1 + x\right)}^{0.5}}
\end{array}
Derivation
  1. Initial program 37.3%

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

    \[\leadsto \color{blue}{\frac{\frac{\left(1 + x\right) - x}{x + \sqrt{x \cdot \left(1 + x\right)}}}{{\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. Simplified99.2%

    \[\leadsto \frac{\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}}}{{\left(1 + x\right)}^{0.5}} \]
  6. Step-by-step derivation
    1. clear-numN/A

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\left(\left(\frac{-1}{8} + \frac{\frac{1}{16}}{x}\right) - \frac{\frac{5}{128}}{x \cdot x}\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(1, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\frac{-1}{8} + \frac{\frac{1}{16}}{x}\right), \left(\frac{\frac{5}{128}}{x \cdot x}\right)\right), x\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{1}{2}\right)\right) \]
    11. +-lowering-+.f64N/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\frac{-1}{8}, \mathsf{/.f64}\left(\frac{1}{16}, x\right)\right), \left(\frac{\frac{5}{128}}{x \cdot x}\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(1, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\frac{-1}{8}, \mathsf{/.f64}\left(\frac{1}{16}, x\right)\right), \mathsf{/.f64}\left(\frac{5}{128}, \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) \]
    14. *-lowering-*.f6499.2%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\frac{-1}{8}, \mathsf{/.f64}\left(\frac{1}{16}, x\right)\right), \mathsf{/.f64}\left(\frac{5}{128}, \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) \]
  7. Applied egg-rr99.2%

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{\frac{-0.125 + \frac{0.0625 - \frac{0.0390625}{x}}{x}}{x}}{x} + \frac{0.5}{x}}}{{\left(1 + x\right)}^{0.5}} \]
  10. Add Preprocessing

Alternative 3: 99.2% accurate, 1.7× speedup?

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

\\
\frac{\frac{0.5 + \frac{-0.125 + \frac{0.0625 + \frac{-0.0390625}{x}}{x}}{x}}{x}}{{\left(1 + x\right)}^{0.5}}
\end{array}
Derivation
  1. Initial program 37.3%

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

    \[\leadsto \color{blue}{\frac{\frac{\left(1 + x\right) - x}{x + \sqrt{x \cdot \left(1 + x\right)}}}{{\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. Simplified99.2%

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

    \[\leadsto \frac{\color{blue}{\frac{0.5 + \frac{-0.125 + \frac{0.0625 + \frac{-0.0390625}{x}}{x}}{x}}{x}}}{{\left(1 + x\right)}^{0.5}} \]
  8. Add Preprocessing

Alternative 4: 99.1% accurate, 1.8× speedup?

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{\left(1 + x\right) - x}{x + \sqrt{x \cdot \left(1 + x\right)}}}{{\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. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{*.f64}\left(x, \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, \color{blue}{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), \mathsf{*.f64}\left(x, \left(2 + \left(\frac{1}{2} \cdot \frac{1}{x} - \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. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1 + \left(x - x\right)}{x} \cdot \frac{1}{{\left(1 + x\right)}^{\frac{1}{2}}}}{2 + \frac{\frac{1}{2} + \frac{\frac{-1}{8}}{x}}{x}} \]
    5. +-inversesN/A

      \[\leadsto \frac{\frac{1 + 0}{x} \cdot \frac{1}{{\left(1 + x\right)}^{\frac{1}{2}}}}{2 + \frac{\frac{1}{2} + \frac{\frac{-1}{8}}{x}}{x}} \]
    6. metadata-evalN/A

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

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

    \[\leadsto \color{blue}{\frac{\frac{1}{x \cdot \sqrt{x + 1}}}{2 + \frac{0.5 + \frac{-0.125}{x}}{x}}} \]
  9. Step-by-step derivation
    1. /-lowering-/.f64N/A

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

      \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{\sqrt{x + 1} \cdot x}\right), \left(2 + \frac{\frac{1}{2} + \frac{\frac{-1}{8}}{x}}{x}\right)\right) \]
    3. pow1/2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 99.0% accurate, 1.8× speedup?

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{\left(1 + x\right) - x}{x + \sqrt{x \cdot \left(1 + x\right)}}}{{\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) - \frac{1}{8} \cdot \frac{1}{x}}{x}\right)}, \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{1}{2}\right)\right) \]
  5. Simplified98.8%

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

Alternative 6: 99.1% accurate, 1.8× speedup?

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{\left(1 + x\right) - x}{x + \sqrt{x \cdot \left(1 + x\right)}}}{{\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. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(1, x\right), x\right), \mathsf{*.f64}\left(x, \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, \color{blue}{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), \mathsf{*.f64}\left(x, \left(2 + \left(\frac{1}{2} \cdot \frac{1}{x} - \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. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{{\left(1 + x\right)}^{\frac{1}{2}}} \cdot \left(x \cdot \left(2 + \frac{\frac{1}{2} + \frac{\frac{-1}{8}}{x}}{x}\right)\right)} \]
    5. associate-/r*N/A

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\left(x + 1\right), \frac{-1}{2}\right), \left(x \cdot \left(2 + \frac{\frac{1}{2} + \frac{\frac{-1}{8}}{x}}{x}\right)\right)\right) \]
    11. +-lowering-+.f64N/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}{2} + \frac{\frac{-1}{8}}{x}}{x}\right)\right)\right) \]
    12. distribute-lft-inN/A

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{-1}{2}\right), \left(\frac{x}{\frac{1}{2}} + \color{blue}{x} \cdot \frac{\frac{1}{2} + \frac{\frac{-1}{8}}{x}}{x}\right)\right) \]
    15. +-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{x}{\frac{1}{2}}\right), \color{blue}{\left(x \cdot \frac{\frac{1}{2} + \frac{\frac{-1}{8}}{x}}{x}\right)}\right)\right) \]
    16. /-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(x, \frac{1}{2}\right), \left(\color{blue}{x} \cdot \frac{\frac{1}{2} + \frac{\frac{-1}{8}}{x}}{x}\right)\right)\right) \]
    17. *-commutativeN/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(x, \frac{1}{2}\right), \left(\frac{\frac{1}{2} + \frac{\frac{-1}{8}}{x}}{x} \cdot \color{blue}{x}\right)\right)\right) \]
    18. 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(x, \frac{1}{2}\right), \left(\left(\left(\frac{1}{2} + \frac{\frac{-1}{8}}{x}\right) \cdot \frac{1}{x}\right) \cdot x\right)\right)\right) \]
    19. 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(x, \frac{1}{2}\right), \left(\left(\frac{1}{2} + \frac{\frac{-1}{8}}{x}\right) \cdot \color{blue}{\left(\frac{1}{x} \cdot x\right)}\right)\right)\right) \]
    20. 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(x, \frac{1}{2}\right), \left(\left(\frac{1}{2} + \frac{\frac{-1}{8}}{x}\right) \cdot \left({x}^{-1} \cdot x\right)\right)\right)\right) \]
    21. 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(x, \frac{1}{2}\right), \left(\left(\frac{1}{2} + \frac{\frac{-1}{8}}{x}\right) \cdot {x}^{\color{blue}{\left(-1 + 1\right)}}\right)\right)\right) \]
    22. 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(x, \frac{1}{2}\right), \left(\left(\frac{1}{2} + \frac{\frac{-1}{8}}{x}\right) \cdot {x}^{0}\right)\right)\right) \]
    23. 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(x, \frac{1}{2}\right), \left(\left(\frac{1}{2} + \frac{\frac{-1}{8}}{x}\right) \cdot 1\right)\right)\right) \]
  8. Applied egg-rr98.8%

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

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

Alternative 7: 98.7% accurate, 1.9× speedup?

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

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

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

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

    \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{\frac{1}{2} - \frac{1}{8} \cdot \frac{1}{x}}{x}\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(\left(\frac{\frac{1}{2} - \frac{1}{x} \cdot \frac{1}{8}}{x}\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{1}{2}\right)\right) \]
    2. cancel-sign-sub-invN/A

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

      \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1}{2} + \frac{1}{\mathsf{neg}\left(x\right)} \cdot \frac{1}{8}}{x}\right), \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{1}{2}\right)\right) \]
    4. mul-1-negN/A

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

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

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

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

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

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

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

Alternative 8: 97.8% accurate, 1.9× speedup?

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

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

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

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

    \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{\frac{1}{2}}{x}\right)}, \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{1}{2}\right)\right) \]
  5. Step-by-step derivation
    1. /-lowering-/.f6496.8%

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

    \[\leadsto \frac{\color{blue}{\frac{0.5}{x}}}{{\left(1 + x\right)}^{0.5}} \]
  7. Step-by-step derivation
    1. div-invN/A

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\left({\left(1 + x\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}\right), \left(\frac{\color{blue}{x}}{\frac{1}{2}}\right)\right) \]
    7. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\left({\left(1 + x\right)}^{\frac{-1}{2}}\right), \left(\frac{x}{\frac{1}{2}}\right)\right) \]
    8. 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}{x}}{\frac{1}{2}}\right)\right) \]
    9. +-commutativeN/A

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

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

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

    \[\leadsto \color{blue}{\frac{{\left(x + 1\right)}^{-0.5}}{\frac{x}{0.5}}} \]
  9. Final simplification96.8%

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

Alternative 9: 97.7% accurate, 1.9× speedup?

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

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

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

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

    \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{\frac{1}{2}}{x}\right)}, \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{1}{2}\right)\right) \]
  5. Step-by-step derivation
    1. /-lowering-/.f6496.8%

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

    \[\leadsto \frac{\color{blue}{\frac{0.5}{x}}}{{\left(1 + x\right)}^{0.5}} \]
  7. Add Preprocessing

Alternative 10: 97.7% accurate, 2.0× speedup?

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

\\
\frac{\frac{0.5}{\sqrt{1 + x}}}{x}
\end{array}
Derivation
  1. Initial program 37.3%

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

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

    \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{\frac{1}{2}}{x}\right)}, \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{1}{2}\right)\right) \]
  5. Step-by-step derivation
    1. /-lowering-/.f6496.8%

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

    \[\leadsto \frac{\color{blue}{\frac{0.5}{x}}}{{\left(1 + x\right)}^{0.5}} \]
  7. Step-by-step derivation
    1. associate-/l/N/A

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \left({\left(1 + x\right)}^{\frac{1}{2}}\right)\right), x\right) \]
    5. unpow1/2N/A

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\left(x + 1\right)\right)\right), x\right) \]
    8. +-lowering-+.f6496.7%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(x, 1\right)\right)\right), x\right) \]
  8. Applied egg-rr96.7%

    \[\leadsto \color{blue}{\frac{\frac{0.5}{\sqrt{x + 1}}}{x}} \]
  9. Final simplification96.7%

    \[\leadsto \frac{\frac{0.5}{\sqrt{1 + x}}}{x} \]
  10. Add Preprocessing

Alternative 11: 97.6% accurate, 2.0× speedup?

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

\\
\frac{\frac{0.5}{x}}{\sqrt{x}}
\end{array}
Derivation
  1. Initial program 37.3%

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

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

    \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{\frac{1}{2}}{x}\right)}, \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{1}{2}\right)\right) \]
  5. Step-by-step derivation
    1. /-lowering-/.f6496.8%

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

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

    \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, x\right), \color{blue}{\left(\sqrt{x}\right)}\right) \]
  8. Step-by-step derivation
    1. sqrt-lowering-sqrt.f6496.6%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, x\right), \mathsf{sqrt.f64}\left(x\right)\right) \]
  9. Simplified96.6%

    \[\leadsto \frac{\frac{0.5}{x}}{\color{blue}{\sqrt{x}}} \]
  10. Add Preprocessing

Alternative 12: 37.9% accurate, 23.2× speedup?

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

\\
\frac{\frac{0.5}{x}}{1 + x \cdot 0.5}
\end{array}
Derivation
  1. Initial program 37.3%

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

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

    \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{\frac{1}{2}}{x}\right)}, \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{1}{2}\right)\right) \]
  5. Step-by-step derivation
    1. /-lowering-/.f6496.8%

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, x\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \color{blue}{\frac{1}{2}}\right)\right)\right) \]
  9. Simplified35.3%

    \[\leadsto \frac{\frac{0.5}{x}}{\color{blue}{1 + x \cdot 0.5}} \]
  10. Add Preprocessing

Alternative 13: 7.9% accurate, 69.7× speedup?

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

\\
\frac{0.5}{x}
\end{array}
Derivation
  1. Initial program 37.3%

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

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

    \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{\frac{1}{2}}{x}\right)}, \mathsf{pow.f64}\left(\mathsf{+.f64}\left(1, x\right), \frac{1}{2}\right)\right) \]
  5. Step-by-step derivation
    1. /-lowering-/.f6496.8%

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

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

    \[\leadsto \color{blue}{\frac{\frac{1}{2}}{x}} \]
  8. Step-by-step derivation
    1. /-lowering-/.f647.9%

      \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \color{blue}{x}\right) \]
  9. Simplified7.9%

    \[\leadsto \color{blue}{\frac{0.5}{x}} \]
  10. Add Preprocessing

Developer Target 1: 98.3% 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 2024158 
(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)))))