2isqrt (example 3.6)

Percentage Accurate: 38.5% → 99.5%
Time: 11.0s
Alternatives: 7
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 7 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.5% 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.5% accurate, 1.0× speedup?

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

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

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

      \[\leadsto \mathsf{\_.f64}\left(\left({\left(\sqrt{x}\right)}^{-1}\right), \mathsf{/.f64}\left(\color{blue}{1}, \mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(x, 1\right)\right)\right)\right) \]
    2. pow1/2N/A

      \[\leadsto \mathsf{\_.f64}\left(\left({\left({x}^{\frac{1}{2}}\right)}^{-1}\right), \mathsf{/.f64}\left(1, \mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(x, 1\right)\right)\right)\right) \]
    3. pow-powN/A

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

      \[\leadsto \mathsf{\_.f64}\left(\mathsf{pow.f64}\left(x, \left(\frac{1}{2} \cdot -1\right)\right), \mathsf{/.f64}\left(\color{blue}{1}, \mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(x, 1\right)\right)\right)\right) \]
    5. metadata-eval27.7%

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

    \[\leadsto \color{blue}{{x}^{-0.5}} - \frac{1}{\sqrt{x + 1}} \]
  5. Step-by-step derivation
    1. pow1/2N/A

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

      \[\leadsto {x}^{\frac{-1}{2}} - \frac{1}{{\left(1 + x\right)}^{\frac{1}{2}}} \]
    3. pow-flipN/A

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{x} + \left(\mathsf{neg}\left({\left(1 + x\right)}^{\frac{-1}{2}} \cdot {\left(1 + x\right)}^{\frac{-1}{2}}\right)\right)}{\color{blue}{{x}^{\frac{-1}{2}}} + {\left(1 + x\right)}^{\frac{-1}{2}}} \]
    10. mul-1-negN/A

      \[\leadsto \frac{\frac{1}{x} + -1 \cdot \left({\left(1 + x\right)}^{\frac{-1}{2}} \cdot {\left(1 + x\right)}^{\frac{-1}{2}}\right)}{{x}^{\color{blue}{\frac{-1}{2}}} + {\left(1 + x\right)}^{\frac{-1}{2}}} \]
    11. pow-prod-upN/A

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

      \[\leadsto \frac{\frac{1}{x} + -1 \cdot {\left(1 + x\right)}^{-1}}{{x}^{\frac{-1}{2}} + {\left(1 + x\right)}^{\frac{-1}{2}}} \]
    13. inv-powN/A

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

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

      \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{x} + \frac{-1}{1 + x}\right), \color{blue}{\left({x}^{\frac{-1}{2}} + {\left(1 + x\right)}^{\frac{-1}{2}}\right)}\right) \]
  6. Applied egg-rr80.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.8% accurate, 1.0× speedup?

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

\\
\frac{{x}^{-1.5} \cdot -0.375 + {x}^{-0.5} \cdot 0.5}{x}
\end{array}
Derivation
  1. Initial program 35.6%

    \[\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 \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + \frac{1}{4} \cdot x\right)\right) - \left(\frac{-1}{2} \cdot \sqrt{x} + \frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right)}{{x}^{2}}} \]
  4. Simplified79.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{{x}^{-1.5} \cdot -0.375 + 0.5 \cdot {x}^{-0.5}}}{x} \]
  10. Final simplification99.1%

    \[\leadsto \frac{{x}^{-1.5} \cdot -0.375 + {x}^{-0.5} \cdot 0.5}{x} \]
  11. Add Preprocessing

Alternative 3: 98.7% accurate, 1.8× speedup?

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

\\
\frac{\frac{0.25 - \frac{0.140625}{x \cdot x}}{x}}{\left(0.5 + \frac{0.375}{x}\right) \cdot \sqrt{x}}
\end{array}
Derivation
  1. Initial program 35.6%

    \[\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 \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + \frac{1}{4} \cdot x\right)\right) - \left(\frac{-1}{2} \cdot \sqrt{x} + \frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right)}{{x}^{2}}} \]
  4. Simplified79.8%

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{x} \cdot \frac{1}{4} - \frac{\frac{1}{x}}{x \cdot x} \cdot \frac{9}{64}\right), \color{blue}{\left(x \cdot \frac{\frac{1}{2} - \frac{-3}{8} \cdot \frac{1}{x}}{\sqrt{x}}\right)}\right) \]
  10. Applied egg-rr99.0%

    \[\leadsto \color{blue}{\frac{\frac{0.25 - \frac{0.140625}{x \cdot x}}{x}}{\left(0.5 + \frac{0.375}{x}\right) \cdot \sqrt{x}}} \]
  11. Add Preprocessing

Alternative 4: 98.7% accurate, 1.8× speedup?

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

\\
\frac{\frac{1}{\frac{\frac{0.5 + -0.375 \cdot \frac{-1}{x}}{\sqrt{x}}}{\frac{0.25}{x}}}}{x}
\end{array}
Derivation
  1. Initial program 35.6%

    \[\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 \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + \frac{1}{4} \cdot x\right)\right) - \left(\frac{-1}{2} \cdot \sqrt{x} + \frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right)}{{x}^{2}}} \]
  4. Simplified79.8%

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

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

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

    \[\leadsto \color{blue}{\frac{0.5 \cdot \sqrt{\frac{1}{x}} + \sqrt{\frac{\frac{1}{x \cdot x}}{x}} \cdot -0.375}{x}} \]
  8. Applied egg-rr98.8%

    \[\leadsto \frac{\color{blue}{\frac{1}{\frac{\frac{0.5 - -0.375 \cdot \frac{1}{x}}{\sqrt{x}}}{\frac{1}{x} \cdot 0.25 - \frac{\frac{1}{x}}{x \cdot x} \cdot 0.140625}}}}{x} \]
  9. Taylor expanded in x around inf

    \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{/.f64}\left(1, x\right)\right)\right), \mathsf{sqrt.f64}\left(x\right)\right), \color{blue}{\left(\frac{\frac{1}{4}}{x}\right)}\right)\right), x\right) \]
  10. Step-by-step derivation
    1. /-lowering-/.f6498.9%

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

    \[\leadsto \frac{\frac{1}{\frac{\frac{0.5 - -0.375 \cdot \frac{1}{x}}{\sqrt{x}}}{\color{blue}{\frac{0.25}{x}}}}}{x} \]
  12. Final simplification98.9%

    \[\leadsto \frac{\frac{1}{\frac{\frac{0.5 + -0.375 \cdot \frac{-1}{x}}{\sqrt{x}}}{\frac{0.25}{x}}}}{x} \]
  13. Add Preprocessing

Alternative 5: 98.7% accurate, 1.8× speedup?

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

\\
\frac{\frac{0.25}{x}}{x \cdot \frac{0.5 + -0.375 \cdot \frac{-1}{x}}{\sqrt{x}}}
\end{array}
Derivation
  1. Initial program 35.6%

    \[\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 \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + \frac{1}{4} \cdot x\right)\right) - \left(\frac{-1}{2} \cdot \sqrt{x} + \frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right)}{{x}^{2}}} \]
  4. Simplified79.8%

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{1}{x} \cdot 0.25 - \frac{\frac{1}{x}}{x \cdot x} \cdot 0.140625}{x \cdot \frac{0.5 - -0.375 \cdot \frac{1}{x}}{\sqrt{x}}}} \]
  9. Taylor expanded in x around inf

    \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{\frac{1}{4}}{x}\right)}, \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-3}{8}, \mathsf{/.f64}\left(1, x\right)\right)\right), \mathsf{sqrt.f64}\left(x\right)\right)\right)\right) \]
  10. Step-by-step derivation
    1. /-lowering-/.f6498.9%

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

    \[\leadsto \frac{\color{blue}{\frac{0.25}{x}}}{x \cdot \frac{0.5 - -0.375 \cdot \frac{1}{x}}{\sqrt{x}}} \]
  12. Final simplification98.9%

    \[\leadsto \frac{\frac{0.25}{x}}{x \cdot \frac{0.5 + -0.375 \cdot \frac{-1}{x}}{\sqrt{x}}} \]
  13. Add Preprocessing

Alternative 6: 98.0% accurate, 2.0× speedup?

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

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

    \[\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 \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + \frac{1}{4} \cdot x\right)\right) - \left(\frac{-1}{2} \cdot \sqrt{x} + \frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right)}{{x}^{2}}} \]
  4. Simplified79.8%

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

    \[\leadsto \color{blue}{\frac{1}{2} \cdot \sqrt{\frac{1}{{x}^{3}}}} \]
  6. Step-by-step derivation
    1. *-lowering-*.f64N/A

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

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\left(\frac{1}{{x}^{3}}\right)\right)\right) \]
    3. unpow3N/A

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\left(\frac{1}{\left(x \cdot x\right) \cdot x}\right)\right)\right) \]
    4. unpow2N/A

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(x \cdot x\right)\right), x\right)\right)\right) \]
    9. *-lowering-*.f6464.3%

      \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), x\right)\right)\right) \]
  7. Simplified64.3%

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\frac{1}{x \cdot \left(x \cdot x\right)}}\right), \frac{1}{2}\right) \]
    4. inv-powN/A

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\left({x}^{\frac{-1}{2}} \cdot \left({x}^{\frac{-1}{2}} \cdot {x}^{\frac{-1}{2}}\right)\right), \frac{1}{2}\right) \]
    9. cube-multN/A

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

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

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

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

    \[\leadsto \color{blue}{{x}^{-1.5} \cdot 0.5} \]
  10. Add Preprocessing

Alternative 7: 5.6% accurate, 2.0× speedup?

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

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

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

    \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \]
  4. Step-by-step derivation
    1. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{1}{x}\right)\right) \]
    2. /-lowering-/.f645.6%

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, x\right)\right) \]
  5. Simplified5.6%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \]
  6. Step-by-step derivation
    1. inv-powN/A

      \[\leadsto \sqrt{{x}^{-1}} \]
    2. sqrt-pow1N/A

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

      \[\leadsto {x}^{\frac{-1}{2}} \]
    4. pow-lowering-pow.f645.6%

      \[\leadsto \mathsf{pow.f64}\left(x, \color{blue}{\frac{-1}{2}}\right) \]
  7. Applied egg-rr5.6%

    \[\leadsto \color{blue}{{x}^{-0.5}} \]
  8. Add Preprocessing

Developer Target 1: 98.1% 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 2024155 
(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)))))