2isqrt (example 3.6)

Percentage Accurate: 38.8% → 98.9%
Time: 20.3s
Alternatives: 8
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 8 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 38.8% accurate, 1.0× speedup?

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

\\
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\end{array}

Alternative 1: 98.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{1}{{x}^{5}}}\\ t_1 := \sqrt{\frac{1}{x}}\\ \frac{\left(\mathsf{fma}\left(t\_0, -0.25, 0.5 \cdot t\_1\right) - t\_1 \cdot \frac{0.375}{x}\right) + t\_0 \cdot 0.5}{x} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (sqrt (/ 1.0 (pow x 5.0)))) (t_1 (sqrt (/ 1.0 x))))
   (/ (+ (- (fma t_0 -0.25 (* 0.5 t_1)) (* t_1 (/ 0.375 x))) (* t_0 0.5)) x)))
double code(double x) {
	double t_0 = sqrt((1.0 / pow(x, 5.0)));
	double t_1 = sqrt((1.0 / x));
	return ((fma(t_0, -0.25, (0.5 * t_1)) - (t_1 * (0.375 / x))) + (t_0 * 0.5)) / x;
}
function code(x)
	t_0 = sqrt(Float64(1.0 / (x ^ 5.0)))
	t_1 = sqrt(Float64(1.0 / x))
	return Float64(Float64(Float64(fma(t_0, -0.25, Float64(0.5 * t_1)) - Float64(t_1 * Float64(0.375 / x))) + Float64(t_0 * 0.5)) / x)
end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(N[(t$95$0 * -0.25 + N[(0.5 * t$95$1), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * N[(0.375 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * 0.5), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{{x}^{5}}}\\
t_1 := \sqrt{\frac{1}{x}}\\
\frac{\left(\mathsf{fma}\left(t\_0, -0.25, 0.5 \cdot t\_1\right) - t\_1 \cdot \frac{0.375}{x}\right) + t\_0 \cdot 0.5}{x}
\end{array}
\end{array}
Derivation
  1. Initial program 40.0%

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

    \[\leadsto \color{blue}{\frac{-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{5}}} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}}} \]
  4. Step-by-step derivation
    1. *-un-lft-identity83.3%

      \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{\left(1 \cdot \sqrt{\frac{1}{{x}^{5}}}\right)} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
    2. pow1/283.3%

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

      \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {\color{blue}{\left({x}^{\left(-5\right)}\right)}}^{0.5}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
    4. pow-pow83.3%

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

      \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {x}^{\left(\color{blue}{-5} \cdot 0.5\right)}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
    6. metadata-eval83.3%

      \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {x}^{\color{blue}{-2.5}}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
  5. Applied egg-rr83.3%

    \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{\left(1 \cdot {x}^{-2.5}\right)} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
  6. Step-by-step derivation
    1. *-lft-identity83.3%

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

    \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{{x}^{-2.5}} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
  8. Taylor expanded in x around inf 98.9%

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

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

      \[\leadsto \frac{\left(\mathsf{fma}\left(\sqrt{\frac{1}{{x}^{5}}}, -0.25, 0.5 \cdot \sqrt{\frac{1}{x}}\right) - \sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}\right) + \sqrt{\frac{1}{{x}^{5}}} \cdot 0.5}{x} \]
    3. Add Preprocessing

    Alternative 2: 98.9% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \frac{\mathsf{fma}\left(0.5, {x}^{-2.5}, -0.25 \cdot {x}^{-2.5} + {x}^{-0.5} \cdot \left(0.5 + \frac{-0.375}{x}\right)\right)}{x} \end{array} \]
    (FPCore (x)
     :precision binary64
     (/
      (fma
       0.5
       (pow x -2.5)
       (+ (* -0.25 (pow x -2.5)) (* (pow x -0.5) (+ 0.5 (/ -0.375 x)))))
      x))
    double code(double x) {
    	return fma(0.5, pow(x, -2.5), ((-0.25 * pow(x, -2.5)) + (pow(x, -0.5) * (0.5 + (-0.375 / x))))) / x;
    }
    
    function code(x)
    	return Float64(fma(0.5, (x ^ -2.5), Float64(Float64(-0.25 * (x ^ -2.5)) + Float64((x ^ -0.5) * Float64(0.5 + Float64(-0.375 / x))))) / x)
    end
    
    code[x_] := N[(N[(0.5 * N[Power[x, -2.5], $MachinePrecision] + N[(N[(-0.25 * N[Power[x, -2.5], $MachinePrecision]), $MachinePrecision] + N[(N[Power[x, -0.5], $MachinePrecision] * N[(0.5 + N[(-0.375 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \frac{\mathsf{fma}\left(0.5, {x}^{-2.5}, -0.25 \cdot {x}^{-2.5} + {x}^{-0.5} \cdot \left(0.5 + \frac{-0.375}{x}\right)\right)}{x}
    \end{array}
    
    Derivation
    1. Initial program 40.0%

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

      \[\leadsto \color{blue}{\frac{-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{5}}} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}}} \]
    4. Step-by-step derivation
      1. *-un-lft-identity83.3%

        \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{\left(1 \cdot \sqrt{\frac{1}{{x}^{5}}}\right)} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
      2. pow1/283.3%

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

        \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {\color{blue}{\left({x}^{\left(-5\right)}\right)}}^{0.5}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
      4. pow-pow83.3%

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

        \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {x}^{\left(\color{blue}{-5} \cdot 0.5\right)}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
      6. metadata-eval83.3%

        \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {x}^{\color{blue}{-2.5}}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
    5. Applied egg-rr83.3%

      \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{\left(1 \cdot {x}^{-2.5}\right)} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
    6. Step-by-step derivation
      1. *-lft-identity83.3%

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

      \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{{x}^{-2.5}} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
    8. Taylor expanded in x around inf 98.9%

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

        \[\leadsto \color{blue}{\frac{\left(\mathsf{fma}\left(\sqrt{\frac{1}{{x}^{5}}}, -0.25, 0.5 \cdot \sqrt{\frac{1}{x}}\right) - \sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}\right) + \sqrt{\frac{1}{{x}^{5}}} \cdot 0.5}{x}} \]
      2. Step-by-step derivation
        1. *-un-lft-identity98.9%

          \[\leadsto \color{blue}{1 \cdot \frac{\left(\mathsf{fma}\left(\sqrt{\frac{1}{{x}^{5}}}, -0.25, 0.5 \cdot \sqrt{\frac{1}{x}}\right) - \sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}\right) + \sqrt{\frac{1}{{x}^{5}}} \cdot 0.5}{x}} \]
      3. Applied egg-rr98.9%

        \[\leadsto \color{blue}{1 \cdot \frac{\mathsf{fma}\left(0.5, {x}^{-2.5}, \mathsf{fma}\left({x}^{-2.5}, -0.25, {x}^{-0.5} \cdot 0.5\right) - {x}^{-0.5} \cdot \frac{0.375}{x}\right)}{x}} \]
      4. Step-by-step derivation
        1. *-lft-identity98.9%

          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(0.5, {x}^{-2.5}, \mathsf{fma}\left({x}^{-2.5}, -0.25, {x}^{-0.5} \cdot 0.5\right) - {x}^{-0.5} \cdot \frac{0.375}{x}\right)}{x}} \]
        2. fma-undefine98.9%

          \[\leadsto \frac{\mathsf{fma}\left(0.5, {x}^{-2.5}, \color{blue}{\left({x}^{-2.5} \cdot -0.25 + {x}^{-0.5} \cdot 0.5\right)} - {x}^{-0.5} \cdot \frac{0.375}{x}\right)}{x} \]
        3. associate--l+98.9%

          \[\leadsto \frac{\mathsf{fma}\left(0.5, {x}^{-2.5}, \color{blue}{{x}^{-2.5} \cdot -0.25 + \left({x}^{-0.5} \cdot 0.5 - {x}^{-0.5} \cdot \frac{0.375}{x}\right)}\right)}{x} \]
        4. *-commutative98.9%

          \[\leadsto \frac{\mathsf{fma}\left(0.5, {x}^{-2.5}, \color{blue}{-0.25 \cdot {x}^{-2.5}} + \left({x}^{-0.5} \cdot 0.5 - {x}^{-0.5} \cdot \frac{0.375}{x}\right)\right)}{x} \]
        5. distribute-lft-out--98.9%

          \[\leadsto \frac{\mathsf{fma}\left(0.5, {x}^{-2.5}, -0.25 \cdot {x}^{-2.5} + \color{blue}{{x}^{-0.5} \cdot \left(0.5 - \frac{0.375}{x}\right)}\right)}{x} \]
        6. sub-neg98.9%

          \[\leadsto \frac{\mathsf{fma}\left(0.5, {x}^{-2.5}, -0.25 \cdot {x}^{-2.5} + {x}^{-0.5} \cdot \color{blue}{\left(0.5 + \left(-\frac{0.375}{x}\right)\right)}\right)}{x} \]
        7. distribute-neg-frac98.9%

          \[\leadsto \frac{\mathsf{fma}\left(0.5, {x}^{-2.5}, -0.25 \cdot {x}^{-2.5} + {x}^{-0.5} \cdot \left(0.5 + \color{blue}{\frac{-0.375}{x}}\right)\right)}{x} \]
        8. metadata-eval98.9%

          \[\leadsto \frac{\mathsf{fma}\left(0.5, {x}^{-2.5}, -0.25 \cdot {x}^{-2.5} + {x}^{-0.5} \cdot \left(0.5 + \frac{\color{blue}{-0.375}}{x}\right)\right)}{x} \]
      5. Simplified98.9%

        \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(0.5, {x}^{-2.5}, -0.25 \cdot {x}^{-2.5} + {x}^{-0.5} \cdot \left(0.5 + \frac{-0.375}{x}\right)\right)}{x}} \]
      6. Final simplification98.9%

        \[\leadsto \frac{\mathsf{fma}\left(0.5, {x}^{-2.5}, -0.25 \cdot {x}^{-2.5} + {x}^{-0.5} \cdot \left(0.5 + \frac{-0.375}{x}\right)\right)}{x} \]
      7. Add Preprocessing

      Alternative 3: 98.8% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{1}{x}}\\ \frac{0.5 \cdot t\_0 - t\_0 \cdot \frac{0.375}{x}}{x} \end{array} \end{array} \]
      (FPCore (x)
       :precision binary64
       (let* ((t_0 (sqrt (/ 1.0 x)))) (/ (- (* 0.5 t_0) (* t_0 (/ 0.375 x))) x)))
      double code(double x) {
      	double t_0 = sqrt((1.0 / x));
      	return ((0.5 * t_0) - (t_0 * (0.375 / x))) / x;
      }
      
      real(8) function code(x)
          real(8), intent (in) :: x
          real(8) :: t_0
          t_0 = sqrt((1.0d0 / x))
          code = ((0.5d0 * t_0) - (t_0 * (0.375d0 / x))) / x
      end function
      
      public static double code(double x) {
      	double t_0 = Math.sqrt((1.0 / x));
      	return ((0.5 * t_0) - (t_0 * (0.375 / x))) / x;
      }
      
      def code(x):
      	t_0 = math.sqrt((1.0 / x))
      	return ((0.5 * t_0) - (t_0 * (0.375 / x))) / x
      
      function code(x)
      	t_0 = sqrt(Float64(1.0 / x))
      	return Float64(Float64(Float64(0.5 * t_0) - Float64(t_0 * Float64(0.375 / x))) / x)
      end
      
      function tmp = code(x)
      	t_0 = sqrt((1.0 / x));
      	tmp = ((0.5 * t_0) - (t_0 * (0.375 / x))) / x;
      end
      
      code[x_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(0.5 * t$95$0), $MachinePrecision] - N[(t$95$0 * N[(0.375 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \sqrt{\frac{1}{x}}\\
      \frac{0.5 \cdot t\_0 - t\_0 \cdot \frac{0.375}{x}}{x}
      \end{array}
      \end{array}
      
      Derivation
      1. Initial program 40.0%

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{5}}} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}}} \]
      4. Step-by-step derivation
        1. *-un-lft-identity83.3%

          \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{\left(1 \cdot \sqrt{\frac{1}{{x}^{5}}}\right)} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
        2. pow1/283.3%

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

          \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {\color{blue}{\left({x}^{\left(-5\right)}\right)}}^{0.5}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
        4. pow-pow83.3%

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

          \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {x}^{\left(\color{blue}{-5} \cdot 0.5\right)}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
        6. metadata-eval83.3%

          \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {x}^{\color{blue}{-2.5}}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
      5. Applied egg-rr83.3%

        \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{\left(1 \cdot {x}^{-2.5}\right)} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
      6. Step-by-step derivation
        1. *-lft-identity83.3%

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

        \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{{x}^{-2.5}} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
      8. Taylor expanded in x around inf 98.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}} \]
      9. Step-by-step derivation
        1. +-commutative98.8%

          \[\leadsto \frac{\color{blue}{0.5 \cdot \sqrt{\frac{1}{x}} + -1 \cdot \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}}}{x} \]
        2. mul-1-neg98.8%

          \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}} + \color{blue}{\left(-\frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}\right)}}{x} \]
        3. unsub-neg98.8%

          \[\leadsto \frac{\color{blue}{0.5 \cdot \sqrt{\frac{1}{x}} - \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}}}{x} \]
        4. distribute-rgt-out98.8%

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

          \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}} - \frac{\sqrt{\frac{1}{x}} \cdot \color{blue}{0.375}}{x}}{x} \]
        6. associate-/l*98.8%

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

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

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

      Alternative 4: 98.8% accurate, 1.0× speedup?

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{5}}} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}}} \]
      4. Step-by-step derivation
        1. *-un-lft-identity83.3%

          \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{\left(1 \cdot \sqrt{\frac{1}{{x}^{5}}}\right)} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
        2. pow1/283.3%

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

          \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {\color{blue}{\left({x}^{\left(-5\right)}\right)}}^{0.5}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
        4. pow-pow83.3%

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

          \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {x}^{\left(\color{blue}{-5} \cdot 0.5\right)}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
        6. metadata-eval83.3%

          \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {x}^{\color{blue}{-2.5}}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
      5. Applied egg-rr83.3%

        \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{\left(1 \cdot {x}^{-2.5}\right)} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
      6. Step-by-step derivation
        1. *-lft-identity83.3%

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

        \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{{x}^{-2.5}} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
      8. Taylor expanded in x around inf 98.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}} \]
      9. Step-by-step derivation
        1. +-commutative98.8%

          \[\leadsto \frac{\color{blue}{0.5 \cdot \sqrt{\frac{1}{x}} + -1 \cdot \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}}}{x} \]
        2. mul-1-neg98.8%

          \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}} + \color{blue}{\left(-\frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}\right)}}{x} \]
        3. unsub-neg98.8%

          \[\leadsto \frac{\color{blue}{0.5 \cdot \sqrt{\frac{1}{x}} - \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}}}{x} \]
        4. distribute-rgt-out98.8%

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

          \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}} - \frac{\sqrt{\frac{1}{x}} \cdot \color{blue}{0.375}}{x}}{x} \]
        6. associate-/l*98.8%

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sqrt{\frac{1}{x}} - \sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}}{x}} \]
      11. Step-by-step derivation
        1. inv-pow5.5%

          \[\leadsto \sqrt{\color{blue}{{x}^{-1}}} \]
        2. sqrt-pow15.5%

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

          \[\leadsto {x}^{\color{blue}{-0.5}} \]
        4. *-un-lft-identity5.5%

          \[\leadsto \color{blue}{1 \cdot {x}^{-0.5}} \]
      12. Applied egg-rr98.8%

        \[\leadsto \frac{0.5 \cdot \color{blue}{\left(1 \cdot {x}^{-0.5}\right)} - \sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}}{x} \]
      13. Step-by-step derivation
        1. *-lft-identity5.5%

          \[\leadsto \color{blue}{{x}^{-0.5}} \]
      14. Simplified98.8%

        \[\leadsto \frac{0.5 \cdot \color{blue}{{x}^{-0.5}} - \sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}}{x} \]
      15. Final simplification98.8%

        \[\leadsto \frac{0.5 \cdot {x}^{-0.5} - \sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}}{x} \]
      16. Add Preprocessing

      Alternative 5: 98.7% accurate, 1.9× speedup?

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{5}}} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}}} \]
      4. Step-by-step derivation
        1. *-un-lft-identity83.3%

          \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{\left(1 \cdot \sqrt{\frac{1}{{x}^{5}}}\right)} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
        2. pow1/283.3%

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

          \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {\color{blue}{\left({x}^{\left(-5\right)}\right)}}^{0.5}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
        4. pow-pow83.3%

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

          \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {x}^{\left(\color{blue}{-5} \cdot 0.5\right)}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
        6. metadata-eval83.3%

          \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {x}^{\color{blue}{-2.5}}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
      5. Applied egg-rr83.3%

        \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{\left(1 \cdot {x}^{-2.5}\right)} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
      6. Step-by-step derivation
        1. *-lft-identity83.3%

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

        \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{{x}^{-2.5}} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
      8. Taylor expanded in x around inf 98.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}} \]
      9. Step-by-step derivation
        1. +-commutative98.8%

          \[\leadsto \frac{\color{blue}{0.5 \cdot \sqrt{\frac{1}{x}} + -1 \cdot \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}}}{x} \]
        2. mul-1-neg98.8%

          \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}} + \color{blue}{\left(-\frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}\right)}}{x} \]
        3. unsub-neg98.8%

          \[\leadsto \frac{\color{blue}{0.5 \cdot \sqrt{\frac{1}{x}} - \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}}}{x} \]
        4. distribute-rgt-out98.8%

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

          \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}} - \frac{\sqrt{\frac{1}{x}} \cdot \color{blue}{0.375}}{x}}{x} \]
        6. associate-/l*98.8%

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sqrt{\frac{1}{x}} - \sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}}{x}} \]
      11. Step-by-step derivation
        1. div-sub98.8%

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

          \[\leadsto \frac{\color{blue}{\sqrt{\frac{1}{x}} \cdot 0.5}}{x} - \frac{\sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}}{x} \]
        3. pow1/298.8%

          \[\leadsto \frac{\color{blue}{{\left(\frac{1}{x}\right)}^{0.5}} \cdot 0.5}{x} - \frac{\sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}}{x} \]
        4. inv-pow98.8%

          \[\leadsto \frac{{\color{blue}{\left({x}^{-1}\right)}}^{0.5} \cdot 0.5}{x} - \frac{\sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}}{x} \]
        5. pow-pow98.8%

          \[\leadsto \frac{\color{blue}{{x}^{\left(-1 \cdot 0.5\right)}} \cdot 0.5}{x} - \frac{\sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}}{x} \]
        6. metadata-eval98.8%

          \[\leadsto \frac{{x}^{\color{blue}{-0.5}} \cdot 0.5}{x} - \frac{\sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}}{x} \]
        7. pow1/298.8%

          \[\leadsto \frac{{x}^{-0.5} \cdot 0.5}{x} - \frac{\color{blue}{{\left(\frac{1}{x}\right)}^{0.5}} \cdot \frac{0.375}{x}}{x} \]
        8. inv-pow98.8%

          \[\leadsto \frac{{x}^{-0.5} \cdot 0.5}{x} - \frac{{\color{blue}{\left({x}^{-1}\right)}}^{0.5} \cdot \frac{0.375}{x}}{x} \]
        9. pow-pow98.8%

          \[\leadsto \frac{{x}^{-0.5} \cdot 0.5}{x} - \frac{\color{blue}{{x}^{\left(-1 \cdot 0.5\right)}} \cdot \frac{0.375}{x}}{x} \]
        10. metadata-eval98.8%

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

        \[\leadsto \color{blue}{\frac{{x}^{-0.5} \cdot 0.5}{x} - \frac{{x}^{-0.5} \cdot \frac{0.375}{x}}{x}} \]
      13. Step-by-step derivation
        1. div-sub98.8%

          \[\leadsto \color{blue}{\frac{{x}^{-0.5} \cdot 0.5 - {x}^{-0.5} \cdot \frac{0.375}{x}}{x}} \]
        2. distribute-lft-out--98.8%

          \[\leadsto \frac{\color{blue}{{x}^{-0.5} \cdot \left(0.5 - \frac{0.375}{x}\right)}}{x} \]
        3. associate-/l*98.7%

          \[\leadsto \color{blue}{{x}^{-0.5} \cdot \frac{0.5 - \frac{0.375}{x}}{x}} \]
        4. sub-neg98.7%

          \[\leadsto {x}^{-0.5} \cdot \frac{\color{blue}{0.5 + \left(-\frac{0.375}{x}\right)}}{x} \]
        5. distribute-neg-frac98.7%

          \[\leadsto {x}^{-0.5} \cdot \frac{0.5 + \color{blue}{\frac{-0.375}{x}}}{x} \]
        6. metadata-eval98.7%

          \[\leadsto {x}^{-0.5} \cdot \frac{0.5 + \frac{\color{blue}{-0.375}}{x}}{x} \]
      14. Simplified98.7%

        \[\leadsto \color{blue}{{x}^{-0.5} \cdot \frac{0.5 + \frac{-0.375}{x}}{x}} \]
      15. Final simplification98.7%

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

      Alternative 6: 98.8% accurate, 1.9× speedup?

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{5}}} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}}} \]
      4. Step-by-step derivation
        1. *-un-lft-identity83.3%

          \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{\left(1 \cdot \sqrt{\frac{1}{{x}^{5}}}\right)} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
        2. pow1/283.3%

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

          \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {\color{blue}{\left({x}^{\left(-5\right)}\right)}}^{0.5}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
        4. pow-pow83.3%

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

          \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {x}^{\left(\color{blue}{-5} \cdot 0.5\right)}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
        6. metadata-eval83.3%

          \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {x}^{\color{blue}{-2.5}}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
      5. Applied egg-rr83.3%

        \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{\left(1 \cdot {x}^{-2.5}\right)} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
      6. Step-by-step derivation
        1. *-lft-identity83.3%

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

        \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{{x}^{-2.5}} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
      8. Taylor expanded in x around inf 98.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}} \]
      9. Step-by-step derivation
        1. +-commutative98.8%

          \[\leadsto \frac{\color{blue}{0.5 \cdot \sqrt{\frac{1}{x}} + -1 \cdot \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}}}{x} \]
        2. mul-1-neg98.8%

          \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}} + \color{blue}{\left(-\frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}\right)}}{x} \]
        3. unsub-neg98.8%

          \[\leadsto \frac{\color{blue}{0.5 \cdot \sqrt{\frac{1}{x}} - \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}}}{x} \]
        4. distribute-rgt-out98.8%

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

          \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}} - \frac{\sqrt{\frac{1}{x}} \cdot \color{blue}{0.375}}{x}}{x} \]
        6. associate-/l*98.8%

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sqrt{\frac{1}{x}} - \sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}}{x}} \]
      11. Step-by-step derivation
        1. div-sub98.8%

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

          \[\leadsto \frac{\color{blue}{\sqrt{\frac{1}{x}} \cdot 0.5}}{x} - \frac{\sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}}{x} \]
        3. pow1/298.8%

          \[\leadsto \frac{\color{blue}{{\left(\frac{1}{x}\right)}^{0.5}} \cdot 0.5}{x} - \frac{\sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}}{x} \]
        4. inv-pow98.8%

          \[\leadsto \frac{{\color{blue}{\left({x}^{-1}\right)}}^{0.5} \cdot 0.5}{x} - \frac{\sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}}{x} \]
        5. pow-pow98.8%

          \[\leadsto \frac{\color{blue}{{x}^{\left(-1 \cdot 0.5\right)}} \cdot 0.5}{x} - \frac{\sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}}{x} \]
        6. metadata-eval98.8%

          \[\leadsto \frac{{x}^{\color{blue}{-0.5}} \cdot 0.5}{x} - \frac{\sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}}{x} \]
        7. pow1/298.8%

          \[\leadsto \frac{{x}^{-0.5} \cdot 0.5}{x} - \frac{\color{blue}{{\left(\frac{1}{x}\right)}^{0.5}} \cdot \frac{0.375}{x}}{x} \]
        8. inv-pow98.8%

          \[\leadsto \frac{{x}^{-0.5} \cdot 0.5}{x} - \frac{{\color{blue}{\left({x}^{-1}\right)}}^{0.5} \cdot \frac{0.375}{x}}{x} \]
        9. pow-pow98.8%

          \[\leadsto \frac{{x}^{-0.5} \cdot 0.5}{x} - \frac{\color{blue}{{x}^{\left(-1 \cdot 0.5\right)}} \cdot \frac{0.375}{x}}{x} \]
        10. metadata-eval98.8%

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

        \[\leadsto \color{blue}{\frac{{x}^{-0.5} \cdot 0.5}{x} - \frac{{x}^{-0.5} \cdot \frac{0.375}{x}}{x}} \]
      13. Step-by-step derivation
        1. div-sub98.8%

          \[\leadsto \color{blue}{\frac{{x}^{-0.5} \cdot 0.5 - {x}^{-0.5} \cdot \frac{0.375}{x}}{x}} \]
        2. distribute-lft-out--98.8%

          \[\leadsto \frac{\color{blue}{{x}^{-0.5} \cdot \left(0.5 - \frac{0.375}{x}\right)}}{x} \]
      14. Simplified98.8%

        \[\leadsto \color{blue}{\frac{{x}^{-0.5} \cdot \left(0.5 - \frac{0.375}{x}\right)}{x}} \]
      15. Final simplification98.8%

        \[\leadsto \frac{{x}^{-0.5} \cdot \left(0.5 - \frac{0.375}{x}\right)}{x} \]
      16. Add Preprocessing

      Alternative 7: 97.7% accurate, 2.0× speedup?

      \[\begin{array}{l} \\ \frac{0.5 \cdot \sqrt{\frac{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{0.5 \cdot \sqrt{\frac{1}{x}}}{x}
      \end{array}
      
      Derivation
      1. Initial program 40.0%

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{5}}} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}}} \]
      4. Step-by-step derivation
        1. *-un-lft-identity83.3%

          \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{\left(1 \cdot \sqrt{\frac{1}{{x}^{5}}}\right)} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
        2. pow1/283.3%

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

          \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {\color{blue}{\left({x}^{\left(-5\right)}\right)}}^{0.5}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
        4. pow-pow83.3%

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

          \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {x}^{\left(\color{blue}{-5} \cdot 0.5\right)}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
        6. metadata-eval83.3%

          \[\leadsto \frac{-0.5 \cdot \left(\left(1 \cdot {x}^{\color{blue}{-2.5}}\right) \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
      5. Applied egg-rr83.3%

        \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{\left(1 \cdot {x}^{-2.5}\right)} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
      6. Step-by-step derivation
        1. *-lft-identity83.3%

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

        \[\leadsto \frac{-0.5 \cdot \left(\color{blue}{{x}^{-2.5}} \cdot \left(1 + 0.5 \cdot x\right)\right) - \left(-0.5 \cdot \sqrt{x} + \left(-0.5 \cdot \left(\sqrt{\frac{1}{{x}^{3}}} \cdot \left(1 + 0.25 \cdot x\right)\right) + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)}{{x}^{2}} \]
      8. Taylor expanded in x around inf 98.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}} \]
      9. Step-by-step derivation
        1. +-commutative98.8%

          \[\leadsto \frac{\color{blue}{0.5 \cdot \sqrt{\frac{1}{x}} + -1 \cdot \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}}}{x} \]
        2. mul-1-neg98.8%

          \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}} + \color{blue}{\left(-\frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}\right)}}{x} \]
        3. unsub-neg98.8%

          \[\leadsto \frac{\color{blue}{0.5 \cdot \sqrt{\frac{1}{x}} - \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}}}{x} \]
        4. distribute-rgt-out98.8%

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

          \[\leadsto \frac{0.5 \cdot \sqrt{\frac{1}{x}} - \frac{\sqrt{\frac{1}{x}} \cdot \color{blue}{0.375}}{x}}{x} \]
        6. associate-/l*98.8%

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot \sqrt{\frac{1}{x}} - \sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}}{x}} \]
      11. Taylor expanded in x around inf 98.0%

        \[\leadsto \frac{\color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}}}{x} \]
      12. Final simplification98.0%

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

      Alternative 8: 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 40.0%

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

        \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \]
      4. Step-by-step derivation
        1. inv-pow5.5%

          \[\leadsto \sqrt{\color{blue}{{x}^{-1}}} \]
        2. sqrt-pow15.5%

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

          \[\leadsto {x}^{\color{blue}{-0.5}} \]
        4. *-un-lft-identity5.5%

          \[\leadsto \color{blue}{1 \cdot {x}^{-0.5}} \]
      5. Applied egg-rr5.5%

        \[\leadsto \color{blue}{1 \cdot {x}^{-0.5}} \]
      6. Step-by-step derivation
        1. *-lft-identity5.5%

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

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

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

      Developer target: 98.5% 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 2024115 
      (FPCore (x)
        :name "2isqrt (example 3.6)"
        :precision binary64
        :pre (and (> x 1.0) (< x 1e+308))
      
        :alt
        (/ 1.0 (+ (* (+ x 1.0) (sqrt x)) (* x (sqrt (+ x 1.0)))))
      
        (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))