2isqrt (example 3.6)

Percentage Accurate: 38.6% → 99.2%
Time: 10.5s
Alternatives: 6
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 6 alternatives:

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

Initial Program: 38.6% accurate, 1.0× speedup?

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

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

Alternative 1: 99.2% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{1 + x}\\
\frac{\frac{\frac{1}{\sqrt{x} + t\_0}}{\sqrt{x}}}{t\_0}
\end{array}
\end{array}
Derivation
  1. Initial program 37.3%

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

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. *-un-lft-identity37.3%

      \[\leadsto \frac{\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    3. *-rgt-identity37.3%

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

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

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \left(1 + x\right)}}} \]
  5. Step-by-step derivation
    1. flip--37.8%

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    2. add-sqr-sqrt38.0%

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

      \[\leadsto \frac{\frac{\left(1 + x\right) - \color{blue}{x}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    4. add-sqr-sqrt39.2%

      \[\leadsto \frac{\frac{\left(1 + x\right) - x}{\sqrt{1 + \color{blue}{\sqrt{x} \cdot \sqrt{x}}} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    5. hypot-1-def39.2%

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

    \[\leadsto \frac{\color{blue}{\frac{\left(1 + x\right) - x}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  7. Step-by-step derivation
    1. associate--l+81.8%

      \[\leadsto \frac{\frac{\color{blue}{1 + \left(x - x\right)}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    2. +-inverses81.8%

      \[\leadsto \frac{\frac{1 + \color{blue}{0}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    3. metadata-eval81.8%

      \[\leadsto \frac{\frac{\color{blue}{1}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    4. +-commutative81.8%

      \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{x} + \mathsf{hypot}\left(1, \sqrt{x}\right)}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    5. hypot-undefine81.8%

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

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{\color{blue}{1} + \sqrt{x} \cdot \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    7. rem-square-sqrt81.8%

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

    \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  9. Step-by-step derivation
    1. *-un-lft-identity81.8%

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

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

      \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} \cdot \frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{1 + x}}} \]
  10. Applied egg-rr99.1%

    \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} \cdot \frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{1 + x}}} \]
  11. Step-by-step derivation
    1. associate-*r/99.1%

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{1 + x}}} \]
    2. associate-*l/99.2%

      \[\leadsto \frac{\color{blue}{\frac{1 \cdot \frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{x}}}}{\sqrt{1 + x}} \]
    3. *-lft-identity99.2%

      \[\leadsto \frac{\frac{\color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  12. Simplified99.2%

    \[\leadsto \color{blue}{\frac{\frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{x}}}{\sqrt{1 + x}}} \]
  13. Add Preprocessing

Alternative 2: 99.0% accurate, 1.0× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. *-un-lft-identity37.3%

      \[\leadsto \frac{\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    3. *-rgt-identity37.3%

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

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

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \left(1 + x\right)}}} \]
  5. Step-by-step derivation
    1. flip--37.8%

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    2. add-sqr-sqrt38.0%

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

      \[\leadsto \frac{\frac{\left(1 + x\right) - \color{blue}{x}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    4. add-sqr-sqrt39.2%

      \[\leadsto \frac{\frac{\left(1 + x\right) - x}{\sqrt{1 + \color{blue}{\sqrt{x} \cdot \sqrt{x}}} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    5. hypot-1-def39.2%

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

    \[\leadsto \frac{\color{blue}{\frac{\left(1 + x\right) - x}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  7. Step-by-step derivation
    1. associate--l+81.8%

      \[\leadsto \frac{\frac{\color{blue}{1 + \left(x - x\right)}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    2. +-inverses81.8%

      \[\leadsto \frac{\frac{1 + \color{blue}{0}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    3. metadata-eval81.8%

      \[\leadsto \frac{\frac{\color{blue}{1}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    4. +-commutative81.8%

      \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{x} + \mathsf{hypot}\left(1, \sqrt{x}\right)}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    5. hypot-undefine81.8%

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

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{\color{blue}{1} + \sqrt{x} \cdot \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    7. rem-square-sqrt81.8%

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

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

    \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\color{blue}{-1 \cdot \left(x \cdot \left(-1 \cdot \frac{0.5 + 0.125 \cdot \frac{1}{x \cdot {\left(\sqrt{-1}\right)}^{2}}}{x} + {\left(\sqrt{-1}\right)}^{2}\right)\right)}} \]
  10. Step-by-step derivation
    1. associate-*r*0.0%

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\color{blue}{\left(-1 \cdot x\right) \cdot \left(-1 \cdot \frac{0.5 + 0.125 \cdot \frac{1}{x \cdot {\left(\sqrt{-1}\right)}^{2}}}{x} + {\left(\sqrt{-1}\right)}^{2}\right)}} \]
    2. neg-mul-10.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\left(-x\right) \cdot \left(-1 - \frac{0.5 + \frac{0.125}{\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot x}}{x}\right)} \]
    12. rem-square-sqrt98.7%

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\left(-x\right) \cdot \left(-1 - \frac{0.5 + \frac{0.125}{\color{blue}{-1} \cdot x}}{x}\right)} \]
    13. neg-mul-198.7%

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\left(-x\right) \cdot \left(-1 - \frac{0.5 + \frac{0.125}{\color{blue}{-x}}}{x}\right)} \]
  11. Simplified98.7%

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

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

Alternative 3: 98.7% accurate, 1.9× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. *-un-lft-identity37.3%

      \[\leadsto \frac{\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    3. *-rgt-identity37.3%

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

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

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \left(1 + x\right)}}} \]
  5. Step-by-step derivation
    1. flip--37.8%

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    2. add-sqr-sqrt38.0%

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

      \[\leadsto \frac{\frac{\left(1 + x\right) - \color{blue}{x}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    4. add-sqr-sqrt39.2%

      \[\leadsto \frac{\frac{\left(1 + x\right) - x}{\sqrt{1 + \color{blue}{\sqrt{x} \cdot \sqrt{x}}} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    5. hypot-1-def39.2%

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

    \[\leadsto \frac{\color{blue}{\frac{\left(1 + x\right) - x}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  7. Step-by-step derivation
    1. associate--l+81.8%

      \[\leadsto \frac{\frac{\color{blue}{1 + \left(x - x\right)}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    2. +-inverses81.8%

      \[\leadsto \frac{\frac{1 + \color{blue}{0}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    3. metadata-eval81.8%

      \[\leadsto \frac{\frac{\color{blue}{1}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    4. +-commutative81.8%

      \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{x} + \mathsf{hypot}\left(1, \sqrt{x}\right)}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    5. hypot-undefine81.8%

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

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{\color{blue}{1} + \sqrt{x} \cdot \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    7. rem-square-sqrt81.8%

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

    \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  9. Step-by-step derivation
    1. *-un-lft-identity81.8%

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

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

      \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} \cdot \frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{1 + x}}} \]
  10. Applied egg-rr99.1%

    \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} \cdot \frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{1 + x}}} \]
  11. Step-by-step derivation
    1. associate-*r/99.1%

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{1 + x}}} \]
    2. associate-*l/99.2%

      \[\leadsto \frac{\color{blue}{\frac{1 \cdot \frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{x}}}}{\sqrt{1 + x}} \]
    3. *-lft-identity99.2%

      \[\leadsto \frac{\frac{\color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  12. Simplified99.2%

    \[\leadsto \color{blue}{\frac{\frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{x}}}{\sqrt{1 + x}}} \]
  13. Taylor expanded in x around inf 98.1%

    \[\leadsto \frac{\color{blue}{\frac{0.5 - 0.125 \cdot \frac{1}{x}}{x}}}{\sqrt{1 + x}} \]
  14. Step-by-step derivation
    1. associate-*r/98.1%

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

      \[\leadsto \frac{\frac{0.5 - \frac{\color{blue}{0.125}}{x}}{x}}{\sqrt{1 + x}} \]
  15. Simplified98.1%

    \[\leadsto \frac{\color{blue}{\frac{0.5 - \frac{0.125}{x}}{x}}}{\sqrt{1 + x}} \]
  16. Add Preprocessing

Alternative 4: 97.7% accurate, 2.0× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. *-un-lft-identity37.3%

      \[\leadsto \frac{\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    3. *-rgt-identity37.3%

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

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

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{x \cdot \left(1 + x\right)}}} \]
  5. Step-by-step derivation
    1. flip--37.8%

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    2. add-sqr-sqrt38.0%

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

      \[\leadsto \frac{\frac{\left(1 + x\right) - \color{blue}{x}}{\sqrt{1 + x} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    4. add-sqr-sqrt39.2%

      \[\leadsto \frac{\frac{\left(1 + x\right) - x}{\sqrt{1 + \color{blue}{\sqrt{x} \cdot \sqrt{x}}} + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    5. hypot-1-def39.2%

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

    \[\leadsto \frac{\color{blue}{\frac{\left(1 + x\right) - x}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  7. Step-by-step derivation
    1. associate--l+81.8%

      \[\leadsto \frac{\frac{\color{blue}{1 + \left(x - x\right)}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    2. +-inverses81.8%

      \[\leadsto \frac{\frac{1 + \color{blue}{0}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    3. metadata-eval81.8%

      \[\leadsto \frac{\frac{\color{blue}{1}}{\mathsf{hypot}\left(1, \sqrt{x}\right) + \sqrt{x}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    4. +-commutative81.8%

      \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{x} + \mathsf{hypot}\left(1, \sqrt{x}\right)}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    5. hypot-undefine81.8%

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

      \[\leadsto \frac{\frac{1}{\sqrt{x} + \sqrt{\color{blue}{1} + \sqrt{x} \cdot \sqrt{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
    7. rem-square-sqrt81.8%

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

    \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  9. Step-by-step derivation
    1. *-un-lft-identity81.8%

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

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

      \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} \cdot \frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{1 + x}}} \]
  10. Applied egg-rr99.1%

    \[\leadsto \color{blue}{\frac{1}{\sqrt{x}} \cdot \frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{1 + x}}} \]
  11. Step-by-step derivation
    1. associate-*r/99.1%

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{1 + x}}} \]
    2. associate-*l/99.2%

      \[\leadsto \frac{\color{blue}{\frac{1 \cdot \frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{x}}}}{\sqrt{1 + x}} \]
    3. *-lft-identity99.2%

      \[\leadsto \frac{\frac{\color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}{\sqrt{x}}}{\sqrt{1 + x}} \]
  12. Simplified99.2%

    \[\leadsto \color{blue}{\frac{\frac{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}{\sqrt{x}}}{\sqrt{1 + x}}} \]
  13. Taylor expanded in x around inf 96.8%

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

Alternative 5: 36.3% accurate, 29.9× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. *-un-lft-identity37.3%

      \[\leadsto \frac{\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    3. *-rgt-identity37.3%

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  6. Step-by-step derivation
    1. *-commutative79.0%

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

      \[\leadsto \frac{\color{blue}{{\left(\frac{1}{x}\right)}^{0.5}} \cdot 0.5}{\sqrt{x \cdot \left(1 + x\right)}} \]
    3. rem-exp-log76.2%

      \[\leadsto \frac{{\left(\frac{1}{\color{blue}{e^{\log x}}}\right)}^{0.5} \cdot 0.5}{\sqrt{x \cdot \left(1 + x\right)}} \]
    4. exp-neg76.2%

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

      \[\leadsto \frac{\color{blue}{e^{\left(-\log x\right) \cdot 0.5}} \cdot 0.5}{\sqrt{x \cdot \left(1 + x\right)}} \]
    6. distribute-lft-neg-out76.2%

      \[\leadsto \frac{e^{\color{blue}{-\log x \cdot 0.5}} \cdot 0.5}{\sqrt{x \cdot \left(1 + x\right)}} \]
    7. distribute-rgt-neg-in76.2%

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

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

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

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

    \[\leadsto \color{blue}{\frac{0.5}{x}} \]
  9. Step-by-step derivation
    1. expm1-log1p-u7.9%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{0.5}{x}\right)\right)} \]
    2. log1p-define33.9%

      \[\leadsto \mathsf{expm1}\left(\color{blue}{\log \left(1 + \frac{0.5}{x}\right)}\right) \]
    3. expm1-undefine33.9%

      \[\leadsto \color{blue}{e^{\log \left(1 + \frac{0.5}{x}\right)} - 1} \]
    4. add-exp-log33.9%

      \[\leadsto \color{blue}{\left(1 + \frac{0.5}{x}\right)} - 1 \]
  10. Applied egg-rr33.9%

    \[\leadsto \color{blue}{\left(1 + \frac{0.5}{x}\right) - 1} \]
  11. Step-by-step derivation
    1. associate--l+33.9%

      \[\leadsto \color{blue}{1 + \left(\frac{0.5}{x} - 1\right)} \]
  12. Simplified33.9%

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

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

Alternative 6: 7.9% accurate, 69.7× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}} \]
    2. *-un-lft-identity37.3%

      \[\leadsto \frac{\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}} \]
    3. *-rgt-identity37.3%

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  6. Step-by-step derivation
    1. *-commutative79.0%

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

      \[\leadsto \frac{\color{blue}{{\left(\frac{1}{x}\right)}^{0.5}} \cdot 0.5}{\sqrt{x \cdot \left(1 + x\right)}} \]
    3. rem-exp-log76.2%

      \[\leadsto \frac{{\left(\frac{1}{\color{blue}{e^{\log x}}}\right)}^{0.5} \cdot 0.5}{\sqrt{x \cdot \left(1 + x\right)}} \]
    4. exp-neg76.2%

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

      \[\leadsto \frac{\color{blue}{e^{\left(-\log x\right) \cdot 0.5}} \cdot 0.5}{\sqrt{x \cdot \left(1 + x\right)}} \]
    6. distribute-lft-neg-out76.2%

      \[\leadsto \frac{e^{\color{blue}{-\log x \cdot 0.5}} \cdot 0.5}{\sqrt{x \cdot \left(1 + x\right)}} \]
    7. distribute-rgt-neg-in76.2%

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

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

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

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

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

Developer Target 1: 98.3% accurate, 1.0× speedup?

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

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

Reproduce

?
herbie shell --seed 2024158 
(FPCore (x)
  :name "2isqrt (example 3.6)"
  :precision binary64
  :pre (and (> x 1.0) (< x 1e+308))

  :alt
  (! :herbie-platform default (/ 1 (+ (* (+ x 1) (sqrt x)) (* x (sqrt (+ x 1))))))

  (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))