2isqrt (example 3.6)

Percentage Accurate: 38.6% → 99.3%
Time: 15.6s
Alternatives: 10
Speedup: 1.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 10 alternatives:

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

Initial Program: 38.6% accurate, 1.0× speedup?

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

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

Alternative 1: 99.3% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{{x}^{7}}}\\
\frac{\mathsf{fma}\left({x}^{-1.5}, -0.3125, \mathsf{fma}\left(t\_0, -0.1904296875, t\_0 \cdot -0.0830078125 + \left(\sqrt{\frac{1}{{x}^{5}}} \cdot 0.3125 + \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{3}}}, -0.0625, 0.5 \cdot {x}^{-0.5}\right)\right)\right)\right)}{x}
\end{array}
\end{array}
Derivation
  1. Initial program 37.6%

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

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

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

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

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

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

      \[\leadsto -1 \cdot \frac{1}{-\sqrt{x}} - \color{blue}{-1 \cdot \frac{1}{-\sqrt{x + 1}}} \]
    7. distribute-neg-frac237.6%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-1, \frac{1}{-\sqrt{x}}, -\left(-\frac{1}{\sqrt{x + 1}}\right) \cdot -1\right) + \mathsf{fma}\left(-\left(-\frac{1}{\sqrt{x + 1}}\right), -1, \left(-\frac{1}{\sqrt{x + 1}}\right) \cdot -1\right)} \]
    9. distribute-neg-frac37.6%

      \[\leadsto \mathsf{fma}\left(-1, \frac{1}{-\sqrt{x}}, -\color{blue}{\frac{-1}{\sqrt{x + 1}}} \cdot -1\right) + \mathsf{fma}\left(-\left(-\frac{1}{\sqrt{x + 1}}\right), -1, \left(-\frac{1}{\sqrt{x + 1}}\right) \cdot -1\right) \]
    10. metadata-eval37.6%

      \[\leadsto \mathsf{fma}\left(-1, \frac{1}{-\sqrt{x}}, -\frac{\color{blue}{-1}}{\sqrt{x + 1}} \cdot -1\right) + \mathsf{fma}\left(-\left(-\frac{1}{\sqrt{x + 1}}\right), -1, \left(-\frac{1}{\sqrt{x + 1}}\right) \cdot -1\right) \]
    11. +-commutative37.6%

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

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

    \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} - {\left(1 + x\right)}^{-0.5}} \]
  6. Step-by-step derivation
    1. inv-pow31.6%

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

      \[\leadsto \color{blue}{{x}^{\left(\frac{-1}{2}\right)}} - {\left(1 + x\right)}^{-0.5} \]
    3. metadata-eval37.7%

      \[\leadsto {x}^{\color{blue}{-0.5}} - {\left(1 + x\right)}^{-0.5} \]
    4. metadata-eval37.7%

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

      \[\leadsto \color{blue}{{\left({x}^{0.25}\right)}^{-2}} - {\left(1 + x\right)}^{-0.5} \]
    6. sqr-pow19.1%

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

      \[\leadsto {\left({x}^{0.25}\right)}^{\left(\frac{-2}{2}\right)} \cdot {\left({x}^{0.25}\right)}^{\left(\frac{-2}{2}\right)} - \color{blue}{{\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)} \cdot {\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)}} \]
    8. difference-of-squares27.0%

      \[\leadsto \color{blue}{\left({\left({x}^{0.25}\right)}^{\left(\frac{-2}{2}\right)} + {\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)}\right) \cdot \left({\left({x}^{0.25}\right)}^{\left(\frac{-2}{2}\right)} - {\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)}\right)} \]
    9. metadata-eval27.0%

      \[\leadsto \left({\left({x}^{0.25}\right)}^{\color{blue}{-1}} + {\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)}\right) \cdot \left({\left({x}^{0.25}\right)}^{\left(\frac{-2}{2}\right)} - {\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)}\right) \]
    10. pow-pow27.0%

      \[\leadsto \left(\color{blue}{{x}^{\left(0.25 \cdot -1\right)}} + {\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)}\right) \cdot \left({\left({x}^{0.25}\right)}^{\left(\frac{-2}{2}\right)} - {\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)}\right) \]
    11. metadata-eval27.0%

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

      \[\leadsto \left({x}^{-0.25} + {\left(1 + x\right)}^{\color{blue}{-0.25}}\right) \cdot \left({\left({x}^{0.25}\right)}^{\left(\frac{-2}{2}\right)} - {\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)}\right) \]
    13. metadata-eval27.0%

      \[\leadsto \left({x}^{-0.25} + {\left(1 + x\right)}^{-0.25}\right) \cdot \left({\left({x}^{0.25}\right)}^{\color{blue}{-1}} - {\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)}\right) \]
    14. pow-pow37.6%

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

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

      \[\leadsto \left({x}^{-0.25} + {\left(1 + x\right)}^{-0.25}\right) \cdot \left({x}^{-0.25} - {\left(1 + x\right)}^{\color{blue}{-0.25}}\right) \]
  7. Applied egg-rr37.6%

    \[\leadsto \color{blue}{\left({x}^{-0.25} + {\left(1 + x\right)}^{-0.25}\right) \cdot \left({x}^{-0.25} - {\left(1 + x\right)}^{-0.25}\right)} \]
  8. Taylor expanded in x around inf 99.1%

    \[\leadsto \color{blue}{\frac{-0.3125 \cdot \sqrt{\frac{1}{{x}^{3}}} + \left(-0.1904296875 \cdot \sqrt{\frac{1}{{x}^{7}}} + \left(-0.0625 \cdot \sqrt{\frac{1}{{x}^{3}}} + \left(-0.05859375 \cdot \sqrt{\frac{1}{{x}^{7}}} + \left(-0.0244140625 \cdot \sqrt{\frac{1}{{x}^{7}}} + \left(0.078125 \cdot \sqrt{\frac{1}{{x}^{5}}} + \left(0.234375 \cdot \sqrt{\frac{1}{{x}^{5}}} + 0.5 \cdot \sqrt{\frac{1}{x}}\right)\right)\right)\right)\right)\right)}{x}} \]
  9. Simplified99.1%

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\sqrt{\frac{1}{{x}^{3}}}, -0.3125, \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{7}}}, -0.1904296875, \sqrt{\frac{1}{{x}^{7}}} \cdot -0.0830078125 + \left(\sqrt{\frac{1}{{x}^{5}}} \cdot 0.3125 + \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{3}}}, -0.0625, 0.5 \cdot {x}^{-0.5}\right)\right)\right)\right)}{x}} \]
  10. Step-by-step derivation
    1. *-un-lft-identity99.1%

      \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{1 \cdot \sqrt{\frac{1}{{x}^{3}}}}, -0.3125, \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{7}}}, -0.1904296875, \sqrt{\frac{1}{{x}^{7}}} \cdot -0.0830078125 + \left(\sqrt{\frac{1}{{x}^{5}}} \cdot 0.3125 + \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{3}}}, -0.0625, 0.5 \cdot {x}^{-0.5}\right)\right)\right)\right)}{x} \]
    2. pow-flip99.1%

      \[\leadsto \frac{\mathsf{fma}\left(1 \cdot \sqrt{\color{blue}{{x}^{\left(-3\right)}}}, -0.3125, \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{7}}}, -0.1904296875, \sqrt{\frac{1}{{x}^{7}}} \cdot -0.0830078125 + \left(\sqrt{\frac{1}{{x}^{5}}} \cdot 0.3125 + \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{3}}}, -0.0625, 0.5 \cdot {x}^{-0.5}\right)\right)\right)\right)}{x} \]
    3. sqrt-pow199.1%

      \[\leadsto \frac{\mathsf{fma}\left(1 \cdot \color{blue}{{x}^{\left(\frac{-3}{2}\right)}}, -0.3125, \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{7}}}, -0.1904296875, \sqrt{\frac{1}{{x}^{7}}} \cdot -0.0830078125 + \left(\sqrt{\frac{1}{{x}^{5}}} \cdot 0.3125 + \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{3}}}, -0.0625, 0.5 \cdot {x}^{-0.5}\right)\right)\right)\right)}{x} \]
    4. metadata-eval99.1%

      \[\leadsto \frac{\mathsf{fma}\left(1 \cdot {x}^{\left(\frac{\color{blue}{-3}}{2}\right)}, -0.3125, \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{7}}}, -0.1904296875, \sqrt{\frac{1}{{x}^{7}}} \cdot -0.0830078125 + \left(\sqrt{\frac{1}{{x}^{5}}} \cdot 0.3125 + \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{3}}}, -0.0625, 0.5 \cdot {x}^{-0.5}\right)\right)\right)\right)}{x} \]
    5. metadata-eval99.1%

      \[\leadsto \frac{\mathsf{fma}\left(1 \cdot {x}^{\color{blue}{-1.5}}, -0.3125, \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{7}}}, -0.1904296875, \sqrt{\frac{1}{{x}^{7}}} \cdot -0.0830078125 + \left(\sqrt{\frac{1}{{x}^{5}}} \cdot 0.3125 + \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{3}}}, -0.0625, 0.5 \cdot {x}^{-0.5}\right)\right)\right)\right)}{x} \]
  11. Applied egg-rr99.1%

    \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{1 \cdot {x}^{-1.5}}, -0.3125, \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{7}}}, -0.1904296875, \sqrt{\frac{1}{{x}^{7}}} \cdot -0.0830078125 + \left(\sqrt{\frac{1}{{x}^{5}}} \cdot 0.3125 + \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{3}}}, -0.0625, 0.5 \cdot {x}^{-0.5}\right)\right)\right)\right)}{x} \]
  12. Step-by-step derivation
    1. *-lft-identity99.1%

      \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{{x}^{-1.5}}, -0.3125, \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{7}}}, -0.1904296875, \sqrt{\frac{1}{{x}^{7}}} \cdot -0.0830078125 + \left(\sqrt{\frac{1}{{x}^{5}}} \cdot 0.3125 + \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{3}}}, -0.0625, 0.5 \cdot {x}^{-0.5}\right)\right)\right)\right)}{x} \]
  13. Simplified99.1%

    \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{{x}^{-1.5}}, -0.3125, \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{7}}}, -0.1904296875, \sqrt{\frac{1}{{x}^{7}}} \cdot -0.0830078125 + \left(\sqrt{\frac{1}{{x}^{5}}} \cdot 0.3125 + \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{3}}}, -0.0625, 0.5 \cdot {x}^{-0.5}\right)\right)\right)\right)}{x} \]
  14. Final simplification99.1%

    \[\leadsto \frac{\mathsf{fma}\left({x}^{-1.5}, -0.3125, \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{7}}}, -0.1904296875, \sqrt{\frac{1}{{x}^{7}}} \cdot -0.0830078125 + \left(\sqrt{\frac{1}{{x}^{5}}} \cdot 0.3125 + \mathsf{fma}\left(\sqrt{\frac{1}{{x}^{3}}}, -0.0625, 0.5 \cdot {x}^{-0.5}\right)\right)\right)\right)}{x} \]
  15. Add Preprocessing

Alternative 2: 99.1% accurate, 0.4× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto -1 \cdot \frac{1}{-\sqrt{x}} - \color{blue}{-1 \cdot \frac{1}{-\sqrt{x + 1}}} \]
    7. distribute-neg-frac237.6%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-1, \frac{1}{-\sqrt{x}}, -\left(-\frac{1}{\sqrt{x + 1}}\right) \cdot -1\right) + \mathsf{fma}\left(-\left(-\frac{1}{\sqrt{x + 1}}\right), -1, \left(-\frac{1}{\sqrt{x + 1}}\right) \cdot -1\right)} \]
    9. distribute-neg-frac37.6%

      \[\leadsto \mathsf{fma}\left(-1, \frac{1}{-\sqrt{x}}, -\color{blue}{\frac{-1}{\sqrt{x + 1}}} \cdot -1\right) + \mathsf{fma}\left(-\left(-\frac{1}{\sqrt{x + 1}}\right), -1, \left(-\frac{1}{\sqrt{x + 1}}\right) \cdot -1\right) \]
    10. metadata-eval37.6%

      \[\leadsto \mathsf{fma}\left(-1, \frac{1}{-\sqrt{x}}, -\frac{\color{blue}{-1}}{\sqrt{x + 1}} \cdot -1\right) + \mathsf{fma}\left(-\left(-\frac{1}{\sqrt{x + 1}}\right), -1, \left(-\frac{1}{\sqrt{x + 1}}\right) \cdot -1\right) \]
    11. +-commutative37.6%

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

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

    \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} - {\left(1 + x\right)}^{-0.5}} \]
  6. Step-by-step derivation
    1. inv-pow31.6%

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

      \[\leadsto \color{blue}{{x}^{\left(\frac{-1}{2}\right)}} - {\left(1 + x\right)}^{-0.5} \]
    3. metadata-eval37.7%

      \[\leadsto {x}^{\color{blue}{-0.5}} - {\left(1 + x\right)}^{-0.5} \]
    4. metadata-eval37.7%

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

      \[\leadsto \color{blue}{{\left({x}^{0.25}\right)}^{-2}} - {\left(1 + x\right)}^{-0.5} \]
    6. sqr-pow19.1%

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

      \[\leadsto {\left({x}^{0.25}\right)}^{\left(\frac{-2}{2}\right)} \cdot {\left({x}^{0.25}\right)}^{\left(\frac{-2}{2}\right)} - \color{blue}{{\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)} \cdot {\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)}} \]
    8. difference-of-squares27.0%

      \[\leadsto \color{blue}{\left({\left({x}^{0.25}\right)}^{\left(\frac{-2}{2}\right)} + {\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)}\right) \cdot \left({\left({x}^{0.25}\right)}^{\left(\frac{-2}{2}\right)} - {\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)}\right)} \]
    9. metadata-eval27.0%

      \[\leadsto \left({\left({x}^{0.25}\right)}^{\color{blue}{-1}} + {\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)}\right) \cdot \left({\left({x}^{0.25}\right)}^{\left(\frac{-2}{2}\right)} - {\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)}\right) \]
    10. pow-pow27.0%

      \[\leadsto \left(\color{blue}{{x}^{\left(0.25 \cdot -1\right)}} + {\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)}\right) \cdot \left({\left({x}^{0.25}\right)}^{\left(\frac{-2}{2}\right)} - {\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)}\right) \]
    11. metadata-eval27.0%

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

      \[\leadsto \left({x}^{-0.25} + {\left(1 + x\right)}^{\color{blue}{-0.25}}\right) \cdot \left({\left({x}^{0.25}\right)}^{\left(\frac{-2}{2}\right)} - {\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)}\right) \]
    13. metadata-eval27.0%

      \[\leadsto \left({x}^{-0.25} + {\left(1 + x\right)}^{-0.25}\right) \cdot \left({\left({x}^{0.25}\right)}^{\color{blue}{-1}} - {\left(1 + x\right)}^{\left(\frac{-0.5}{2}\right)}\right) \]
    14. pow-pow37.6%

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

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

      \[\leadsto \left({x}^{-0.25} + {\left(1 + x\right)}^{-0.25}\right) \cdot \left({x}^{-0.25} - {\left(1 + x\right)}^{\color{blue}{-0.25}}\right) \]
  7. Applied egg-rr37.6%

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

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

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

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

    Alternative 3: 98.8% accurate, 1.0× speedup?

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

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

      \[\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-identity80.2%

        \[\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/280.2%

        \[\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-flip80.2%

        \[\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-pow80.2%

        \[\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-eval80.2%

        \[\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-eval80.2%

        \[\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-rr80.2%

      \[\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-identity80.2%

        \[\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. Simplified80.2%

      \[\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.5%

      \[\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. Simplified98.5%

        \[\leadsto \color{blue}{\frac{0.5 \cdot {x}^{-0.5} - {x}^{-0.5} \cdot \frac{0.375}{x}}{x}} \]
      2. Final simplification98.5%

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

      Alternative 4: 97.6% accurate, 1.0× speedup?

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{\sqrt{\frac{1}{x}} - \sqrt{x}}{x} \cdot \frac{-0.5}{x}} \]
        4. inv-pow96.8%

          \[\leadsto \frac{\sqrt{\color{blue}{{x}^{-1}}} - \sqrt{x}}{x} \cdot \frac{-0.5}{x} \]
        5. sqrt-pow196.8%

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

          \[\leadsto \frac{{x}^{\color{blue}{-0.5}} - \sqrt{x}}{x} \cdot \frac{-0.5}{x} \]
      7. Applied egg-rr96.8%

        \[\leadsto \color{blue}{\frac{{x}^{-0.5} - \sqrt{x}}{x} \cdot \frac{-0.5}{x}} \]
      8. Final simplification96.8%

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

      Alternative 5: 80.9% accurate, 1.0× speedup?

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

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

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

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

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

        \[\leadsto \frac{-0.5 \cdot \color{blue}{\left(-1 \cdot \sqrt{x}\right)}}{{x}^{2}} \]
      7. Step-by-step derivation
        1. neg-mul-178.4%

          \[\leadsto \frac{-0.5 \cdot \color{blue}{\left(-\sqrt{x}\right)}}{{x}^{2}} \]
      8. Simplified78.4%

        \[\leadsto \frac{-0.5 \cdot \color{blue}{\left(-\sqrt{x}\right)}}{{x}^{2}} \]
      9. Final simplification78.4%

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

      Alternative 6: 55.3% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \sqrt[3]{0.125 \cdot {x}^{-4.5}} \end{array} \]
      (FPCore (x) :precision binary64 (cbrt (* 0.125 (pow x -4.5))))
      double code(double x) {
      	return cbrt((0.125 * pow(x, -4.5)));
      }
      
      public static double code(double x) {
      	return Math.cbrt((0.125 * Math.pow(x, -4.5)));
      }
      
      function code(x)
      	return cbrt(Float64(0.125 * (x ^ -4.5)))
      end
      
      code[x_] := N[Power[N[(0.125 * N[Power[x, -4.5], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \sqrt[3]{0.125 \cdot {x}^{-4.5}}
      \end{array}
      
      Derivation
      1. Initial program 37.6%

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

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

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

          \[\leadsto \sqrt[3]{{\left(\color{blue}{{\left(\sqrt{x}\right)}^{-1}} - \frac{1}{\sqrt{x + 1}}\right)}^{3}} \]
        4. sqrt-pow237.6%

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

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

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

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

          \[\leadsto \sqrt[3]{{\left({x}^{-0.5} - {\color{blue}{\left(1 + x\right)}}^{\left(-0.5\right)}\right)}^{3}} \]
        9. metadata-eval37.7%

          \[\leadsto \sqrt[3]{{\left({x}^{-0.5} - {\left(1 + x\right)}^{\color{blue}{-0.5}}\right)}^{3}} \]
      4. Applied egg-rr37.7%

        \[\leadsto \color{blue}{\sqrt[3]{{\left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right)}^{3}}} \]
      5. Taylor expanded in x around inf 42.2%

        \[\leadsto \sqrt[3]{\color{blue}{0.125 \cdot \sqrt{\frac{1}{{x}^{9}}}}} \]
      6. Step-by-step derivation
        1. *-un-lft-identity42.2%

          \[\leadsto \color{blue}{1 \cdot \sqrt[3]{0.125 \cdot \sqrt{\frac{1}{{x}^{9}}}}} \]
        2. pow1/242.2%

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

          \[\leadsto 1 \cdot \sqrt[3]{0.125 \cdot {\color{blue}{\left({x}^{\left(-9\right)}\right)}}^{0.5}} \]
        4. pow-pow52.8%

          \[\leadsto 1 \cdot \sqrt[3]{0.125 \cdot \color{blue}{{x}^{\left(\left(-9\right) \cdot 0.5\right)}}} \]
        5. metadata-eval52.8%

          \[\leadsto 1 \cdot \sqrt[3]{0.125 \cdot {x}^{\left(\color{blue}{-9} \cdot 0.5\right)}} \]
        6. metadata-eval52.8%

          \[\leadsto 1 \cdot \sqrt[3]{0.125 \cdot {x}^{\color{blue}{-4.5}}} \]
      7. Applied egg-rr52.8%

        \[\leadsto \color{blue}{1 \cdot \sqrt[3]{0.125 \cdot {x}^{-4.5}}} \]
      8. Step-by-step derivation
        1. *-lft-identity52.8%

          \[\leadsto \color{blue}{\sqrt[3]{0.125 \cdot {x}^{-4.5}}} \]
      9. Simplified52.8%

        \[\leadsto \color{blue}{\sqrt[3]{0.125 \cdot {x}^{-4.5}}} \]
      10. Final simplification52.8%

        \[\leadsto \sqrt[3]{0.125 \cdot {x}^{-4.5}} \]
      11. Add Preprocessing

      Alternative 7: 66.5% accurate, 1.0× speedup?

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

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

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

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

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

        \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}} \]
      7. Step-by-step derivation
        1. exp-to-pow59.8%

          \[\leadsto 0.5 \cdot \sqrt{\frac{1}{\color{blue}{e^{\log x \cdot 3}}}} \]
        2. *-commutative59.8%

          \[\leadsto 0.5 \cdot \sqrt{\frac{1}{e^{\color{blue}{3 \cdot \log x}}}} \]
        3. rec-exp61.9%

          \[\leadsto 0.5 \cdot \sqrt{\color{blue}{e^{-3 \cdot \log x}}} \]
        4. distribute-lft-neg-in61.9%

          \[\leadsto 0.5 \cdot \sqrt{e^{\color{blue}{\left(-3\right) \cdot \log x}}} \]
        5. metadata-eval61.9%

          \[\leadsto 0.5 \cdot \sqrt{e^{\color{blue}{-3} \cdot \log x}} \]
        6. *-commutative61.9%

          \[\leadsto 0.5 \cdot \sqrt{e^{\color{blue}{\log x \cdot -3}}} \]
        7. exp-to-pow64.1%

          \[\leadsto 0.5 \cdot \sqrt{\color{blue}{{x}^{-3}}} \]
      8. Simplified64.1%

        \[\leadsto \color{blue}{0.5 \cdot \sqrt{{x}^{-3}}} \]
      9. Final simplification64.1%

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

      Alternative 8: 37.0% accurate, 1.0× speedup?

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

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

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

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

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

          \[\leadsto {x}^{\color{blue}{-0.5}} \]
        4. sqr-pow5.7%

          \[\leadsto \color{blue}{{x}^{\left(\frac{-0.5}{2}\right)} \cdot {x}^{\left(\frac{-0.5}{2}\right)}} \]
        5. pow-prod-down34.8%

          \[\leadsto \color{blue}{{\left(x \cdot x\right)}^{\left(\frac{-0.5}{2}\right)}} \]
        6. pow234.8%

          \[\leadsto {\color{blue}{\left({x}^{2}\right)}}^{\left(\frac{-0.5}{2}\right)} \]
        7. metadata-eval34.8%

          \[\leadsto {\left({x}^{2}\right)}^{\color{blue}{-0.25}} \]
      5. Applied egg-rr34.8%

        \[\leadsto \color{blue}{{\left({x}^{2}\right)}^{-0.25}} \]
      6. Final simplification34.8%

        \[\leadsto {\left({x}^{2}\right)}^{-0.25} \]
      7. Add Preprocessing

      Alternative 9: 34.4% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \sqrt[3]{{x}^{-1.5}} \end{array} \]
      (FPCore (x) :precision binary64 (cbrt (pow x -1.5)))
      double code(double x) {
      	return cbrt(pow(x, -1.5));
      }
      
      public static double code(double x) {
      	return Math.cbrt(Math.pow(x, -1.5));
      }
      
      function code(x)
      	return cbrt((x ^ -1.5))
      end
      
      code[x_] := N[Power[N[Power[x, -1.5], $MachinePrecision], 1/3], $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \sqrt[3]{{x}^{-1.5}}
      \end{array}
      
      Derivation
      1. Initial program 37.6%

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

        \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \]
      4. Step-by-step derivation
        1. add-cbrt-cube32.2%

          \[\leadsto \color{blue}{\sqrt[3]{\left(\sqrt{\frac{1}{x}} \cdot \sqrt{\frac{1}{x}}\right) \cdot \sqrt{\frac{1}{x}}}} \]
        2. pow1/332.2%

          \[\leadsto \color{blue}{{\left(\left(\sqrt{\frac{1}{x}} \cdot \sqrt{\frac{1}{x}}\right) \cdot \sqrt{\frac{1}{x}}\right)}^{0.3333333333333333}} \]
        3. add-sqr-sqrt32.2%

          \[\leadsto {\left(\color{blue}{\frac{1}{x}} \cdot \sqrt{\frac{1}{x}}\right)}^{0.3333333333333333} \]
        4. pow132.2%

          \[\leadsto {\left(\color{blue}{{\left(\frac{1}{x}\right)}^{1}} \cdot \sqrt{\frac{1}{x}}\right)}^{0.3333333333333333} \]
        5. pow1/232.2%

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

          \[\leadsto {\color{blue}{\left({\left(\frac{1}{x}\right)}^{\left(1 + 0.5\right)}\right)}}^{0.3333333333333333} \]
        7. metadata-eval32.2%

          \[\leadsto {\left({\left(\frac{1}{x}\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333} \]
        8. metadata-eval32.2%

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

          \[\leadsto {\color{blue}{\left({\left({\left(\frac{1}{x}\right)}^{0.5}\right)}^{3}\right)}}^{0.3333333333333333} \]
        10. inv-pow32.2%

          \[\leadsto {\left({\left({\color{blue}{\left({x}^{-1}\right)}}^{0.5}\right)}^{3}\right)}^{0.3333333333333333} \]
        11. pow-pow32.2%

          \[\leadsto {\left({\color{blue}{\left({x}^{\left(-1 \cdot 0.5\right)}\right)}}^{3}\right)}^{0.3333333333333333} \]
        12. metadata-eval32.2%

          \[\leadsto {\left({\left({x}^{\color{blue}{-0.5}}\right)}^{3}\right)}^{0.3333333333333333} \]
        13. pow-pow32.2%

          \[\leadsto {\color{blue}{\left({x}^{\left(-0.5 \cdot 3\right)}\right)}}^{0.3333333333333333} \]
        14. metadata-eval32.2%

          \[\leadsto {\left({x}^{\color{blue}{-1.5}}\right)}^{0.3333333333333333} \]
      5. Applied egg-rr32.2%

        \[\leadsto \color{blue}{{\left({x}^{-1.5}\right)}^{0.3333333333333333}} \]
      6. Step-by-step derivation
        1. unpow1/332.2%

          \[\leadsto \color{blue}{\sqrt[3]{{x}^{-1.5}}} \]
      7. Simplified32.2%

        \[\leadsto \color{blue}{\sqrt[3]{{x}^{-1.5}}} \]
      8. Final simplification32.2%

        \[\leadsto \sqrt[3]{{x}^{-1.5}} \]
      9. Add Preprocessing

      Alternative 10: 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 37.6%

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

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

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

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

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

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

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

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

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

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

      Developer target: 98.3% accurate, 1.0× speedup?

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

      Reproduce

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