2sqrt (example 3.1)

Percentage Accurate: 6.8% → 98.7%
Time: 11.1s
Alternatives: 7
Speedup: 2.0×

Specification

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

\\
\sqrt{x + 1} - \sqrt{x}
\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: 6.8% accurate, 1.0× speedup?

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

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

Alternative 1: 98.7% accurate, 1.7× speedup?

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

\\
\frac{1}{\frac{\frac{0.25}{x} - x \cdot 4}{\frac{0.25 - x}{\frac{0.5}{{x}^{-0.5}}}}}
\end{array}
Derivation
  1. Initial program 7.5%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{-0.125 \cdot \sqrt{\frac{1}{x}} + \sqrt{x} \cdot 0.5}{x}} \]
  6. Step-by-step derivation
    1. clear-numN/A

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{-1}{8} \cdot \sqrt{\frac{1}{x}}\right), \color{blue}{\left(\sqrt{x} \cdot \frac{1}{2}\right)}\right)\right)\right) \]
    5. sqrt-divN/A

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{-1}{8} \cdot \frac{1}{\sqrt{x}}\right), \left(\sqrt{x} \cdot \frac{1}{2}\right)\right)\right)\right) \]
    7. un-div-invN/A

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{*.f64}\left(\left(\sqrt{x}\right), \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
    11. sqrt-lowering-sqrt.f6498.2%

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), \frac{1}{2}\right)\right)\right)\right) \]
  7. Applied egg-rr98.2%

    \[\leadsto \color{blue}{\frac{1}{\frac{x}{\frac{-0.125}{\sqrt{x}} + \sqrt{x} \cdot 0.5}}} \]
  8. Taylor expanded in x around inf

    \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{1}{2} \cdot \sqrt{\frac{1}{x}} + 2 \cdot \sqrt{x}\right)}\right) \]
  9. Step-by-step derivation
    1. +-lowering-+.f64N/A

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, x\right)\right)\right), \mathsf{*.f64}\left(\left(\sqrt{x}\right), \color{blue}{2}\right)\right)\right) \]
    7. sqrt-lowering-sqrt.f6498.4%

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, x\right)\right)\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), 2\right)\right)\right) \]
  10. Simplified98.4%

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

      \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\left(\frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right) \cdot \left(\frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right) - \left(\sqrt{x} \cdot 2\right) \cdot \left(\sqrt{x} \cdot 2\right)}{\color{blue}{\frac{1}{2} \cdot \sqrt{\frac{1}{x}} - \sqrt{x} \cdot 2}}\right)\right) \]
    2. fmm-defN/A

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\left(\frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right) \cdot \left(\frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right) - \left(\sqrt{x} \cdot 2\right) \cdot \left(\sqrt{x} \cdot 2\right)\right), \color{blue}{\left(\mathsf{fma}\left(\frac{1}{2}, \sqrt{\frac{1}{x}}, \mathsf{neg}\left(2 \cdot \sqrt{x}\right)\right)\right)}\right)\right) \]
  12. Applied egg-rr98.6%

    \[\leadsto \frac{1}{\color{blue}{\frac{\frac{0.25}{x} - x \cdot 4}{\frac{0.25 - x}{\frac{0.5}{{x}^{-0.5}}}}}} \]
  13. Add Preprocessing

Alternative 2: 98.6% accurate, 1.8× speedup?

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

\\
\frac{\frac{0.25 - x}{\frac{0.5}{{x}^{-0.5}}}}{\frac{0.25}{x} - x \cdot 4}
\end{array}
Derivation
  1. Initial program 7.5%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{-0.125 \cdot \sqrt{\frac{1}{x}} + \sqrt{x} \cdot 0.5}{x}} \]
  6. Step-by-step derivation
    1. clear-numN/A

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{-1}{8} \cdot \sqrt{\frac{1}{x}}\right), \color{blue}{\left(\sqrt{x} \cdot \frac{1}{2}\right)}\right)\right)\right) \]
    5. sqrt-divN/A

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{-1}{8} \cdot \frac{1}{\sqrt{x}}\right), \left(\sqrt{x} \cdot \frac{1}{2}\right)\right)\right)\right) \]
    7. un-div-invN/A

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{*.f64}\left(\left(\sqrt{x}\right), \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
    11. sqrt-lowering-sqrt.f6498.2%

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), \frac{1}{2}\right)\right)\right)\right) \]
  7. Applied egg-rr98.2%

    \[\leadsto \color{blue}{\frac{1}{\frac{x}{\frac{-0.125}{\sqrt{x}} + \sqrt{x} \cdot 0.5}}} \]
  8. Taylor expanded in x around inf

    \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{1}{2} \cdot \sqrt{\frac{1}{x}} + 2 \cdot \sqrt{x}\right)}\right) \]
  9. Step-by-step derivation
    1. +-lowering-+.f64N/A

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, x\right)\right)\right), \mathsf{*.f64}\left(\left(\sqrt{x}\right), \color{blue}{2}\right)\right)\right) \]
    7. sqrt-lowering-sqrt.f6498.4%

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, x\right)\right)\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), 2\right)\right)\right) \]
  10. Simplified98.4%

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

      \[\leadsto \frac{1}{\frac{\left(\frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right) \cdot \left(\frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right) - \left(\sqrt{x} \cdot 2\right) \cdot \left(\sqrt{x} \cdot 2\right)}{\color{blue}{\frac{1}{2} \cdot \sqrt{\frac{1}{x}} - \sqrt{x} \cdot 2}}} \]
    2. fmm-defN/A

      \[\leadsto \frac{1}{\frac{\left(\frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right) \cdot \left(\frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right) - \left(\sqrt{x} \cdot 2\right) \cdot \left(\sqrt{x} \cdot 2\right)}{\mathsf{fma}\left(\frac{1}{2}, \color{blue}{\sqrt{\frac{1}{x}}}, \mathsf{neg}\left(\sqrt{x} \cdot 2\right)\right)}} \]
    3. *-commutativeN/A

      \[\leadsto \frac{1}{\frac{\left(\frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right) \cdot \left(\frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right) - \left(\sqrt{x} \cdot 2\right) \cdot \left(\sqrt{x} \cdot 2\right)}{\mathsf{fma}\left(\frac{1}{2}, \sqrt{\frac{1}{x}}, \mathsf{neg}\left(2 \cdot \sqrt{x}\right)\right)}} \]
    4. clear-numN/A

      \[\leadsto \frac{\mathsf{fma}\left(\frac{1}{2}, \sqrt{\frac{1}{x}}, \mathsf{neg}\left(2 \cdot \sqrt{x}\right)\right)}{\color{blue}{\left(\frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right) \cdot \left(\frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right) - \left(\sqrt{x} \cdot 2\right) \cdot \left(\sqrt{x} \cdot 2\right)}} \]
    5. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\left(\mathsf{fma}\left(\frac{1}{2}, \sqrt{\frac{1}{x}}, \mathsf{neg}\left(2 \cdot \sqrt{x}\right)\right)\right), \color{blue}{\left(\left(\frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right) \cdot \left(\frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right) - \left(\sqrt{x} \cdot 2\right) \cdot \left(\sqrt{x} \cdot 2\right)\right)}\right) \]
  12. Applied egg-rr98.4%

    \[\leadsto \color{blue}{\frac{\frac{0.25 - x}{\frac{0.5}{{x}^{-0.5}}}}{\frac{0.25}{x} - x \cdot 4}} \]
  13. Add Preprocessing

Alternative 3: 98.2% accurate, 1.9× speedup?

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

\\
\frac{1}{\frac{0.25 + x}{\frac{0.5}{{x}^{-0.5}}}}
\end{array}
Derivation
  1. Initial program 7.5%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{-0.125 \cdot \sqrt{\frac{1}{x}} + \sqrt{x} \cdot 0.5}{x}} \]
  6. Step-by-step derivation
    1. clear-numN/A

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{-1}{8} \cdot \sqrt{\frac{1}{x}}\right), \color{blue}{\left(\sqrt{x} \cdot \frac{1}{2}\right)}\right)\right)\right) \]
    5. sqrt-divN/A

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{-1}{8} \cdot \frac{1}{\sqrt{x}}\right), \left(\sqrt{x} \cdot \frac{1}{2}\right)\right)\right)\right) \]
    7. un-div-invN/A

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{*.f64}\left(\left(\sqrt{x}\right), \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
    11. sqrt-lowering-sqrt.f6498.2%

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), \frac{1}{2}\right)\right)\right)\right) \]
  7. Applied egg-rr98.2%

    \[\leadsto \color{blue}{\frac{1}{\frac{x}{\frac{-0.125}{\sqrt{x}} + \sqrt{x} \cdot 0.5}}} \]
  8. Taylor expanded in x around inf

    \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{1}{2} \cdot \sqrt{\frac{1}{x}} + 2 \cdot \sqrt{x}\right)}\right) \]
  9. Step-by-step derivation
    1. +-lowering-+.f64N/A

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, x\right)\right)\right), \mathsf{*.f64}\left(\left(\sqrt{x}\right), \color{blue}{2}\right)\right)\right) \]
    7. sqrt-lowering-sqrt.f6498.4%

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, x\right)\right)\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), 2\right)\right)\right) \]
  10. Simplified98.4%

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\sqrt{x}}{\frac{1}{2}} + \frac{1}{2} \cdot \frac{1}{\sqrt{\color{blue}{x}}}\right)\right) \]
    6. div-invN/A

      \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\sqrt{x}}{\frac{1}{2}} + \frac{\frac{1}{2}}{\color{blue}{\sqrt{x}}}\right)\right) \]
    7. frac-addN/A

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\sqrt{x} \cdot \sqrt{x} + \frac{1}{2} \cdot \frac{1}{2}\right), \color{blue}{\left(\frac{1}{{x}^{\frac{-1}{2}}} \cdot \frac{1}{2}\right)}\right)\right) \]
    13. rem-square-sqrtN/A

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, \frac{1}{4}\right), \mathsf{/.f64}\left(\frac{1}{2}, \color{blue}{\left({x}^{\frac{-1}{2}}\right)}\right)\right)\right) \]
    19. pow-lowering-pow.f6497.9%

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, \frac{1}{4}\right), \mathsf{/.f64}\left(\frac{1}{2}, \mathsf{pow.f64}\left(x, \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
  12. Applied egg-rr97.9%

    \[\leadsto \frac{1}{\color{blue}{\frac{x + 0.25}{\frac{0.5}{{x}^{-0.5}}}}} \]
  13. Final simplification97.9%

    \[\leadsto \frac{1}{\frac{0.25 + x}{\frac{0.5}{{x}^{-0.5}}}} \]
  14. Add Preprocessing

Alternative 4: 98.4% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{-0.125 \cdot \sqrt{\frac{1}{x}} + \sqrt{x} \cdot 0.5}{x}} \]
  6. Step-by-step derivation
    1. clear-numN/A

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{-1}{8} \cdot \sqrt{\frac{1}{x}}\right), \color{blue}{\left(\sqrt{x} \cdot \frac{1}{2}\right)}\right)\right)\right) \]
    5. sqrt-divN/A

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{-1}{8} \cdot \frac{1}{\sqrt{x}}\right), \left(\sqrt{x} \cdot \frac{1}{2}\right)\right)\right)\right) \]
    7. un-div-invN/A

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{*.f64}\left(\left(\sqrt{x}\right), \color{blue}{\frac{1}{2}}\right)\right)\right)\right) \]
    11. sqrt-lowering-sqrt.f6498.2%

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), \frac{1}{2}\right)\right)\right)\right) \]
  7. Applied egg-rr98.2%

    \[\leadsto \color{blue}{\frac{1}{\frac{x}{\frac{-0.125}{\sqrt{x}} + \sqrt{x} \cdot 0.5}}} \]
  8. Taylor expanded in x around inf

    \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{1}{2} \cdot \sqrt{\frac{1}{x}} + 2 \cdot \sqrt{x}\right)}\right) \]
  9. Step-by-step derivation
    1. +-lowering-+.f64N/A

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, x\right)\right)\right), \mathsf{*.f64}\left(\left(\sqrt{x}\right), \color{blue}{2}\right)\right)\right) \]
    7. sqrt-lowering-sqrt.f6498.4%

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, x\right)\right)\right), \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), 2\right)\right)\right) \]
  10. Simplified98.4%

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\mathsf{neg}\left(\sqrt{x}\right)}{\mathsf{neg}\left(\frac{1}{2}\right)} + \color{blue}{\frac{1}{2}} \cdot \sqrt{\frac{1}{x}}\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\mathsf{neg}\left(\sqrt{x}\right)}{\frac{-1}{2}} + \frac{1}{2} \cdot \sqrt{\frac{1}{x}}\right)\right) \]
    6. sqrt-divN/A

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

      \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\mathsf{neg}\left(\sqrt{x}\right)}{\frac{-1}{2}} + \frac{1}{2} \cdot \frac{1}{\sqrt{\color{blue}{x}}}\right)\right) \]
    8. div-invN/A

      \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\mathsf{neg}\left(\sqrt{x}\right)}{\frac{-1}{2}} + \frac{\frac{1}{2}}{\color{blue}{\sqrt{x}}}\right)\right) \]
    9. frac-2negN/A

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

      \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\mathsf{neg}\left(\sqrt{x}\right)}{\frac{-1}{2}} + \frac{\frac{-1}{2}}{\mathsf{neg}\left(\color{blue}{\sqrt{x}}\right)}\right)\right) \]
    11. frac-addN/A

      \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\left(\mathsf{neg}\left(\sqrt{x}\right)\right) \cdot \left(\mathsf{neg}\left(\sqrt{x}\right)\right) + \frac{-1}{2} \cdot \frac{-1}{2}}{\color{blue}{\frac{-1}{2} \cdot \left(\mathsf{neg}\left(\sqrt{x}\right)\right)}}\right)\right) \]
    12. sqr-negN/A

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

      \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\sqrt{x} \cdot \sqrt{x} + \frac{1}{4}}{\frac{-1}{2} \cdot \left(\mathsf{neg}\left(\sqrt{x}\right)\right)}\right)\right) \]
    14. metadata-evalN/A

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\sqrt{x} \cdot \sqrt{x} + \frac{1}{2} \cdot \frac{1}{2}\right), \color{blue}{\left(\frac{-1}{2} \cdot \left(\mathsf{neg}\left(\sqrt{x}\right)\right)\right)}\right)\right) \]
    16. rem-square-sqrtN/A

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right), \left(\color{blue}{\frac{-1}{2}} \cdot \left(\mathsf{neg}\left(\sqrt{x}\right)\right)\right)\right)\right) \]
    18. metadata-evalN/A

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, \frac{1}{4}\right), \mathsf{*.f64}\left(\frac{-1}{2}, \color{blue}{\left(\mathsf{neg}\left(\sqrt{x}\right)\right)}\right)\right)\right) \]
    20. neg-sub0N/A

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, \frac{1}{4}\right), \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{\_.f64}\left(0, \color{blue}{\left(\sqrt{x}\right)}\right)\right)\right)\right) \]
    22. sqrt-lowering-sqrt.f6498.2%

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, \frac{1}{4}\right), \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{\_.f64}\left(0, \mathsf{sqrt.f64}\left(x\right)\right)\right)\right)\right) \]
  12. Applied egg-rr98.2%

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

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

Alternative 5: 98.0% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(x, \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right), \frac{1}{2}\right) \]
    8. metadata-eval97.5%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(x, \frac{-1}{2}\right), \frac{1}{2}\right) \]
  7. Applied egg-rr97.5%

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

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

Alternative 6: 97.6% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{2} \cdot \frac{\sqrt{1}}{\color{blue}{\sqrt{x}}} \]
    2. metadata-evalN/A

      \[\leadsto \frac{1}{2} \cdot \frac{1}{\sqrt{\color{blue}{x}}} \]
    3. un-div-invN/A

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

      \[\leadsto \mathsf{/.f64}\left(\frac{1}{2}, \color{blue}{\left(\sqrt{x}\right)}\right) \]
    5. sqrt-lowering-sqrt.f6497.2%

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

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

Alternative 7: 3.8% accurate, 68.3× speedup?

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

\\
x \cdot 0
\end{array}
Derivation
  1. Initial program 7.5%

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

      \[\leadsto \frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\color{blue}{\sqrt{x + 1} + \sqrt{x}}} \]
    2. clear-numN/A

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

      \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{\sqrt{x + 1} + \sqrt{x}}{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}\right)}\right) \]
    4. clear-numN/A

      \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}}}\right)\right) \]
    5. flip--N/A

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \color{blue}{\left(\sqrt{x + 1} - \sqrt{x}\right)}\right)\right) \]
    7. --lowering--.f64N/A

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{pow.f64}\left(\mathsf{+.f64}\left(x, 1\right), \frac{1}{2}\right), \left(\sqrt{x}\right)\right)\right)\right) \]
    11. sqrt-lowering-sqrt.f647.5%

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(1 + x\right)\right), \mathsf{sqrt.f64}\left(x\right)\right)\right)\right) \]
    4. +-lowering-+.f647.5%

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(1, x\right)\right), \mathsf{sqrt.f64}\left(x\right)\right)\right)\right) \]
  6. Applied egg-rr7.5%

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(1, x\right)\right), \mathsf{/.f64}\left(x, \color{blue}{\left(\sqrt{x}\right)}\right)\right)\right)\right) \]
    7. sqrt-lowering-sqrt.f647.1%

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(1, x\right)\right), \mathsf{/.f64}\left(x, \mathsf{sqrt.f64}\left(x\right)\right)\right)\right)\right) \]
  8. Applied egg-rr7.1%

    \[\leadsto \frac{1}{\frac{1}{\sqrt{1 + x} - \color{blue}{\frac{x}{\sqrt{x}}}}} \]
  9. Taylor expanded in x around -inf

    \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(\sqrt{\frac{1}{x}} \cdot {\left(\sqrt{-1}\right)}^{2} - -1 \cdot \sqrt{\frac{1}{x}}\right)\right)} \]
  10. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{neg}\left(x \cdot \left(\sqrt{\frac{1}{x}} \cdot {\left(\sqrt{-1}\right)}^{2} - -1 \cdot \sqrt{\frac{1}{x}}\right)\right) \]
    2. distribute-rgt-neg-inN/A

      \[\leadsto x \cdot \color{blue}{\left(\mathsf{neg}\left(\left(\sqrt{\frac{1}{x}} \cdot {\left(\sqrt{-1}\right)}^{2} - -1 \cdot \sqrt{\frac{1}{x}}\right)\right)\right)} \]
    3. rem-square-sqrtN/A

      \[\leadsto x \cdot \left(\mathsf{neg}\left(\left(\sqrt{\frac{1}{x}} \cdot {\left(\sqrt{-1}\right)}^{2} - \left(\sqrt{-1} \cdot \sqrt{-1}\right) \cdot \sqrt{\frac{1}{x}}\right)\right)\right) \]
    4. unpow2N/A

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

      \[\leadsto x \cdot \left(\mathsf{neg}\left(\left(\sqrt{\frac{1}{x}} \cdot {\left(\sqrt{-1}\right)}^{2} - \sqrt{\frac{1}{x}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)\right) \]
    6. +-inversesN/A

      \[\leadsto x \cdot \left(\mathsf{neg}\left(0\right)\right) \]
    7. metadata-evalN/A

      \[\leadsto x \cdot 0 \]
    8. *-lowering-*.f643.8%

      \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{0}\right) \]
  11. Simplified3.8%

    \[\leadsto \color{blue}{x \cdot 0} \]
  12. Add Preprocessing

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

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

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

Reproduce

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

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

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