2isqrt (example 3.6)

Percentage Accurate: 38.1% → 99.6%
Time: 15.6s
Alternatives: 7
Speedup: 2.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 7 alternatives:

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

Initial Program: 38.1% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \frac{\frac{1}{x}}{\mathsf{fma}\left({x}^{-0.5}, 1 + x, {\left(1 + x\right)}^{0.5}\right)} \end{array} \]
(FPCore (x)
 :precision binary64
 (/ (/ 1.0 x) (fma (pow x -0.5) (+ 1.0 x) (pow (+ 1.0 x) 0.5))))
double code(double x) {
	return (1.0 / x) / fma(pow(x, -0.5), (1.0 + x), pow((1.0 + x), 0.5));
}
function code(x)
	return Float64(Float64(1.0 / x) / fma((x ^ -0.5), Float64(1.0 + x), (Float64(1.0 + x) ^ 0.5)))
end
code[x_] := N[(N[(1.0 / x), $MachinePrecision] / N[(N[Power[x, -0.5], $MachinePrecision] * N[(1.0 + x), $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}} \]
    2. frac-times22.7%

      \[\leadsto \frac{\color{blue}{\frac{1 \cdot 1}{\sqrt{x} \cdot \sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    3. metadata-eval22.7%

      \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{x} \cdot \sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    4. add-sqr-sqrt19.9%

      \[\leadsto \frac{\frac{1}{\color{blue}{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    5. frac-times26.4%

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

      \[\leadsto \frac{\frac{1}{x} - \frac{\color{blue}{1}}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    7. add-sqr-sqrt39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{\color{blue}{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    8. +-commutative39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    9. inv-pow39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{\color{blue}{{\left(\sqrt{x}\right)}^{-1}} + \frac{1}{\sqrt{x + 1}}} \]
    10. sqrt-pow239.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{\color{blue}{{x}^{\left(\frac{-1}{2}\right)}} + \frac{1}{\sqrt{x + 1}}} \]
    11. metadata-eval39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{\color{blue}{-0.5}} + \frac{1}{\sqrt{x + 1}}} \]
    12. pow1/239.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{-0.5} + \frac{1}{\color{blue}{{\left(x + 1\right)}^{0.5}}}} \]
    13. pow-flip39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{-0.5} + \color{blue}{{\left(x + 1\right)}^{\left(-0.5\right)}}} \]
    14. +-commutative39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{-0.5} + {\color{blue}{\left(1 + x\right)}}^{\left(-0.5\right)}} \]
    15. metadata-eval39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{-0.5} + {\left(1 + x\right)}^{\color{blue}{-0.5}}} \]
  4. Applied egg-rr39.1%

    \[\leadsto \color{blue}{\frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
  5. Step-by-step derivation
    1. frac-sub41.8%

      \[\leadsto \frac{\color{blue}{\frac{1 \cdot \left(1 + x\right) - x \cdot 1}{x \cdot \left(1 + x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    2. div-inv41.8%

      \[\leadsto \frac{\color{blue}{\left(1 \cdot \left(1 + x\right) - x \cdot 1\right) \cdot \frac{1}{x \cdot \left(1 + x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    3. *-un-lft-identity41.8%

      \[\leadsto \frac{\left(\color{blue}{\left(1 + x\right)} - x \cdot 1\right) \cdot \frac{1}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
  6. Applied egg-rr41.8%

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

      \[\leadsto \frac{\color{blue}{\frac{\left(\left(1 + x\right) - x \cdot 1\right) \cdot 1}{x \cdot \left(1 + x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    2. *-rgt-identity41.8%

      \[\leadsto \frac{\frac{\color{blue}{\left(1 + x\right) - x \cdot 1}}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    3. *-rgt-identity41.8%

      \[\leadsto \frac{\frac{\left(1 + x\right) - \color{blue}{x}}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    4. associate--l+81.1%

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

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

      \[\leadsto \frac{\frac{\color{blue}{1}}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    7. associate-/r*83.0%

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

    \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x}}{1 + x}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
  9. Step-by-step derivation
    1. div-inv82.9%

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

      \[\leadsto \color{blue}{\frac{1}{x} \cdot \frac{\frac{1}{1 + x}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
  10. Applied egg-rr99.4%

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{x} \cdot 1}{\left(1 + x\right) \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)}} \]
    3. *-rgt-identity99.6%

      \[\leadsto \frac{\color{blue}{\frac{1}{x}}}{\left(1 + x\right) \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
    4. distribute-lft-in99.5%

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

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{{x}^{-0.5} \cdot \left(1 + x\right)} + \left(1 + x\right) \cdot {\left(1 + x\right)}^{-0.5}} \]
    6. fma-define99.6%

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{\mathsf{fma}\left({x}^{-0.5}, 1 + x, \left(1 + x\right) \cdot {\left(1 + x\right)}^{-0.5}\right)}} \]
    7. *-commutative99.6%

      \[\leadsto \frac{\frac{1}{x}}{\mathsf{fma}\left({x}^{-0.5}, 1 + x, \color{blue}{{\left(1 + x\right)}^{-0.5} \cdot \left(1 + x\right)}\right)} \]
    8. pow-plus99.7%

      \[\leadsto \frac{\frac{1}{x}}{\mathsf{fma}\left({x}^{-0.5}, 1 + x, \color{blue}{{\left(1 + x\right)}^{\left(-0.5 + 1\right)}}\right)} \]
    9. metadata-eval99.7%

      \[\leadsto \frac{\frac{1}{x}}{\mathsf{fma}\left({x}^{-0.5}, 1 + x, {\left(1 + x\right)}^{\color{blue}{0.5}}\right)} \]
  12. Simplified99.7%

    \[\leadsto \color{blue}{\frac{\frac{1}{x}}{\mathsf{fma}\left({x}^{-0.5}, 1 + x, {\left(1 + x\right)}^{0.5}\right)}} \]
  13. Final simplification99.7%

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

Alternative 2: 99.6% accurate, 1.0× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}} \]
    2. frac-times22.7%

      \[\leadsto \frac{\color{blue}{\frac{1 \cdot 1}{\sqrt{x} \cdot \sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    3. metadata-eval22.7%

      \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{x} \cdot \sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    4. add-sqr-sqrt19.9%

      \[\leadsto \frac{\frac{1}{\color{blue}{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    5. frac-times26.4%

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

      \[\leadsto \frac{\frac{1}{x} - \frac{\color{blue}{1}}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    7. add-sqr-sqrt39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{\color{blue}{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    8. +-commutative39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    9. inv-pow39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{\color{blue}{{\left(\sqrt{x}\right)}^{-1}} + \frac{1}{\sqrt{x + 1}}} \]
    10. sqrt-pow239.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{\color{blue}{{x}^{\left(\frac{-1}{2}\right)}} + \frac{1}{\sqrt{x + 1}}} \]
    11. metadata-eval39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{\color{blue}{-0.5}} + \frac{1}{\sqrt{x + 1}}} \]
    12. pow1/239.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{-0.5} + \frac{1}{\color{blue}{{\left(x + 1\right)}^{0.5}}}} \]
    13. pow-flip39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{-0.5} + \color{blue}{{\left(x + 1\right)}^{\left(-0.5\right)}}} \]
    14. +-commutative39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{-0.5} + {\color{blue}{\left(1 + x\right)}}^{\left(-0.5\right)}} \]
    15. metadata-eval39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{-0.5} + {\left(1 + x\right)}^{\color{blue}{-0.5}}} \]
  4. Applied egg-rr39.1%

    \[\leadsto \color{blue}{\frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
  5. Step-by-step derivation
    1. frac-sub41.8%

      \[\leadsto \frac{\color{blue}{\frac{1 \cdot \left(1 + x\right) - x \cdot 1}{x \cdot \left(1 + x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    2. div-inv41.8%

      \[\leadsto \frac{\color{blue}{\left(1 \cdot \left(1 + x\right) - x \cdot 1\right) \cdot \frac{1}{x \cdot \left(1 + x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    3. *-un-lft-identity41.8%

      \[\leadsto \frac{\left(\color{blue}{\left(1 + x\right)} - x \cdot 1\right) \cdot \frac{1}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
  6. Applied egg-rr41.8%

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

      \[\leadsto \frac{\color{blue}{\frac{\left(\left(1 + x\right) - x \cdot 1\right) \cdot 1}{x \cdot \left(1 + x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    2. *-rgt-identity41.8%

      \[\leadsto \frac{\frac{\color{blue}{\left(1 + x\right) - x \cdot 1}}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    3. *-rgt-identity41.8%

      \[\leadsto \frac{\frac{\left(1 + x\right) - \color{blue}{x}}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    4. associate--l+81.1%

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

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

      \[\leadsto \frac{\frac{\color{blue}{1}}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    7. associate-/r*83.0%

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

    \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x}}{1 + x}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
  9. Step-by-step derivation
    1. div-inv82.9%

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

      \[\leadsto \color{blue}{\frac{1}{x} \cdot \frac{\frac{1}{1 + x}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
  10. Applied egg-rr99.4%

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{x} \cdot 1}{\left(1 + x\right) \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)}} \]
    3. *-rgt-identity99.6%

      \[\leadsto \frac{\color{blue}{\frac{1}{x}}}{\left(1 + x\right) \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
    4. distribute-lft-in99.5%

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

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{{x}^{-0.5} \cdot \left(1 + x\right)} + \left(1 + x\right) \cdot {\left(1 + x\right)}^{-0.5}} \]
    6. fma-define99.6%

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{\mathsf{fma}\left({x}^{-0.5}, 1 + x, \left(1 + x\right) \cdot {\left(1 + x\right)}^{-0.5}\right)}} \]
    7. *-commutative99.6%

      \[\leadsto \frac{\frac{1}{x}}{\mathsf{fma}\left({x}^{-0.5}, 1 + x, \color{blue}{{\left(1 + x\right)}^{-0.5} \cdot \left(1 + x\right)}\right)} \]
    8. pow-plus99.7%

      \[\leadsto \frac{\frac{1}{x}}{\mathsf{fma}\left({x}^{-0.5}, 1 + x, \color{blue}{{\left(1 + x\right)}^{\left(-0.5 + 1\right)}}\right)} \]
    9. metadata-eval99.7%

      \[\leadsto \frac{\frac{1}{x}}{\mathsf{fma}\left({x}^{-0.5}, 1 + x, {\left(1 + x\right)}^{\color{blue}{0.5}}\right)} \]
  12. Simplified99.7%

    \[\leadsto \color{blue}{\frac{\frac{1}{x}}{\mathsf{fma}\left({x}^{-0.5}, 1 + x, {\left(1 + x\right)}^{0.5}\right)}} \]
  13. Step-by-step derivation
    1. fma-undefine99.6%

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{{x}^{-0.5} \cdot \left(1 + x\right) + {\left(1 + x\right)}^{0.5}}} \]
    2. unpow1/299.6%

      \[\leadsto \frac{\frac{1}{x}}{{x}^{-0.5} \cdot \left(1 + x\right) + \color{blue}{\sqrt{1 + x}}} \]
  14. Applied egg-rr99.6%

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

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

Alternative 3: 98.8% accurate, 1.0× speedup?

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

\\
\frac{\frac{1}{x}}{2 \cdot \sqrt{x} + \sqrt{\frac{1}{x}} \cdot 1.5}
\end{array}
Derivation
  1. Initial program 38.9%

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

      \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} + \left(-\frac{1}{\sqrt{x + 1}}\right)} \]
    2. inv-pow38.9%

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

      \[\leadsto \color{blue}{{x}^{\left(\frac{-1}{2}\right)}} + \left(-\frac{1}{\sqrt{x + 1}}\right) \]
    4. metadata-eval30.0%

      \[\leadsto {x}^{\color{blue}{-0.5}} + \left(-\frac{1}{\sqrt{x + 1}}\right) \]
    5. distribute-neg-frac30.0%

      \[\leadsto {x}^{-0.5} + \color{blue}{\frac{-1}{\sqrt{x + 1}}} \]
    6. metadata-eval30.0%

      \[\leadsto {x}^{-0.5} + \frac{\color{blue}{-1}}{\sqrt{x + 1}} \]
    7. +-commutative30.0%

      \[\leadsto {x}^{-0.5} + \frac{-1}{\sqrt{\color{blue}{1 + x}}} \]
  4. Applied egg-rr30.0%

    \[\leadsto \color{blue}{{x}^{-0.5} + \frac{-1}{\sqrt{1 + x}}} \]
  5. Step-by-step derivation
    1. *-rgt-identity30.0%

      \[\leadsto {x}^{-0.5} + \color{blue}{\frac{-1}{\sqrt{1 + x}} \cdot 1} \]
    2. metadata-eval30.0%

      \[\leadsto {x}^{-0.5} + \frac{-1}{\sqrt{1 + x}} \cdot \color{blue}{\left(--1\right)} \]
    3. distribute-rgt-neg-in30.0%

      \[\leadsto {x}^{-0.5} + \color{blue}{\left(-\frac{-1}{\sqrt{1 + x}} \cdot -1\right)} \]
    4. unsub-neg30.0%

      \[\leadsto \color{blue}{{x}^{-0.5} - \frac{-1}{\sqrt{1 + x}} \cdot -1} \]
    5. associate-*l/30.0%

      \[\leadsto {x}^{-0.5} - \color{blue}{\frac{-1 \cdot -1}{\sqrt{1 + x}}} \]
    6. metadata-eval30.0%

      \[\leadsto {x}^{-0.5} - \frac{\color{blue}{1}}{\sqrt{1 + x}} \]
    7. unpow1/230.0%

      \[\leadsto {x}^{-0.5} - \frac{1}{\color{blue}{{\left(1 + x\right)}^{0.5}}} \]
    8. exp-to-pow7.5%

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

      \[\leadsto {x}^{-0.5} - \frac{1}{e^{\color{blue}{\mathsf{log1p}\left(x\right)} \cdot 0.5}} \]
    10. *-commutative7.5%

      \[\leadsto {x}^{-0.5} - \frac{1}{e^{\color{blue}{0.5 \cdot \mathsf{log1p}\left(x\right)}}} \]
    11. exp-neg7.5%

      \[\leadsto {x}^{-0.5} - \color{blue}{e^{-0.5 \cdot \mathsf{log1p}\left(x\right)}} \]
    12. *-commutative7.5%

      \[\leadsto {x}^{-0.5} - e^{-\color{blue}{\mathsf{log1p}\left(x\right) \cdot 0.5}} \]
    13. distribute-rgt-neg-in7.5%

      \[\leadsto {x}^{-0.5} - e^{\color{blue}{\mathsf{log1p}\left(x\right) \cdot \left(-0.5\right)}} \]
    14. log1p-undefine7.5%

      \[\leadsto {x}^{-0.5} - e^{\color{blue}{\log \left(1 + x\right)} \cdot \left(-0.5\right)} \]
    15. metadata-eval7.5%

      \[\leadsto {x}^{-0.5} - e^{\log \left(1 + x\right) \cdot \color{blue}{-0.5}} \]
    16. exp-to-pow39.0%

      \[\leadsto {x}^{-0.5} - \color{blue}{{\left(1 + x\right)}^{-0.5}} \]
  6. Simplified39.0%

    \[\leadsto \color{blue}{{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}} \]
  7. Step-by-step derivation
    1. flip--39.0%

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

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

      \[\leadsto \frac{{x}^{\color{blue}{-1}} - {\left(1 + x\right)}^{-0.5} \cdot {\left(1 + x\right)}^{-0.5}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    4. inv-pow20.4%

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

      \[\leadsto \frac{\frac{1}{x} - \color{blue}{{\left(1 + x\right)}^{\left(-0.5 + -0.5\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    6. metadata-eval38.8%

      \[\leadsto \frac{\frac{1}{x} - {\left(1 + x\right)}^{\color{blue}{-1}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    7. inv-pow39.1%

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

      \[\leadsto \frac{\color{blue}{\frac{1 \cdot \left(1 + x\right) - x \cdot 1}{x \cdot \left(1 + x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    9. *-un-lft-identity41.8%

      \[\leadsto \frac{\frac{\color{blue}{\left(1 + x\right)} - x \cdot 1}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    10. *-rgt-identity41.8%

      \[\leadsto \frac{\frac{\color{blue}{\left(\left(1 + x\right) - x \cdot 1\right) \cdot 1}}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    11. associate-/r*41.8%

      \[\leadsto \color{blue}{\frac{\left(\left(1 + x\right) - x \cdot 1\right) \cdot 1}{\left(x \cdot \left(1 + x\right)\right) \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)}} \]
    12. *-rgt-identity41.8%

      \[\leadsto \frac{\color{blue}{\left(1 + x\right) - x \cdot 1}}{\left(x \cdot \left(1 + x\right)\right) \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
    13. *-rgt-identity41.8%

      \[\leadsto \frac{\left(1 + x\right) - \color{blue}{x}}{\left(x \cdot \left(1 + x\right)\right) \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
    14. associate--l+81.1%

      \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{\left(x \cdot \left(1 + x\right)\right) \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
    15. +-inverses81.1%

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

      \[\leadsto \frac{\color{blue}{1}}{\left(x \cdot \left(1 + x\right)\right) \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
  8. Applied egg-rr99.6%

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

    \[\leadsto \frac{\frac{1}{x}}{\color{blue}{-0.5 \cdot \sqrt{\frac{1}{x}} + \left(2 \cdot \sqrt{x} + 2 \cdot \sqrt{\frac{1}{x}}\right)}} \]
  10. Step-by-step derivation
    1. +-commutative98.9%

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{\left(2 \cdot \sqrt{x} + 2 \cdot \sqrt{\frac{1}{x}}\right) + -0.5 \cdot \sqrt{\frac{1}{x}}}} \]
    2. associate-+l+98.9%

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{2 \cdot \sqrt{x} + \left(2 \cdot \sqrt{\frac{1}{x}} + -0.5 \cdot \sqrt{\frac{1}{x}}\right)}} \]
    3. distribute-rgt-out98.9%

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

      \[\leadsto \frac{\frac{1}{x}}{2 \cdot \sqrt{x} + \sqrt{\frac{1}{x}} \cdot \color{blue}{1.5}} \]
  11. Simplified98.9%

    \[\leadsto \frac{\frac{1}{x}}{\color{blue}{2 \cdot \sqrt{x} + \sqrt{\frac{1}{x}} \cdot 1.5}} \]
  12. Final simplification98.9%

    \[\leadsto \frac{\frac{1}{x}}{2 \cdot \sqrt{x} + \sqrt{\frac{1}{x}} \cdot 1.5} \]
  13. Add Preprocessing

Alternative 4: 97.8% accurate, 1.9× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}} \]
    2. frac-times22.7%

      \[\leadsto \frac{\color{blue}{\frac{1 \cdot 1}{\sqrt{x} \cdot \sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    3. metadata-eval22.7%

      \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{x} \cdot \sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    4. add-sqr-sqrt19.9%

      \[\leadsto \frac{\frac{1}{\color{blue}{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    5. frac-times26.4%

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

      \[\leadsto \frac{\frac{1}{x} - \frac{\color{blue}{1}}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    7. add-sqr-sqrt39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{\color{blue}{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    8. +-commutative39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
    9. inv-pow39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{\color{blue}{{\left(\sqrt{x}\right)}^{-1}} + \frac{1}{\sqrt{x + 1}}} \]
    10. sqrt-pow239.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{\color{blue}{{x}^{\left(\frac{-1}{2}\right)}} + \frac{1}{\sqrt{x + 1}}} \]
    11. metadata-eval39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{\color{blue}{-0.5}} + \frac{1}{\sqrt{x + 1}}} \]
    12. pow1/239.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{-0.5} + \frac{1}{\color{blue}{{\left(x + 1\right)}^{0.5}}}} \]
    13. pow-flip39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{-0.5} + \color{blue}{{\left(x + 1\right)}^{\left(-0.5\right)}}} \]
    14. +-commutative39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{-0.5} + {\color{blue}{\left(1 + x\right)}}^{\left(-0.5\right)}} \]
    15. metadata-eval39.1%

      \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{-0.5} + {\left(1 + x\right)}^{\color{blue}{-0.5}}} \]
  4. Applied egg-rr39.1%

    \[\leadsto \color{blue}{\frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
  5. Step-by-step derivation
    1. frac-sub41.8%

      \[\leadsto \frac{\color{blue}{\frac{1 \cdot \left(1 + x\right) - x \cdot 1}{x \cdot \left(1 + x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    2. div-inv41.8%

      \[\leadsto \frac{\color{blue}{\left(1 \cdot \left(1 + x\right) - x \cdot 1\right) \cdot \frac{1}{x \cdot \left(1 + x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    3. *-un-lft-identity41.8%

      \[\leadsto \frac{\left(\color{blue}{\left(1 + x\right)} - x \cdot 1\right) \cdot \frac{1}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
  6. Applied egg-rr41.8%

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

      \[\leadsto \frac{\color{blue}{\frac{\left(\left(1 + x\right) - x \cdot 1\right) \cdot 1}{x \cdot \left(1 + x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    2. *-rgt-identity41.8%

      \[\leadsto \frac{\frac{\color{blue}{\left(1 + x\right) - x \cdot 1}}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    3. *-rgt-identity41.8%

      \[\leadsto \frac{\frac{\left(1 + x\right) - \color{blue}{x}}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    4. associate--l+81.1%

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

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

      \[\leadsto \frac{\frac{\color{blue}{1}}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    7. associate-/r*83.0%

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

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

    \[\leadsto \frac{\frac{\frac{1}{x}}{1 + x}}{\color{blue}{2 \cdot \sqrt{\frac{1}{x}}}} \]
  10. Step-by-step derivation
    1. div-inv80.9%

      \[\leadsto \frac{\color{blue}{\frac{1}{x} \cdot \frac{1}{1 + x}}}{2 \cdot \sqrt{\frac{1}{x}}} \]
    2. inv-pow80.9%

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

      \[\leadsto \frac{\frac{1}{x} \cdot {\left(1 + x\right)}^{\color{blue}{\left(-0.5 + -0.5\right)}}}{2 \cdot \sqrt{\frac{1}{x}}} \]
    4. pow-prod-up81.0%

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

      \[\leadsto \frac{\frac{1}{x} \cdot \left({\left(1 + x\right)}^{-0.5} \cdot {\left(1 + x\right)}^{-0.5}\right)}{\color{blue}{\sqrt{\frac{1}{x}} \cdot 2}} \]
    6. inv-pow81.0%

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

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

      \[\leadsto \frac{\frac{1}{x} \cdot \left({\left(1 + x\right)}^{-0.5} \cdot {\left(1 + x\right)}^{-0.5}\right)}{{x}^{\color{blue}{-0.5}} \cdot 2} \]
    9. times-frac97.6%

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

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

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

      \[\leadsto \frac{\frac{1}{x}}{{x}^{-0.5}} \cdot \frac{\color{blue}{\frac{1}{1 + x}}}{2} \]
  11. Applied egg-rr97.4%

    \[\leadsto \color{blue}{\frac{\frac{1}{x}}{{x}^{-0.5}} \cdot \frac{\frac{1}{1 + x}}{2}} \]
  12. Step-by-step derivation
    1. associate-/l/97.5%

      \[\leadsto \color{blue}{\frac{1}{{x}^{-0.5} \cdot x}} \cdot \frac{\frac{1}{1 + x}}{2} \]
    2. pow-plus97.6%

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

      \[\leadsto \frac{1}{{x}^{\color{blue}{0.5}}} \cdot \frac{\frac{1}{1 + x}}{2} \]
    4. associate-/l/97.6%

      \[\leadsto \frac{1}{{x}^{0.5}} \cdot \color{blue}{\frac{1}{2 \cdot \left(1 + x\right)}} \]
    5. distribute-lft-in97.6%

      \[\leadsto \frac{1}{{x}^{0.5}} \cdot \frac{1}{\color{blue}{2 \cdot 1 + 2 \cdot x}} \]
    6. metadata-eval97.6%

      \[\leadsto \frac{1}{{x}^{0.5}} \cdot \frac{1}{\color{blue}{2} + 2 \cdot x} \]
  13. Simplified97.6%

    \[\leadsto \color{blue}{\frac{1}{{x}^{0.5}} \cdot \frac{1}{2 + 2 \cdot x}} \]
  14. Final simplification97.6%

    \[\leadsto \frac{1}{{x}^{0.5}} \cdot \frac{1}{2 + x \cdot 2} \]
  15. Add Preprocessing

Alternative 5: 37.5% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 4.8 \cdot 10^{+153}:\\ \;\;\;\;\frac{1}{x + \sqrt{x}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 4.8e+153) (/ 1.0 (+ x (sqrt x))) 0.0))
double code(double x) {
	double tmp;
	if (x <= 4.8e+153) {
		tmp = 1.0 / (x + sqrt(x));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 4.8d+153) then
        tmp = 1.0d0 / (x + sqrt(x))
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 4.8e+153) {
		tmp = 1.0 / (x + Math.sqrt(x));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 4.8e+153:
		tmp = 1.0 / (x + math.sqrt(x))
	else:
		tmp = 0.0
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 4.8e+153)
		tmp = Float64(1.0 / Float64(x + sqrt(x)));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 4.8e+153)
		tmp = 1.0 / (x + sqrt(x));
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 4.8e+153], N[(1.0 / N[(x + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.8 \cdot 10^{+153}:\\
\;\;\;\;\frac{1}{x + \sqrt{x}}\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 4.79999999999999985e153

    1. Initial program 10.8%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}} \]
      2. frac-times11.0%

        \[\leadsto \frac{\color{blue}{\frac{1 \cdot 1}{\sqrt{x} \cdot \sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      3. metadata-eval11.0%

        \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{x} \cdot \sqrt{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      4. add-sqr-sqrt11.2%

        \[\leadsto \frac{\frac{1}{\color{blue}{x}} - \frac{1}{\sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      5. frac-times11.3%

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

        \[\leadsto \frac{\frac{1}{x} - \frac{\color{blue}{1}}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      7. add-sqr-sqrt11.3%

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{\color{blue}{x + 1}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      8. +-commutative11.3%

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{\color{blue}{1 + x}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}} \]
      9. inv-pow11.3%

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

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

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{\color{blue}{-0.5}} + \frac{1}{\sqrt{x + 1}}} \]
      12. pow1/211.3%

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

        \[\leadsto \frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{-0.5} + \color{blue}{{\left(x + 1\right)}^{\left(-0.5\right)}}} \]
      14. +-commutative11.3%

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{x} - \frac{1}{1 + x}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}} \]
    5. Step-by-step derivation
      1. frac-sub16.8%

        \[\leadsto \frac{\color{blue}{\frac{1 \cdot \left(1 + x\right) - x \cdot 1}{x \cdot \left(1 + x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
      2. div-inv16.8%

        \[\leadsto \frac{\color{blue}{\left(1 \cdot \left(1 + x\right) - x \cdot 1\right) \cdot \frac{1}{x \cdot \left(1 + x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
      3. *-un-lft-identity16.8%

        \[\leadsto \frac{\left(\color{blue}{\left(1 + x\right)} - x \cdot 1\right) \cdot \frac{1}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    6. Applied egg-rr16.8%

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

        \[\leadsto \frac{\color{blue}{\frac{\left(\left(1 + x\right) - x \cdot 1\right) \cdot 1}{x \cdot \left(1 + x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
      2. *-rgt-identity16.8%

        \[\leadsto \frac{\frac{\color{blue}{\left(1 + x\right) - x \cdot 1}}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
      3. *-rgt-identity16.8%

        \[\leadsto \frac{\frac{\left(1 + x\right) - \color{blue}{x}}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
      4. associate--l+99.2%

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

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

        \[\leadsto \frac{\frac{\color{blue}{1}}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
      7. associate-/r*99.3%

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

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

      \[\leadsto \color{blue}{\frac{1}{x \cdot \left(1 + {x}^{-0.5}\right)}} \]
    10. Step-by-step derivation
      1. distribute-rgt-in8.6%

        \[\leadsto \frac{1}{\color{blue}{1 \cdot x + {x}^{-0.5} \cdot x}} \]
      2. *-lft-identity8.6%

        \[\leadsto \frac{1}{\color{blue}{x} + {x}^{-0.5} \cdot x} \]
      3. pow-plus8.6%

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

        \[\leadsto \frac{1}{x + {x}^{\color{blue}{0.5}}} \]
      5. unpow1/28.6%

        \[\leadsto \frac{1}{x + \color{blue}{\sqrt{x}}} \]
    11. Simplified8.6%

      \[\leadsto \color{blue}{\frac{1}{x + \sqrt{x}}} \]

    if 4.79999999999999985e153 < x

    1. Initial program 64.5%

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

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification37.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 4.8 \cdot 10^{+153}:\\ \;\;\;\;\frac{1}{x + \sqrt{x}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 97.8% accurate, 2.0× speedup?

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

\\
\frac{\frac{1}{x}}{2 \cdot \sqrt{x}}
\end{array}
Derivation
  1. Initial program 38.9%

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

      \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} + \left(-\frac{1}{\sqrt{x + 1}}\right)} \]
    2. inv-pow38.9%

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

      \[\leadsto \color{blue}{{x}^{\left(\frac{-1}{2}\right)}} + \left(-\frac{1}{\sqrt{x + 1}}\right) \]
    4. metadata-eval30.0%

      \[\leadsto {x}^{\color{blue}{-0.5}} + \left(-\frac{1}{\sqrt{x + 1}}\right) \]
    5. distribute-neg-frac30.0%

      \[\leadsto {x}^{-0.5} + \color{blue}{\frac{-1}{\sqrt{x + 1}}} \]
    6. metadata-eval30.0%

      \[\leadsto {x}^{-0.5} + \frac{\color{blue}{-1}}{\sqrt{x + 1}} \]
    7. +-commutative30.0%

      \[\leadsto {x}^{-0.5} + \frac{-1}{\sqrt{\color{blue}{1 + x}}} \]
  4. Applied egg-rr30.0%

    \[\leadsto \color{blue}{{x}^{-0.5} + \frac{-1}{\sqrt{1 + x}}} \]
  5. Step-by-step derivation
    1. *-rgt-identity30.0%

      \[\leadsto {x}^{-0.5} + \color{blue}{\frac{-1}{\sqrt{1 + x}} \cdot 1} \]
    2. metadata-eval30.0%

      \[\leadsto {x}^{-0.5} + \frac{-1}{\sqrt{1 + x}} \cdot \color{blue}{\left(--1\right)} \]
    3. distribute-rgt-neg-in30.0%

      \[\leadsto {x}^{-0.5} + \color{blue}{\left(-\frac{-1}{\sqrt{1 + x}} \cdot -1\right)} \]
    4. unsub-neg30.0%

      \[\leadsto \color{blue}{{x}^{-0.5} - \frac{-1}{\sqrt{1 + x}} \cdot -1} \]
    5. associate-*l/30.0%

      \[\leadsto {x}^{-0.5} - \color{blue}{\frac{-1 \cdot -1}{\sqrt{1 + x}}} \]
    6. metadata-eval30.0%

      \[\leadsto {x}^{-0.5} - \frac{\color{blue}{1}}{\sqrt{1 + x}} \]
    7. unpow1/230.0%

      \[\leadsto {x}^{-0.5} - \frac{1}{\color{blue}{{\left(1 + x\right)}^{0.5}}} \]
    8. exp-to-pow7.5%

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

      \[\leadsto {x}^{-0.5} - \frac{1}{e^{\color{blue}{\mathsf{log1p}\left(x\right)} \cdot 0.5}} \]
    10. *-commutative7.5%

      \[\leadsto {x}^{-0.5} - \frac{1}{e^{\color{blue}{0.5 \cdot \mathsf{log1p}\left(x\right)}}} \]
    11. exp-neg7.5%

      \[\leadsto {x}^{-0.5} - \color{blue}{e^{-0.5 \cdot \mathsf{log1p}\left(x\right)}} \]
    12. *-commutative7.5%

      \[\leadsto {x}^{-0.5} - e^{-\color{blue}{\mathsf{log1p}\left(x\right) \cdot 0.5}} \]
    13. distribute-rgt-neg-in7.5%

      \[\leadsto {x}^{-0.5} - e^{\color{blue}{\mathsf{log1p}\left(x\right) \cdot \left(-0.5\right)}} \]
    14. log1p-undefine7.5%

      \[\leadsto {x}^{-0.5} - e^{\color{blue}{\log \left(1 + x\right)} \cdot \left(-0.5\right)} \]
    15. metadata-eval7.5%

      \[\leadsto {x}^{-0.5} - e^{\log \left(1 + x\right) \cdot \color{blue}{-0.5}} \]
    16. exp-to-pow39.0%

      \[\leadsto {x}^{-0.5} - \color{blue}{{\left(1 + x\right)}^{-0.5}} \]
  6. Simplified39.0%

    \[\leadsto \color{blue}{{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}} \]
  7. Step-by-step derivation
    1. flip--39.0%

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

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

      \[\leadsto \frac{{x}^{\color{blue}{-1}} - {\left(1 + x\right)}^{-0.5} \cdot {\left(1 + x\right)}^{-0.5}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    4. inv-pow20.4%

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

      \[\leadsto \frac{\frac{1}{x} - \color{blue}{{\left(1 + x\right)}^{\left(-0.5 + -0.5\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    6. metadata-eval38.8%

      \[\leadsto \frac{\frac{1}{x} - {\left(1 + x\right)}^{\color{blue}{-1}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    7. inv-pow39.1%

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

      \[\leadsto \frac{\color{blue}{\frac{1 \cdot \left(1 + x\right) - x \cdot 1}{x \cdot \left(1 + x\right)}}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    9. *-un-lft-identity41.8%

      \[\leadsto \frac{\frac{\color{blue}{\left(1 + x\right)} - x \cdot 1}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    10. *-rgt-identity41.8%

      \[\leadsto \frac{\frac{\color{blue}{\left(\left(1 + x\right) - x \cdot 1\right) \cdot 1}}{x \cdot \left(1 + x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}} \]
    11. associate-/r*41.8%

      \[\leadsto \color{blue}{\frac{\left(\left(1 + x\right) - x \cdot 1\right) \cdot 1}{\left(x \cdot \left(1 + x\right)\right) \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)}} \]
    12. *-rgt-identity41.8%

      \[\leadsto \frac{\color{blue}{\left(1 + x\right) - x \cdot 1}}{\left(x \cdot \left(1 + x\right)\right) \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
    13. *-rgt-identity41.8%

      \[\leadsto \frac{\left(1 + x\right) - \color{blue}{x}}{\left(x \cdot \left(1 + x\right)\right) \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
    14. associate--l+81.1%

      \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{\left(x \cdot \left(1 + x\right)\right) \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
    15. +-inverses81.1%

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

      \[\leadsto \frac{\color{blue}{1}}{\left(x \cdot \left(1 + x\right)\right) \cdot \left({x}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)} \]
  8. Applied egg-rr99.6%

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

    \[\leadsto \frac{\frac{1}{x}}{\color{blue}{2 \cdot \sqrt{x}}} \]
  10. Final simplification97.6%

    \[\leadsto \frac{\frac{1}{x}}{2 \cdot \sqrt{x}} \]
  11. Add Preprocessing

Alternative 7: 35.5% accurate, 209.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (x) :precision binary64 0.0)
double code(double x) {
	return 0.0;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = 0.0d0
end function
public static double code(double x) {
	return 0.0;
}
def code(x):
	return 0.0
function code(x)
	return 0.0
end
function tmp = code(x)
	tmp = 0.0;
end
code[x_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 38.9%

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

    \[\leadsto \color{blue}{0} \]
  4. Final simplification35.8%

    \[\leadsto 0 \]
  5. Add Preprocessing

Developer target: 98.4% accurate, 1.0× speedup?

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

\\
\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}}
\end{array}

Reproduce

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