2isqrt (example 3.6)

Percentage Accurate: 39.7% → 98.7%
Time: 9.6s
Alternatives: 8
Speedup: 2.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 alternatives:

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

Initial Program: 39.7% accurate, 1.0× speedup?

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

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

Alternative 1: 98.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left|{x}^{-2.5}\right|\\ \frac{\left(\mathsf{fma}\left(t\_0, -0.25, {x}^{-0.5} \cdot 0.5\right) - {x}^{-0.5} \cdot \frac{0.375}{x}\right) + t\_0 \cdot 0.5}{x} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (fabs (pow x -2.5))))
   (/
    (+
     (- (fma t_0 -0.25 (* (pow x -0.5) 0.5)) (* (pow x -0.5) (/ 0.375 x)))
     (* t_0 0.5))
    x)))
double code(double x) {
	double t_0 = fabs(pow(x, -2.5));
	return ((fma(t_0, -0.25, (pow(x, -0.5) * 0.5)) - (pow(x, -0.5) * (0.375 / x))) + (t_0 * 0.5)) / x;
}
function code(x)
	t_0 = abs((x ^ -2.5))
	return Float64(Float64(Float64(fma(t_0, -0.25, Float64((x ^ -0.5) * 0.5)) - Float64((x ^ -0.5) * Float64(0.375 / x))) + Float64(t_0 * 0.5)) / x)
end
code[x_] := Block[{t$95$0 = N[Abs[N[Power[x, -2.5], $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(N[(t$95$0 * -0.25 + N[(N[Power[x, -0.5], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[Power[x, -0.5], $MachinePrecision] * N[(0.375 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * 0.5), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}

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

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

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

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

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

Alternative 2: 98.6% accurate, 0.7× speedup?

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

\\
\frac{\mathsf{fma}\left(-1, \frac{0.375}{{x}^{1.5}}, 0.5 \cdot \sqrt{\frac{1}{x}}\right)}{x}
\end{array}
Derivation
  1. Initial program 37.9%

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

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

    \[\leadsto \color{blue}{\frac{-1 \cdot \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}} \]
  5. Step-by-step derivation
    1. fma-define99.0%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1, \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}, 0.5 \cdot \sqrt{\frac{1}{x}}\right)}}{x} \]
    2. distribute-rgt-out99.0%

      \[\leadsto \frac{\mathsf{fma}\left(-1, \frac{\color{blue}{\sqrt{\frac{1}{x}} \cdot \left(-0.125 + 0.5\right)}}{x}, 0.5 \cdot \sqrt{\frac{1}{x}}\right)}{x} \]
    3. metadata-eval99.0%

      \[\leadsto \frac{\mathsf{fma}\left(-1, \frac{\sqrt{\frac{1}{x}} \cdot \color{blue}{0.375}}{x}, 0.5 \cdot \sqrt{\frac{1}{x}}\right)}{x} \]
    4. *-commutative99.0%

      \[\leadsto \frac{\mathsf{fma}\left(-1, \frac{\sqrt{\frac{1}{x}} \cdot 0.375}{x}, \color{blue}{\sqrt{\frac{1}{x}} \cdot 0.5}\right)}{x} \]
  6. Simplified99.0%

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, \frac{\sqrt{\frac{1}{x}} \cdot 0.375}{x}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x}} \]
  7. Step-by-step derivation
    1. associate-/l*99.0%

      \[\leadsto \frac{\mathsf{fma}\left(-1, \color{blue}{\sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
    2. inv-pow99.0%

      \[\leadsto \frac{\mathsf{fma}\left(-1, \sqrt{\color{blue}{{x}^{-1}}} \cdot \frac{0.375}{x}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
    3. sqrt-pow199.0%

      \[\leadsto \frac{\mathsf{fma}\left(-1, \color{blue}{{x}^{\left(\frac{-1}{2}\right)}} \cdot \frac{0.375}{x}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
    4. metadata-eval99.0%

      \[\leadsto \frac{\mathsf{fma}\left(-1, {x}^{\color{blue}{-0.5}} \cdot \frac{0.375}{x}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
    5. *-un-lft-identity99.0%

      \[\leadsto \frac{\mathsf{fma}\left(-1, \color{blue}{1 \cdot \left({x}^{-0.5} \cdot \frac{0.375}{x}\right)}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
    6. metadata-eval99.0%

      \[\leadsto \frac{\mathsf{fma}\left(-1, 1 \cdot \left({x}^{\color{blue}{\left(-0.5\right)}} \cdot \frac{0.375}{x}\right), \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
    7. pow-flip99.0%

      \[\leadsto \frac{\mathsf{fma}\left(-1, 1 \cdot \left(\color{blue}{\frac{1}{{x}^{0.5}}} \cdot \frac{0.375}{x}\right), \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
    8. pow1/299.0%

      \[\leadsto \frac{\mathsf{fma}\left(-1, 1 \cdot \left(\frac{1}{\color{blue}{\sqrt{x}}} \cdot \frac{0.375}{x}\right), \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
    9. frac-times99.0%

      \[\leadsto \frac{\mathsf{fma}\left(-1, 1 \cdot \color{blue}{\frac{1 \cdot 0.375}{\sqrt{x} \cdot x}}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
    10. metadata-eval99.0%

      \[\leadsto \frac{\mathsf{fma}\left(-1, 1 \cdot \frac{\color{blue}{0.375}}{\sqrt{x} \cdot x}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
    11. *-commutative99.0%

      \[\leadsto \frac{\mathsf{fma}\left(-1, 1 \cdot \frac{0.375}{\color{blue}{x \cdot \sqrt{x}}}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
    12. pow199.0%

      \[\leadsto \frac{\mathsf{fma}\left(-1, 1 \cdot \frac{0.375}{\color{blue}{{x}^{1}} \cdot \sqrt{x}}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
    13. pow1/299.0%

      \[\leadsto \frac{\mathsf{fma}\left(-1, 1 \cdot \frac{0.375}{{x}^{1} \cdot \color{blue}{{x}^{0.5}}}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
    14. pow-prod-up99.0%

      \[\leadsto \frac{\mathsf{fma}\left(-1, 1 \cdot \frac{0.375}{\color{blue}{{x}^{\left(1 + 0.5\right)}}}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
    15. metadata-eval99.0%

      \[\leadsto \frac{\mathsf{fma}\left(-1, 1 \cdot \frac{0.375}{{x}^{\color{blue}{1.5}}}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
  8. Applied egg-rr99.0%

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

      \[\leadsto \frac{\mathsf{fma}\left(-1, \color{blue}{\frac{0.375}{{x}^{1.5}}}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
  10. Simplified99.0%

    \[\leadsto \frac{\mathsf{fma}\left(-1, \color{blue}{\frac{0.375}{{x}^{1.5}}}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
  11. Final simplification99.0%

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

Alternative 3: 98.6% accurate, 1.0× speedup?

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

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

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

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

    \[\leadsto \color{blue}{\frac{-1 \cdot \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}} \]
  5. Step-by-step derivation
    1. Simplified99.0%

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

    Alternative 4: 98.5% accurate, 1.0× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{-1 \cdot \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}} \]
    5. Step-by-step derivation
      1. fma-define99.0%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1, \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}, 0.5 \cdot \sqrt{\frac{1}{x}}\right)}}{x} \]
      2. distribute-rgt-out99.0%

        \[\leadsto \frac{\mathsf{fma}\left(-1, \frac{\color{blue}{\sqrt{\frac{1}{x}} \cdot \left(-0.125 + 0.5\right)}}{x}, 0.5 \cdot \sqrt{\frac{1}{x}}\right)}{x} \]
      3. metadata-eval99.0%

        \[\leadsto \frac{\mathsf{fma}\left(-1, \frac{\sqrt{\frac{1}{x}} \cdot \color{blue}{0.375}}{x}, 0.5 \cdot \sqrt{\frac{1}{x}}\right)}{x} \]
      4. *-commutative99.0%

        \[\leadsto \frac{\mathsf{fma}\left(-1, \frac{\sqrt{\frac{1}{x}} \cdot 0.375}{x}, \color{blue}{\sqrt{\frac{1}{x}} \cdot 0.5}\right)}{x} \]
    6. Simplified99.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, \frac{\sqrt{\frac{1}{x}} \cdot 0.375}{x}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity99.0%

        \[\leadsto \color{blue}{1 \cdot \frac{\mathsf{fma}\left(-1, \frac{\sqrt{\frac{1}{x}} \cdot 0.375}{x}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x}} \]
      2. associate-/l*99.0%

        \[\leadsto 1 \cdot \frac{\mathsf{fma}\left(-1, \color{blue}{\sqrt{\frac{1}{x}} \cdot \frac{0.375}{x}}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
      3. sqrt-div99.0%

        \[\leadsto 1 \cdot \frac{\mathsf{fma}\left(-1, \color{blue}{\frac{\sqrt{1}}{\sqrt{x}}} \cdot \frac{0.375}{x}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
      4. metadata-eval99.0%

        \[\leadsto 1 \cdot \frac{\mathsf{fma}\left(-1, \frac{\color{blue}{1}}{\sqrt{x}} \cdot \frac{0.375}{x}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
      5. frac-times99.0%

        \[\leadsto 1 \cdot \frac{\mathsf{fma}\left(-1, \color{blue}{\frac{1 \cdot 0.375}{\sqrt{x} \cdot x}}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
      6. metadata-eval99.0%

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

        \[\leadsto 1 \cdot \frac{\mathsf{fma}\left(-1, \frac{0.375}{\color{blue}{x \cdot \sqrt{x}}}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
      8. pow199.0%

        \[\leadsto 1 \cdot \frac{\mathsf{fma}\left(-1, \frac{0.375}{\color{blue}{{x}^{1}} \cdot \sqrt{x}}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
      9. pow1/299.0%

        \[\leadsto 1 \cdot \frac{\mathsf{fma}\left(-1, \frac{0.375}{{x}^{1} \cdot \color{blue}{{x}^{0.5}}}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
      10. pow-prod-up99.0%

        \[\leadsto 1 \cdot \frac{\mathsf{fma}\left(-1, \frac{0.375}{\color{blue}{{x}^{\left(1 + 0.5\right)}}}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
      11. metadata-eval99.0%

        \[\leadsto 1 \cdot \frac{\mathsf{fma}\left(-1, \frac{0.375}{{x}^{\color{blue}{1.5}}}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x} \]
      12. *-commutative99.0%

        \[\leadsto 1 \cdot \frac{\mathsf{fma}\left(-1, \frac{0.375}{{x}^{1.5}}, \color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}}\right)}{x} \]
      13. sqrt-div98.9%

        \[\leadsto 1 \cdot \frac{\mathsf{fma}\left(-1, \frac{0.375}{{x}^{1.5}}, 0.5 \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{x}}}\right)}{x} \]
      14. metadata-eval98.9%

        \[\leadsto 1 \cdot \frac{\mathsf{fma}\left(-1, \frac{0.375}{{x}^{1.5}}, 0.5 \cdot \frac{\color{blue}{1}}{\sqrt{x}}\right)}{x} \]
      15. un-div-inv98.9%

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \frac{0.375}{{x}^{1.5}} + \frac{0.5}{\sqrt{x}}}}{x} \]
      3. neg-mul-198.9%

        \[\leadsto \frac{\color{blue}{\left(-\frac{0.375}{{x}^{1.5}}\right)} + \frac{0.5}{\sqrt{x}}}{x} \]
      4. +-commutative98.9%

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

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

        \[\leadsto \frac{\frac{0.5}{\sqrt{x}} + \frac{\color{blue}{-0.375}}{{x}^{1.5}}}{x} \]
    10. Simplified98.9%

      \[\leadsto \color{blue}{\frac{\frac{0.5}{\sqrt{x}} + \frac{-0.375}{{x}^{1.5}}}{x}} \]
    11. Add Preprocessing

    Alternative 5: 38.1% accurate, 2.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 8.5 \cdot 10^{+122}:\\ \;\;\;\;{x}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
    (FPCore (x) :precision binary64 (if (<= x 8.5e+122) (pow x -0.5) 0.0))
    double code(double x) {
    	double tmp;
    	if (x <= 8.5e+122) {
    		tmp = pow(x, -0.5);
    	} else {
    		tmp = 0.0;
    	}
    	return tmp;
    }
    
    real(8) function code(x)
        real(8), intent (in) :: x
        real(8) :: tmp
        if (x <= 8.5d+122) then
            tmp = x ** (-0.5d0)
        else
            tmp = 0.0d0
        end if
        code = tmp
    end function
    
    public static double code(double x) {
    	double tmp;
    	if (x <= 8.5e+122) {
    		tmp = Math.pow(x, -0.5);
    	} else {
    		tmp = 0.0;
    	}
    	return tmp;
    }
    
    def code(x):
    	tmp = 0
    	if x <= 8.5e+122:
    		tmp = math.pow(x, -0.5)
    	else:
    		tmp = 0.0
    	return tmp
    
    function code(x)
    	tmp = 0.0
    	if (x <= 8.5e+122)
    		tmp = x ^ -0.5;
    	else
    		tmp = 0.0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x)
    	tmp = 0.0;
    	if (x <= 8.5e+122)
    		tmp = x ^ -0.5;
    	else
    		tmp = 0.0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_] := If[LessEqual[x, 8.5e+122], N[Power[x, -0.5], $MachinePrecision], 0.0]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq 8.5 \cdot 10^{+122}:\\
    \;\;\;\;{x}^{-0.5}\\
    
    \mathbf{else}:\\
    \;\;\;\;0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 8.50000000000000003e122

      1. Initial program 11.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \]
      7. Step-by-step derivation
        1. unpow1/27.7%

          \[\leadsto \color{blue}{{\left(\frac{1}{x}\right)}^{0.5}} \]
        2. rem-exp-log7.7%

          \[\leadsto {\left(\frac{1}{\color{blue}{e^{\log x}}}\right)}^{0.5} \]
        3. exp-neg7.7%

          \[\leadsto {\color{blue}{\left(e^{-\log x}\right)}}^{0.5} \]
        4. exp-prod7.7%

          \[\leadsto \color{blue}{e^{\left(-\log x\right) \cdot 0.5}} \]
        5. distribute-lft-neg-out7.7%

          \[\leadsto e^{\color{blue}{-\log x \cdot 0.5}} \]
        6. distribute-rgt-neg-in7.7%

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

          \[\leadsto e^{\log x \cdot \color{blue}{-0.5}} \]
        8. exp-to-pow7.7%

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

        \[\leadsto \color{blue}{{x}^{-0.5}} \]

      if 8.50000000000000003e122 < x

      1. Initial program 57.2%

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

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

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

          \[\leadsto \left(-\color{blue}{\left(\sqrt[3]{\frac{1}{\sqrt{x + 1}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x + 1}}}\right) \cdot \sqrt[3]{\frac{1}{\sqrt{x + 1}}}}\right) + \frac{1}{\sqrt{x}} \]
        4. distribute-lft-neg-in7.6%

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

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

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

        \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} + -1 \cdot \sqrt{\frac{1}{x}}} \]
      6. Step-by-step derivation
        1. distribute-rgt1-in57.2%

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

          \[\leadsto \color{blue}{0} \cdot \sqrt{\frac{1}{x}} \]
        3. mul0-lft57.2%

          \[\leadsto \color{blue}{0} \]
      7. Simplified57.2%

        \[\leadsto \color{blue}{0} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 6: 97.5% accurate, 2.0× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{-1 \cdot \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}} \]
    5. Step-by-step derivation
      1. fma-define99.0%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1, \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}, 0.5 \cdot \sqrt{\frac{1}{x}}\right)}}{x} \]
      2. distribute-rgt-out99.0%

        \[\leadsto \frac{\mathsf{fma}\left(-1, \frac{\color{blue}{\sqrt{\frac{1}{x}} \cdot \left(-0.125 + 0.5\right)}}{x}, 0.5 \cdot \sqrt{\frac{1}{x}}\right)}{x} \]
      3. metadata-eval99.0%

        \[\leadsto \frac{\mathsf{fma}\left(-1, \frac{\sqrt{\frac{1}{x}} \cdot \color{blue}{0.375}}{x}, 0.5 \cdot \sqrt{\frac{1}{x}}\right)}{x} \]
      4. *-commutative99.0%

        \[\leadsto \frac{\mathsf{fma}\left(-1, \frac{\sqrt{\frac{1}{x}} \cdot 0.375}{x}, \color{blue}{\sqrt{\frac{1}{x}} \cdot 0.5}\right)}{x} \]
    6. Simplified99.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, \frac{\sqrt{\frac{1}{x}} \cdot 0.375}{x}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x}} \]
    7. Taylor expanded in x around inf 97.6%

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

    Alternative 7: 97.6% accurate, 2.0× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{-1 \cdot \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}} \]
    5. Step-by-step derivation
      1. fma-define99.0%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1, \frac{-0.125 \cdot \sqrt{\frac{1}{x}} + 0.5 \cdot \sqrt{\frac{1}{x}}}{x}, 0.5 \cdot \sqrt{\frac{1}{x}}\right)}}{x} \]
      2. distribute-rgt-out99.0%

        \[\leadsto \frac{\mathsf{fma}\left(-1, \frac{\color{blue}{\sqrt{\frac{1}{x}} \cdot \left(-0.125 + 0.5\right)}}{x}, 0.5 \cdot \sqrt{\frac{1}{x}}\right)}{x} \]
      3. metadata-eval99.0%

        \[\leadsto \frac{\mathsf{fma}\left(-1, \frac{\sqrt{\frac{1}{x}} \cdot \color{blue}{0.375}}{x}, 0.5 \cdot \sqrt{\frac{1}{x}}\right)}{x} \]
      4. *-commutative99.0%

        \[\leadsto \frac{\mathsf{fma}\left(-1, \frac{\sqrt{\frac{1}{x}} \cdot 0.375}{x}, \color{blue}{\sqrt{\frac{1}{x}} \cdot 0.5}\right)}{x} \]
    6. Simplified99.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, \frac{\sqrt{\frac{1}{x}} \cdot 0.375}{x}, \sqrt{\frac{1}{x}} \cdot 0.5\right)}{x}} \]
    7. Taylor expanded in x around inf 97.6%

      \[\leadsto \frac{\color{blue}{0.5 \cdot \sqrt{\frac{1}{x}}}}{x} \]
    8. Step-by-step derivation
      1. unpow1/297.6%

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

        \[\leadsto \frac{0.5 \cdot {\left(\frac{1}{\color{blue}{e^{\log x}}}\right)}^{0.5}}{x} \]
      3. exp-neg93.6%

        \[\leadsto \frac{0.5 \cdot {\color{blue}{\left(e^{-\log x}\right)}}^{0.5}}{x} \]
      4. exp-prod93.6%

        \[\leadsto \frac{0.5 \cdot \color{blue}{e^{\left(-\log x\right) \cdot 0.5}}}{x} \]
      5. distribute-lft-neg-out93.6%

        \[\leadsto \frac{0.5 \cdot e^{\color{blue}{-\log x \cdot 0.5}}}{x} \]
      6. distribute-rgt-neg-in93.6%

        \[\leadsto \frac{0.5 \cdot e^{\color{blue}{\log x \cdot \left(-0.5\right)}}}{x} \]
      7. metadata-eval93.6%

        \[\leadsto \frac{0.5 \cdot e^{\log x \cdot \color{blue}{-0.5}}}{x} \]
      8. exp-to-pow97.6%

        \[\leadsto \frac{0.5 \cdot \color{blue}{{x}^{-0.5}}}{x} \]
    9. Simplified97.6%

      \[\leadsto \frac{\color{blue}{0.5 \cdot {x}^{-0.5}}}{x} \]
    10. Final simplification97.6%

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

    Alternative 8: 36.7% accurate, 209.0× speedup?

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

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

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

        \[\leadsto \color{blue}{\left(-\frac{1}{\sqrt{x + 1}}\right) + \frac{1}{\sqrt{x}}} \]
      3. add-cube-cbrt9.7%

        \[\leadsto \left(-\color{blue}{\left(\sqrt[3]{\frac{1}{\sqrt{x + 1}}} \cdot \sqrt[3]{\frac{1}{\sqrt{x + 1}}}\right) \cdot \sqrt[3]{\frac{1}{\sqrt{x + 1}}}}\right) + \frac{1}{\sqrt{x}} \]
      4. distribute-lft-neg-in9.7%

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

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{1}{x}} + -1 \cdot \sqrt{\frac{1}{x}}} \]
    6. Step-by-step derivation
      1. distribute-rgt1-in34.7%

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

        \[\leadsto \color{blue}{0} \cdot \sqrt{\frac{1}{x}} \]
      3. mul0-lft34.7%

        \[\leadsto \color{blue}{0} \]
    7. Simplified34.7%

      \[\leadsto \color{blue}{0} \]
    8. Add Preprocessing

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

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

    Developer Target 2: 39.8% accurate, 1.0× speedup?

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

    Reproduce

    ?
    herbie shell --seed 2024170 
    (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))))))
    
      :alt
      (! :herbie-platform default (- (pow x -1/2) (pow (+ x 1) -1/2)))
    
      (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))