2isqrt (example 3.6)

Percentage Accurate: 69.3% → 99.7%
Time: 11.6s
Alternatives: 13
Speedup: 1.0×

Specification

?
\[\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 13 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: 69.3% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 90000:\\ \;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\sqrt{1 + x} + \sqrt{x}}}{x + 0.5}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 90000.0)
   (- (pow x -0.5) (pow (+ 1.0 x) -0.5))
   (/ (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))) (+ x 0.5))))
double code(double x) {
	double tmp;
	if (x <= 90000.0) {
		tmp = pow(x, -0.5) - pow((1.0 + x), -0.5);
	} else {
		tmp = (1.0 / (sqrt((1.0 + x)) + sqrt(x))) / (x + 0.5);
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 90000.0d0) then
        tmp = (x ** (-0.5d0)) - ((1.0d0 + x) ** (-0.5d0))
    else
        tmp = (1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))) / (x + 0.5d0)
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 90000.0) {
		tmp = Math.pow(x, -0.5) - Math.pow((1.0 + x), -0.5);
	} else {
		tmp = (1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x))) / (x + 0.5);
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 90000.0:
		tmp = math.pow(x, -0.5) - math.pow((1.0 + x), -0.5)
	else:
		tmp = (1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))) / (x + 0.5)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 90000.0)
		tmp = Float64((x ^ -0.5) - (Float64(1.0 + x) ^ -0.5));
	else
		tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) / Float64(x + 0.5));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 90000.0)
		tmp = (x ^ -0.5) - ((1.0 + x) ^ -0.5);
	else
		tmp = (1.0 / (sqrt((1.0 + x)) + sqrt(x))) / (x + 0.5);
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 90000.0], N[(N[Power[x, -0.5], $MachinePrecision] - N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 90000:\\
\;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\sqrt{1 + x} + \sqrt{x}}}{x + 0.5}\\


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

    1. Initial program 99.5%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity99.5%

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

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\frac{\sqrt{x + 1}}{1}}} \]
      3. associate-/r/99.5%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)} \]
    4. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{{x}^{-0.5} - \left({\left(1 + x\right)}^{-0.5} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)} \]
      2. expm1-log1p99.9%

        \[\leadsto {x}^{-0.5} - \left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
      3. expm1-def99.9%

        \[\leadsto {x}^{-0.5} - \left(\color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - 1\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
      4. associate--l-99.9%

        \[\leadsto {x}^{-0.5} - \color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)\right)} \]
      5. fma-udef99.9%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)}\right)\right) \]
      6. distribute-lft1-in99.9%

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

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0} \cdot {\left(1 + x\right)}^{-0.5}\right)\right) \]
      8. mul0-lft99.9%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0}\right)\right) \]
      9. metadata-eval99.9%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \color{blue}{1}\right) \]
      10. expm1-def99.9%

        \[\leadsto {x}^{-0.5} - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} \]
      11. expm1-log1p100.0%

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

      \[\leadsto \color{blue}{{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}} \]

    if 9e4 < x

    1. Initial program 37.2%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{0.5 + x}} \]
    5. Step-by-step derivation
      1. +-commutative37.4%

        \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{x + 0.5}} \]
    6. Simplified37.4%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{x + 0.5}} \]
    7. Step-by-step derivation
      1. flip--38.1%

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

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

        \[\leadsto \frac{\frac{\left(1 + x\right) - \color{blue}{x}}{\sqrt{1 + x} + \sqrt{x}}}{x + 0.5} \]
    8. Applied egg-rr38.1%

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

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

        \[\leadsto \frac{\frac{1 + \color{blue}{0}}{\sqrt{1 + x} + \sqrt{x}}}{x + 0.5} \]
      3. metadata-eval99.7%

        \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{1 + x} + \sqrt{x}}}{x + 0.5} \]
      4. +-commutative99.7%

        \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{x} + \sqrt{1 + x}}}}{x + 0.5} \]
    10. Simplified99.7%

      \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt{x} + \sqrt{1 + x}}}}{x + 0.5} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 90000:\\ \;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\sqrt{1 + x} + \sqrt{x}}}{x + 0.5}\\ \end{array} \]

Alternative 2: 99.6% accurate, 0.5× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Step-by-step derivation
    1. inv-pow69.8%

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

      \[\leadsto {\color{blue}{\left(\left(\sqrt[3]{\sqrt{x}} \cdot \sqrt[3]{\sqrt{x}}\right) \cdot \sqrt[3]{\sqrt{x}}\right)}}^{-1} - \frac{1}{\sqrt{x + 1}} \]
    3. unpow-prod-down57.1%

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

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

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

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

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

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

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

      \[\leadsto {\left(\sqrt[3]{\sqrt{x}} \cdot \sqrt[3]{\sqrt{x}}\right)}^{-1} \cdot {\left(\sqrt[3]{\sqrt{x}}\right)}^{-1} - -1 \cdot \left(-\color{blue}{\frac{1}{\sqrt{x + 1}}}\right) \]
    11. prod-diff53.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left({\left(\sqrt[3]{\sqrt{x}} \cdot \sqrt[3]{\sqrt{x}}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{x}}\right)}^{-1}, -\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)} \]
  3. Applied egg-rr53.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left({\left(\sqrt[3]{x}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{x}}\right)}^{-1}, -\frac{-1}{\sqrt{1 + x}} \cdot -1\right) + \mathsf{fma}\left(-\frac{-1}{\sqrt{1 + x}}, -1, \frac{-1}{\sqrt{1 + x}} \cdot -1\right)} \]
  4. Step-by-step derivation
    1. +-commutative53.9%

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

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

      \[\leadsto \left(\color{blue}{\left(-\frac{-1}{\sqrt{1 + x}} \cdot -1\right)} + \frac{-1}{\sqrt{1 + x}} \cdot -1\right) + \mathsf{fma}\left({\left(\sqrt[3]{x}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{x}}\right)}^{-1}, -\frac{-1}{\sqrt{1 + x}} \cdot -1\right) \]
    4. distribute-rgt-neg-in53.9%

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

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

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

      \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot \color{blue}{0} + \mathsf{fma}\left({\left(\sqrt[3]{x}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{x}}\right)}^{-1}, -\frac{-1}{\sqrt{1 + x}} \cdot -1\right) \]
    8. distribute-rgt-neg-in53.9%

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

      \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot 0 + \mathsf{fma}\left({\left(\sqrt[3]{x}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{x}}\right)}^{-1}, \frac{-1}{\sqrt{1 + x}} \cdot \color{blue}{1}\right) \]
    10. unpow-153.9%

      \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot 0 + \mathsf{fma}\left(\color{blue}{\frac{1}{\sqrt[3]{x}}}, {\left(\sqrt[3]{\sqrt{x}}\right)}^{-1}, \frac{-1}{\sqrt{1 + x}} \cdot 1\right) \]
    11. unpow-153.9%

      \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot 0 + \mathsf{fma}\left(\frac{1}{\sqrt[3]{x}}, \color{blue}{\frac{1}{\sqrt[3]{\sqrt{x}}}}, \frac{-1}{\sqrt{1 + x}} \cdot 1\right) \]
    12. *-rgt-identity53.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot 0 + \frac{\left(1 + x\right) - \color{blue}{x}}{x \cdot \frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{1 + x}}} \]
    5. associate-/r/70.1%

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

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

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

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

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

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

    \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot 0 + \color{blue}{\frac{1}{\left({x}^{0.5} + {\left(1 + x\right)}^{-0.5} \cdot x\right) \cdot \left(1 + x\right)}} \]
  13. Step-by-step derivation
    1. expm1-log1p-u95.0%

      \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot 0 + \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\left({x}^{0.5} + {\left(1 + x\right)}^{-0.5} \cdot x\right) \cdot \left(1 + x\right)}\right)\right)} \]
    2. expm1-udef65.9%

      \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot 0 + \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{1}{\left({x}^{0.5} + {\left(1 + x\right)}^{-0.5} \cdot x\right) \cdot \left(1 + x\right)}\right)} - 1\right)} \]
    3. *-commutative65.9%

      \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot 0 + \left(e^{\mathsf{log1p}\left(\frac{1}{\color{blue}{\left(1 + x\right) \cdot \left({x}^{0.5} + {\left(1 + x\right)}^{-0.5} \cdot x\right)}}\right)} - 1\right) \]
    4. pow1/265.9%

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

      \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot 0 + \left(e^{\mathsf{log1p}\left(\frac{1}{\left(1 + x\right) \cdot \color{blue}{\left({\left(1 + x\right)}^{-0.5} \cdot x + \sqrt{x}\right)}}\right)} - 1\right) \]
    6. *-commutative65.9%

      \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot 0 + \left(e^{\mathsf{log1p}\left(\frac{1}{\left(1 + x\right) \cdot \left(\color{blue}{x \cdot {\left(1 + x\right)}^{-0.5}} + \sqrt{x}\right)}\right)} - 1\right) \]
    7. fma-def65.9%

      \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot 0 + \left(e^{\mathsf{log1p}\left(\frac{1}{\left(1 + x\right) \cdot \color{blue}{\mathsf{fma}\left(x, {\left(1 + x\right)}^{-0.5}, \sqrt{x}\right)}}\right)} - 1\right) \]
  14. Applied egg-rr65.9%

    \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot 0 + \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{1}{\left(1 + x\right) \cdot \mathsf{fma}\left(x, {\left(1 + x\right)}^{-0.5}, \sqrt{x}\right)}\right)} - 1\right)} \]
  15. Step-by-step derivation
    1. expm1-def95.0%

      \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot 0 + \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\left(1 + x\right) \cdot \mathsf{fma}\left(x, {\left(1 + x\right)}^{-0.5}, \sqrt{x}\right)}\right)\right)} \]
    2. expm1-log1p98.7%

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

      \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot 0 + \frac{1}{\color{blue}{\mathsf{fma}\left(x, {\left(1 + x\right)}^{-0.5}, \sqrt{x}\right) \cdot \left(1 + x\right)}} \]
    4. associate-/r*99.6%

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

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

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

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

    \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot 0 + \frac{\frac{1}{\mathsf{fma}\left(x, {\left(1 + x\right)}^{-0.5}, \sqrt{x}\right)}}{1 + x} \]

Alternative 3: 99.0% accurate, 1.0× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Step-by-step derivation
    1. inv-pow69.8%

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

      \[\leadsto {\color{blue}{\left(\left(\sqrt[3]{\sqrt{x}} \cdot \sqrt[3]{\sqrt{x}}\right) \cdot \sqrt[3]{\sqrt{x}}\right)}}^{-1} - \frac{1}{\sqrt{x + 1}} \]
    3. unpow-prod-down57.1%

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

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

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

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

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

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

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

      \[\leadsto {\left(\sqrt[3]{\sqrt{x}} \cdot \sqrt[3]{\sqrt{x}}\right)}^{-1} \cdot {\left(\sqrt[3]{\sqrt{x}}\right)}^{-1} - -1 \cdot \left(-\color{blue}{\frac{1}{\sqrt{x + 1}}}\right) \]
    11. prod-diff53.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left({\left(\sqrt[3]{\sqrt{x}} \cdot \sqrt[3]{\sqrt{x}}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{x}}\right)}^{-1}, -\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)} \]
  3. Applied egg-rr53.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left({\left(\sqrt[3]{x}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{x}}\right)}^{-1}, -\frac{-1}{\sqrt{1 + x}} \cdot -1\right) + \mathsf{fma}\left(-\frac{-1}{\sqrt{1 + x}}, -1, \frac{-1}{\sqrt{1 + x}} \cdot -1\right)} \]
  4. Step-by-step derivation
    1. +-commutative53.9%

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

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

      \[\leadsto \left(\color{blue}{\left(-\frac{-1}{\sqrt{1 + x}} \cdot -1\right)} + \frac{-1}{\sqrt{1 + x}} \cdot -1\right) + \mathsf{fma}\left({\left(\sqrt[3]{x}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{x}}\right)}^{-1}, -\frac{-1}{\sqrt{1 + x}} \cdot -1\right) \]
    4. distribute-rgt-neg-in53.9%

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

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

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

      \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot \color{blue}{0} + \mathsf{fma}\left({\left(\sqrt[3]{x}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{x}}\right)}^{-1}, -\frac{-1}{\sqrt{1 + x}} \cdot -1\right) \]
    8. distribute-rgt-neg-in53.9%

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

      \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot 0 + \mathsf{fma}\left({\left(\sqrt[3]{x}\right)}^{-1}, {\left(\sqrt[3]{\sqrt{x}}\right)}^{-1}, \frac{-1}{\sqrt{1 + x}} \cdot \color{blue}{1}\right) \]
    10. unpow-153.9%

      \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot 0 + \mathsf{fma}\left(\color{blue}{\frac{1}{\sqrt[3]{x}}}, {\left(\sqrt[3]{\sqrt{x}}\right)}^{-1}, \frac{-1}{\sqrt{1 + x}} \cdot 1\right) \]
    11. unpow-153.9%

      \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot 0 + \mathsf{fma}\left(\frac{1}{\sqrt[3]{x}}, \color{blue}{\frac{1}{\sqrt[3]{\sqrt{x}}}}, \frac{-1}{\sqrt{1 + x}} \cdot 1\right) \]
    12. *-rgt-identity53.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1}{\sqrt{1 + x}} \cdot 0 + \frac{\left(1 + x\right) - \color{blue}{x}}{x \cdot \frac{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}{\frac{1}{1 + x}}} \]
    5. associate-/r/70.1%

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{\left(1 + x\right) \cdot \left({x}^{0.5} + x \cdot {\left(1 + x\right)}^{-0.5}\right)} \]

Alternative 4: 83.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 112000000:\\ \;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 112000000.0)
   (- (pow x -0.5) (pow (+ 1.0 x) -0.5))
   (* 0.5 (sqrt (/ 1.0 (pow x 3.0))))))
double code(double x) {
	double tmp;
	if (x <= 112000000.0) {
		tmp = pow(x, -0.5) - pow((1.0 + x), -0.5);
	} else {
		tmp = 0.5 * sqrt((1.0 / pow(x, 3.0)));
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 112000000.0d0) then
        tmp = (x ** (-0.5d0)) - ((1.0d0 + x) ** (-0.5d0))
    else
        tmp = 0.5d0 * sqrt((1.0d0 / (x ** 3.0d0)))
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 112000000.0) {
		tmp = Math.pow(x, -0.5) - Math.pow((1.0 + x), -0.5);
	} else {
		tmp = 0.5 * Math.sqrt((1.0 / Math.pow(x, 3.0)));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 112000000.0:
		tmp = math.pow(x, -0.5) - math.pow((1.0 + x), -0.5)
	else:
		tmp = 0.5 * math.sqrt((1.0 / math.pow(x, 3.0)))
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 112000000.0)
		tmp = Float64((x ^ -0.5) - (Float64(1.0 + x) ^ -0.5));
	else
		tmp = Float64(0.5 * sqrt(Float64(1.0 / (x ^ 3.0))));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 112000000.0)
		tmp = (x ^ -0.5) - ((1.0 + x) ^ -0.5);
	else
		tmp = 0.5 * sqrt((1.0 / (x ^ 3.0)));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 112000000.0], N[(N[Power[x, -0.5], $MachinePrecision] - N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(1.0 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 112000000:\\
\;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\\


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

    1. Initial program 99.3%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity99.3%

        \[\leadsto \color{blue}{1 \cdot \frac{1}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
      2. clear-num99.3%

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\frac{\sqrt{x + 1}}{1}}} \]
      3. associate-/r/99.3%

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

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

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

        \[\leadsto \color{blue}{\left(1 \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\right)} + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
      7. *-un-lft-identity99.3%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)} \]
    4. Step-by-step derivation
      1. associate-+l-99.7%

        \[\leadsto \color{blue}{{x}^{-0.5} - \left({\left(1 + x\right)}^{-0.5} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)} \]
      2. expm1-log1p99.6%

        \[\leadsto {x}^{-0.5} - \left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
      3. expm1-def99.5%

        \[\leadsto {x}^{-0.5} - \left(\color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - 1\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
      4. associate--l-99.5%

        \[\leadsto {x}^{-0.5} - \color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)\right)} \]
      5. fma-udef99.5%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)}\right)\right) \]
      6. distribute-lft1-in99.5%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 + 1\right) \cdot {\left(1 + x\right)}^{-0.5}}\right)\right) \]
      7. metadata-eval99.5%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0} \cdot {\left(1 + x\right)}^{-0.5}\right)\right) \]
      8. mul0-lft99.5%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0}\right)\right) \]
      9. metadata-eval99.5%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \color{blue}{1}\right) \]
      10. expm1-def99.6%

        \[\leadsto {x}^{-0.5} - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} \]
      11. expm1-log1p99.7%

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

      \[\leadsto \color{blue}{{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}} \]

    if 1.12e8 < x

    1. Initial program 37.0%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity37.0%

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

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\frac{\sqrt{x + 1}}{1}}} \]
      3. associate-/r/37.0%

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]
      4. prod-diff37.0%

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

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

        \[\leadsto \color{blue}{\left(1 \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\right)} + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
      7. *-un-lft-identity37.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)} \]
    4. Step-by-step derivation
      1. associate-+l-37.1%

        \[\leadsto \color{blue}{{x}^{-0.5} - \left({\left(1 + x\right)}^{-0.5} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)} \]
      2. expm1-log1p37.1%

        \[\leadsto {x}^{-0.5} - \left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
      3. expm1-def5.2%

        \[\leadsto {x}^{-0.5} - \left(\color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - 1\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
      4. associate--l-5.2%

        \[\leadsto {x}^{-0.5} - \color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)\right)} \]
      5. fma-udef5.2%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)}\right)\right) \]
      6. distribute-lft1-in5.2%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 + 1\right) \cdot {\left(1 + x\right)}^{-0.5}}\right)\right) \]
      7. metadata-eval5.2%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0} \cdot {\left(1 + x\right)}^{-0.5}\right)\right) \]
      8. mul0-lft5.2%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0}\right)\right) \]
      9. metadata-eval5.2%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \color{blue}{1}\right) \]
      10. expm1-def37.1%

        \[\leadsto {x}^{-0.5} - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} \]
      11. expm1-log1p37.1%

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

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

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification81.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 112000000:\\ \;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\\ \end{array} \]

Alternative 5: 82.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\\


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

    1. Initial program 99.6%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity99.6%

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

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\frac{\sqrt{x + 1}}{1}}} \]
      3. associate-/r/99.6%

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

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

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

        \[\leadsto \color{blue}{\left(1 \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\right)} + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
      7. *-un-lft-identity99.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)} \]
    4. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{{x}^{-0.5} - \left({\left(1 + x\right)}^{-0.5} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)} \]
      2. expm1-log1p100.0%

        \[\leadsto {x}^{-0.5} - \left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
      3. expm1-def100.0%

        \[\leadsto {x}^{-0.5} - \left(\color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - 1\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
      4. associate--l-100.0%

        \[\leadsto {x}^{-0.5} - \color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)\right)} \]
      5. fma-udef100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)}\right)\right) \]
      6. distribute-lft1-in100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 + 1\right) \cdot {\left(1 + x\right)}^{-0.5}}\right)\right) \]
      7. metadata-eval100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0} \cdot {\left(1 + x\right)}^{-0.5}\right)\right) \]
      8. mul0-lft100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0}\right)\right) \]
      9. metadata-eval100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \color{blue}{1}\right) \]
      10. expm1-def100.0%

        \[\leadsto {x}^{-0.5} - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} \]
      11. expm1-log1p100.0%

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

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

      \[\leadsto \color{blue}{\left(0.5 \cdot x + {x}^{-0.5}\right) - 1} \]

    if 1 < x

    1. Initial program 38.2%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity38.2%

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

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\frac{\sqrt{x + 1}}{1}}} \]
      3. associate-/r/38.2%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(1, \frac{1}{\sqrt{x}}, -1 \cdot \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right)} \]
      5. *-un-lft-identity38.2%

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

        \[\leadsto \color{blue}{\left(1 \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\right)} + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
      7. *-un-lft-identity38.2%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)} \]
    4. Step-by-step derivation
      1. associate-+l-38.2%

        \[\leadsto \color{blue}{{x}^{-0.5} - \left({\left(1 + x\right)}^{-0.5} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)} \]
      2. expm1-log1p38.2%

        \[\leadsto {x}^{-0.5} - \left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
      3. expm1-def6.9%

        \[\leadsto {x}^{-0.5} - \left(\color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - 1\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
      4. associate--l-6.9%

        \[\leadsto {x}^{-0.5} - \color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)\right)} \]
      5. fma-udef6.9%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)}\right)\right) \]
      6. distribute-lft1-in6.9%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 + 1\right) \cdot {\left(1 + x\right)}^{-0.5}}\right)\right) \]
      7. metadata-eval6.9%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0} \cdot {\left(1 + x\right)}^{-0.5}\right)\right) \]
      8. mul0-lft6.9%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0}\right)\right) \]
      9. metadata-eval6.9%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \color{blue}{1}\right) \]
      10. expm1-def38.2%

        \[\leadsto {x}^{-0.5} - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} \]
      11. expm1-log1p38.2%

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

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

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification80.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{{x}^{3}}}\\ \end{array} \]

Alternative 6: 68.6% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x \cdot \left(1 + x\right)}}\\


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

    1. Initial program 99.6%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity99.6%

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

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\frac{\sqrt{x + 1}}{1}}} \]
      3. associate-/r/99.6%

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

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

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

        \[\leadsto \color{blue}{\left(1 \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\right)} + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
      7. *-un-lft-identity99.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)} \]
    4. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{{x}^{-0.5} - \left({\left(1 + x\right)}^{-0.5} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)} \]
      2. expm1-log1p100.0%

        \[\leadsto {x}^{-0.5} - \left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
      3. expm1-def100.0%

        \[\leadsto {x}^{-0.5} - \left(\color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - 1\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
      4. associate--l-100.0%

        \[\leadsto {x}^{-0.5} - \color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)\right)} \]
      5. fma-udef100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)}\right)\right) \]
      6. distribute-lft1-in100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 + 1\right) \cdot {\left(1 + x\right)}^{-0.5}}\right)\right) \]
      7. metadata-eval100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0} \cdot {\left(1 + x\right)}^{-0.5}\right)\right) \]
      8. mul0-lft100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0}\right)\right) \]
      9. metadata-eval100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \color{blue}{1}\right) \]
      10. expm1-def100.0%

        \[\leadsto {x}^{-0.5} - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} \]
      11. expm1-log1p100.0%

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

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

      \[\leadsto \color{blue}{\left(0.5 \cdot x + {x}^{-0.5}\right) - 1} \]

    if 1.3999999999999999 < x

    1. Initial program 38.2%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. frac-sub38.4%

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{1}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification69.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.4:\\ \;\;\;\;\left({x}^{-0.5} + x \cdot 0.5\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x \cdot \left(1 + x\right)}}\\ \end{array} \]

Alternative 7: 68.2% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.7:\\
\;\;\;\;{x}^{-0.5} + -1\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{x \cdot \left(1 + x\right)}}\\


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

    1. Initial program 99.6%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity99.6%

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

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\frac{\sqrt{x + 1}}{1}}} \]
      3. associate-/r/99.6%

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

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

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

        \[\leadsto \color{blue}{\left(1 \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\right)} + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
      7. *-un-lft-identity99.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)} \]
    4. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{{x}^{-0.5} - \left({\left(1 + x\right)}^{-0.5} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)} \]
      2. expm1-log1p100.0%

        \[\leadsto {x}^{-0.5} - \left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
      3. expm1-def100.0%

        \[\leadsto {x}^{-0.5} - \left(\color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - 1\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
      4. associate--l-100.0%

        \[\leadsto {x}^{-0.5} - \color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)\right)} \]
      5. fma-udef100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)}\right)\right) \]
      6. distribute-lft1-in100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 + 1\right) \cdot {\left(1 + x\right)}^{-0.5}}\right)\right) \]
      7. metadata-eval100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0} \cdot {\left(1 + x\right)}^{-0.5}\right)\right) \]
      8. mul0-lft100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0}\right)\right) \]
      9. metadata-eval100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \color{blue}{1}\right) \]
      10. expm1-def100.0%

        \[\leadsto {x}^{-0.5} - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} \]
      11. expm1-log1p100.0%

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

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

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

    if 0.69999999999999996 < x

    1. Initial program 38.2%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. frac-sub38.4%

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{1}}{\sqrt{x \cdot \left(1 + x\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification69.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.7:\\ \;\;\;\;{x}^{-0.5} + -1\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{x \cdot \left(1 + x\right)}}\\ \end{array} \]

Alternative 8: 53.2% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.6:\\
\;\;\;\;{x}^{-0.5} + -1\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{x + 0.5}\\


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

    1. Initial program 99.6%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. *-un-lft-identity99.6%

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

        \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\frac{\sqrt{x + 1}}{1}}} \]
      3. associate-/r/99.6%

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

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

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

        \[\leadsto \color{blue}{\left(1 \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\right)} + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
      7. *-un-lft-identity99.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)} \]
    4. Step-by-step derivation
      1. associate-+l-100.0%

        \[\leadsto \color{blue}{{x}^{-0.5} - \left({\left(1 + x\right)}^{-0.5} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)} \]
      2. expm1-log1p100.0%

        \[\leadsto {x}^{-0.5} - \left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
      3. expm1-def100.0%

        \[\leadsto {x}^{-0.5} - \left(\color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - 1\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
      4. associate--l-100.0%

        \[\leadsto {x}^{-0.5} - \color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)\right)} \]
      5. fma-udef100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)}\right)\right) \]
      6. distribute-lft1-in100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 + 1\right) \cdot {\left(1 + x\right)}^{-0.5}}\right)\right) \]
      7. metadata-eval100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0} \cdot {\left(1 + x\right)}^{-0.5}\right)\right) \]
      8. mul0-lft100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0}\right)\right) \]
      9. metadata-eval100.0%

        \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \color{blue}{1}\right) \]
      10. expm1-def100.0%

        \[\leadsto {x}^{-0.5} - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} \]
      11. expm1-log1p100.0%

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

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

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

    if 0.599999999999999978 < x

    1. Initial program 38.2%

      \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
    2. Step-by-step derivation
      1. frac-sub38.4%

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

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{0.5 + x}} \]
    5. Step-by-step derivation
      1. +-commutative37.3%

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

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{x + 0.5}} \]
    7. Taylor expanded in x around 0 7.6%

      \[\leadsto \frac{\color{blue}{1}}{x + 0.5} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification54.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.6:\\ \;\;\;\;{x}^{-0.5} + -1\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x + 0.5}\\ \end{array} \]

Alternative 9: 66.1% accurate, 2.0× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Step-by-step derivation
    1. *-un-lft-identity69.8%

      \[\leadsto \color{blue}{1 \cdot \frac{1}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
    2. clear-num69.8%

      \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\frac{\sqrt{x + 1}}{1}}} \]
    3. associate-/r/69.8%

      \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]
    4. prod-diff69.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(1, \frac{1}{\sqrt{x}}, -1 \cdot \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right)} \]
    5. *-un-lft-identity69.8%

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

      \[\leadsto \color{blue}{\left(1 \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\right)} + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
    7. *-un-lft-identity69.8%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)} \]
  4. Step-by-step derivation
    1. associate-+l-70.1%

      \[\leadsto \color{blue}{{x}^{-0.5} - \left({\left(1 + x\right)}^{-0.5} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)} \]
    2. expm1-log1p70.1%

      \[\leadsto {x}^{-0.5} - \left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
    3. expm1-def54.9%

      \[\leadsto {x}^{-0.5} - \left(\color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - 1\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
    4. associate--l-54.9%

      \[\leadsto {x}^{-0.5} - \color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)\right)} \]
    5. fma-udef54.9%

      \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)}\right)\right) \]
    6. distribute-lft1-in54.9%

      \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 + 1\right) \cdot {\left(1 + x\right)}^{-0.5}}\right)\right) \]
    7. metadata-eval54.9%

      \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0} \cdot {\left(1 + x\right)}^{-0.5}\right)\right) \]
    8. mul0-lft54.9%

      \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0}\right)\right) \]
    9. metadata-eval54.9%

      \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \color{blue}{1}\right) \]
    10. expm1-def70.1%

      \[\leadsto {x}^{-0.5} - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} \]
    11. expm1-log1p70.1%

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

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

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \]
  10. Step-by-step derivation
    1. inv-pow52.2%

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

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

      \[\leadsto {x}^{\color{blue}{-0.5}} \]
    4. expm1-log1p-u48.5%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({x}^{-0.5}\right)\right)} \]
    5. expm1-udef63.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left({x}^{-0.5}\right)} - 1} \]
    6. log1p-udef63.6%

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

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

    \[\leadsto \color{blue}{\left(1 + {x}^{-0.5}\right) - 1} \]
  12. Final simplification67.4%

    \[\leadsto \left(1 + {x}^{-0.5}\right) + -1 \]

Alternative 10: 52.6% accurate, 2.0× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Step-by-step derivation
    1. *-un-lft-identity69.8%

      \[\leadsto \color{blue}{1 \cdot \frac{1}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
    2. clear-num69.8%

      \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\frac{\sqrt{x + 1}}{1}}} \]
    3. associate-/r/69.8%

      \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]
    4. prod-diff69.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(1, \frac{1}{\sqrt{x}}, -1 \cdot \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right)} \]
    5. *-un-lft-identity69.8%

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

      \[\leadsto \color{blue}{\left(1 \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\right)} + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
    7. *-un-lft-identity69.8%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)} \]
  4. Step-by-step derivation
    1. associate-+l-70.1%

      \[\leadsto \color{blue}{{x}^{-0.5} - \left({\left(1 + x\right)}^{-0.5} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)} \]
    2. expm1-log1p70.1%

      \[\leadsto {x}^{-0.5} - \left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
    3. expm1-def54.9%

      \[\leadsto {x}^{-0.5} - \left(\color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - 1\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
    4. associate--l-54.9%

      \[\leadsto {x}^{-0.5} - \color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)\right)} \]
    5. fma-udef54.9%

      \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)}\right)\right) \]
    6. distribute-lft1-in54.9%

      \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 + 1\right) \cdot {\left(1 + x\right)}^{-0.5}}\right)\right) \]
    7. metadata-eval54.9%

      \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0} \cdot {\left(1 + x\right)}^{-0.5}\right)\right) \]
    8. mul0-lft54.9%

      \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0}\right)\right) \]
    9. metadata-eval54.9%

      \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \color{blue}{1}\right) \]
    10. expm1-def70.1%

      \[\leadsto {x}^{-0.5} - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} \]
    11. expm1-log1p70.1%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{x}}{1 + {x}^{-0.5}}} \]
  11. Simplified53.9%

    \[\leadsto \color{blue}{\frac{\frac{1}{x}}{1 + {x}^{-0.5}}} \]
  12. Taylor expanded in x around 0 53.9%

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

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

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

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

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

      \[\leadsto \frac{1}{x + \color{blue}{\sqrt{x}}} \]
  14. Simplified54.1%

    \[\leadsto \color{blue}{\frac{1}{x + \sqrt{x}}} \]
  15. Final simplification54.1%

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

Alternative 11: 50.7% accurate, 2.0× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Step-by-step derivation
    1. *-un-lft-identity69.8%

      \[\leadsto \color{blue}{1 \cdot \frac{1}{\sqrt{x}}} - \frac{1}{\sqrt{x + 1}} \]
    2. clear-num69.8%

      \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\frac{\sqrt{x + 1}}{1}}} \]
    3. associate-/r/69.8%

      \[\leadsto 1 \cdot \frac{1}{\sqrt{x}} - \color{blue}{\frac{1}{\sqrt{x + 1}} \cdot 1} \]
    4. prod-diff69.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(1, \frac{1}{\sqrt{x}}, -1 \cdot \frac{1}{\sqrt{x + 1}}\right) + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right)} \]
    5. *-un-lft-identity69.8%

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

      \[\leadsto \color{blue}{\left(1 \cdot \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\right)} + \mathsf{fma}\left(-1, \frac{1}{\sqrt{x + 1}}, 1 \cdot \frac{1}{\sqrt{x + 1}}\right) \]
    7. *-un-lft-identity69.8%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left({x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\right) + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)} \]
  4. Step-by-step derivation
    1. associate-+l-70.1%

      \[\leadsto \color{blue}{{x}^{-0.5} - \left({\left(1 + x\right)}^{-0.5} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)} \]
    2. expm1-log1p70.1%

      \[\leadsto {x}^{-0.5} - \left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
    3. expm1-def54.9%

      \[\leadsto {x}^{-0.5} - \left(\color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - 1\right)} - \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right) \]
    4. associate--l-54.9%

      \[\leadsto {x}^{-0.5} - \color{blue}{\left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \mathsf{fma}\left(-1, {\left(1 + x\right)}^{-0.5}, {\left(1 + x\right)}^{-0.5}\right)\right)\right)} \]
    5. fma-udef54.9%

      \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 \cdot {\left(1 + x\right)}^{-0.5} + {\left(1 + x\right)}^{-0.5}\right)}\right)\right) \]
    6. distribute-lft1-in54.9%

      \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{\left(-1 + 1\right) \cdot {\left(1 + x\right)}^{-0.5}}\right)\right) \]
    7. metadata-eval54.9%

      \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0} \cdot {\left(1 + x\right)}^{-0.5}\right)\right) \]
    8. mul0-lft54.9%

      \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \left(1 + \color{blue}{0}\right)\right) \]
    9. metadata-eval54.9%

      \[\leadsto {x}^{-0.5} - \left(e^{\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)} - \color{blue}{1}\right) \]
    10. expm1-def70.1%

      \[\leadsto {x}^{-0.5} - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(1 + x\right)}^{-0.5}\right)\right)} \]
    11. expm1-log1p70.1%

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

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

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{\frac{1}{x}}} \]
  10. Step-by-step derivation
    1. inv-pow52.2%

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

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

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

      \[\leadsto \color{blue}{1 \cdot {x}^{-0.5}} \]
  11. Applied egg-rr52.3%

    \[\leadsto \color{blue}{1 \cdot {x}^{-0.5}} \]
  12. Step-by-step derivation
    1. *-lft-identity52.3%

      \[\leadsto \color{blue}{{x}^{-0.5}} \]
  13. Simplified52.3%

    \[\leadsto \color{blue}{{x}^{-0.5}} \]
  14. Final simplification52.3%

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

Alternative 12: 7.4% accurate, 41.8× speedup?

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

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

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Step-by-step derivation
    1. frac-sub69.9%

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

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

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

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

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

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

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

    \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{0.5 + x}} \]
  5. Step-by-step derivation
    1. +-commutative21.6%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{x + 0.5}} \]
  6. Simplified21.6%

    \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{x + 0.5}} \]
  7. Taylor expanded in x around 0 7.3%

    \[\leadsto \frac{\color{blue}{1}}{x + 0.5} \]
  8. Final simplification7.3%

    \[\leadsto \frac{1}{x + 0.5} \]

Alternative 13: 5.8% accurate, 209.0× speedup?

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

\\
2
\end{array}
Derivation
  1. Initial program 69.8%

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \]
  2. Step-by-step derivation
    1. frac-sub69.9%

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

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

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

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

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

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

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

    \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{0.5 + x}} \]
  5. Step-by-step derivation
    1. +-commutative21.6%

      \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{x + 0.5}} \]
  6. Simplified21.6%

    \[\leadsto \frac{\sqrt{1 + x} - \sqrt{x}}{\color{blue}{x + 0.5}} \]
  7. Taylor expanded in x around 0 5.8%

    \[\leadsto \color{blue}{2} \]
  8. Final simplification5.8%

    \[\leadsto 2 \]

Developer target: 99.1% accurate, 1.0× speedup?

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

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

Reproduce

?
herbie shell --seed 2023318 
(FPCore (x)
  :name "2isqrt (example 3.6)"
  :precision binary64

  :herbie-target
  (/ 1.0 (+ (* (+ x 1.0) (sqrt x)) (* x (sqrt (+ x 1.0)))))

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