| Alternative 1 | |
|---|---|
| Accuracy | 99.7% |
| Cost | 34244 |
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
(FPCore (x)
:precision binary64
(let* ((t_0 (/ x (+ 1.0 x))) (t_1 (pow t_0 0.75)))
(if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 (sqrt (+ 1.0 x)))) 2e-7)
(*
(+
(/ 0.5 x)
(-
(/ 0.3125 (pow x 3.0))
(+ (/ 0.375 (* x x)) (/ 0.2734375 (pow x 4.0)))))
(pow x -0.5))
(* (pow x -0.5) (/ (fma t_1 (- t_1) 1.0) (+ 1.0 (+ t_0 (sqrt t_0))))))))double code(double x) {
return (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
}
double code(double x) {
double t_0 = x / (1.0 + x);
double t_1 = pow(t_0, 0.75);
double tmp;
if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 2e-7) {
tmp = ((0.5 / x) + ((0.3125 / pow(x, 3.0)) - ((0.375 / (x * x)) + (0.2734375 / pow(x, 4.0))))) * pow(x, -0.5);
} else {
tmp = pow(x, -0.5) * (fma(t_1, -t_1, 1.0) / (1.0 + (t_0 + sqrt(t_0))));
}
return tmp;
}
function code(x) return Float64(Float64(1.0 / sqrt(x)) - Float64(1.0 / sqrt(Float64(x + 1.0)))) end
function code(x) t_0 = Float64(x / Float64(1.0 + x)) t_1 = t_0 ^ 0.75 tmp = 0.0 if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / sqrt(Float64(1.0 + x)))) <= 2e-7) tmp = Float64(Float64(Float64(0.5 / x) + Float64(Float64(0.3125 / (x ^ 3.0)) - Float64(Float64(0.375 / Float64(x * x)) + Float64(0.2734375 / (x ^ 4.0))))) * (x ^ -0.5)); else tmp = Float64((x ^ -0.5) * Float64(fma(t_1, Float64(-t_1), 1.0) / Float64(1.0 + Float64(t_0 + sqrt(t_0))))); end return tmp 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]
code[x_] := Block[{t$95$0 = N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[t$95$0, 0.75], $MachinePrecision]}, If[LessEqual[N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e-7], N[(N[(N[(0.5 / x), $MachinePrecision] + N[(N[(0.3125 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] - N[(N[(0.375 / N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(0.2734375 / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[x, -0.5], $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] * N[(N[(t$95$1 * (-t$95$1) + 1.0), $MachinePrecision] / N[(1.0 + N[(t$95$0 + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\begin{array}{l}
t_0 := \frac{x}{1 + x}\\
t_1 := {t_0}^{0.75}\\
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{1 + x}} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\left(\frac{0.5}{x} + \left(\frac{0.3125}{{x}^{3}} - \left(\frac{0.375}{x \cdot x} + \frac{0.2734375}{{x}^{4}}\right)\right)\right) \cdot {x}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \frac{\mathsf{fma}\left(t_1, -t_1, 1\right)}{1 + \left(t_0 + \sqrt{t_0}\right)}\\
\end{array}
| Original | 68.6% |
|---|---|
| Target | 98.9% |
| Herbie | 99.7% |
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 1.9999999999999999e-7Initial program 39.6%
Applied egg-rr39.5%
[Start]39.6 | \[ \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\] |
|---|---|
frac-sub [=>]39.5 | \[ \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}}
\] |
div-inv [=>]39.5 | \[ \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}}
\] |
*-un-lft-identity [<=]39.5 | \[ \left(\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}
\] |
+-commutative [=>]39.5 | \[ \left(\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}
\] |
*-rgt-identity [=>]39.5 | \[ \left(\sqrt{1 + x} - \color{blue}{\sqrt{x}}\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}
\] |
metadata-eval [<=]39.5 | \[ \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{\color{blue}{1 \cdot 1}}{\sqrt{x} \cdot \sqrt{x + 1}}
\] |
frac-times [<=]39.5 | \[ \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \color{blue}{\left(\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x + 1}}\right)}
\] |
un-div-inv [=>]39.5 | \[ \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \color{blue}{\frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}}}
\] |
pow1/2 [=>]39.5 | \[ \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{\frac{1}{\color{blue}{{x}^{0.5}}}}{\sqrt{x + 1}}
\] |
pow-flip [=>]39.5 | \[ \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{\color{blue}{{x}^{\left(-0.5\right)}}}{\sqrt{x + 1}}
\] |
metadata-eval [=>]39.5 | \[ \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{{x}^{\color{blue}{-0.5}}}{\sqrt{x + 1}}
\] |
+-commutative [=>]39.5 | \[ \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{{x}^{-0.5}}{\sqrt{\color{blue}{1 + x}}}
\] |
Simplified39.6%
[Start]39.5 | \[ \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{{x}^{-0.5}}{\sqrt{1 + x}}
\] |
|---|---|
associate-*r/ [=>]39.5 | \[ \color{blue}{\frac{\left(\sqrt{1 + x} - \sqrt{x}\right) \cdot {x}^{-0.5}}{\sqrt{1 + x}}}
\] |
*-rgt-identity [<=]39.5 | \[ \frac{\left(\sqrt{1 + x} - \sqrt{x}\right) \cdot {x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot 1}}
\] |
times-frac [=>]39.5 | \[ \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{1 + x}} \cdot \frac{{x}^{-0.5}}{1}}
\] |
div-sub [=>]39.6 | \[ \color{blue}{\left(\frac{\sqrt{1 + x}}{\sqrt{1 + x}} - \frac{\sqrt{x}}{\sqrt{1 + x}}\right)} \cdot \frac{{x}^{-0.5}}{1}
\] |
*-inverses [=>]39.6 | \[ \left(\color{blue}{1} - \frac{\sqrt{x}}{\sqrt{1 + x}}\right) \cdot \frac{{x}^{-0.5}}{1}
\] |
/-rgt-identity [=>]39.6 | \[ \left(1 - \frac{\sqrt{x}}{\sqrt{1 + x}}\right) \cdot \color{blue}{{x}^{-0.5}}
\] |
Applied egg-rr39.7%
[Start]39.6 | \[ \left(1 - \frac{\sqrt{x}}{\sqrt{1 + x}}\right) \cdot {x}^{-0.5}
\] |
|---|---|
flip3-- [=>]39.6 | \[ \color{blue}{\frac{{1}^{3} - {\left(\frac{\sqrt{x}}{\sqrt{1 + x}}\right)}^{3}}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}} \cdot {x}^{-0.5}
\] |
div-inv [=>]39.6 | \[ \color{blue}{\left(\left({1}^{3} - {\left(\frac{\sqrt{x}}{\sqrt{1 + x}}\right)}^{3}\right) \cdot \frac{1}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}\right)} \cdot {x}^{-0.5}
\] |
metadata-eval [=>]39.6 | \[ \left(\left(\color{blue}{1} - {\left(\frac{\sqrt{x}}{\sqrt{1 + x}}\right)}^{3}\right) \cdot \frac{1}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}\right) \cdot {x}^{-0.5}
\] |
add-sqr-sqrt [=>]39.6 | \[ \left(\left(1 - {\color{blue}{\left(\sqrt{\frac{\sqrt{x}}{\sqrt{1 + x}}} \cdot \sqrt{\frac{\sqrt{x}}{\sqrt{1 + x}}}\right)}}^{3}\right) \cdot \frac{1}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}\right) \cdot {x}^{-0.5}
\] |
sqrt-unprod [=>]39.6 | \[ \left(\left(1 - {\color{blue}{\left(\sqrt{\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}}\right)}}^{3}\right) \cdot \frac{1}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}\right) \cdot {x}^{-0.5}
\] |
sqrt-pow2 [=>]39.6 | \[ \left(\left(1 - \color{blue}{{\left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}^{\left(\frac{3}{2}\right)}}\right) \cdot \frac{1}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}\right) \cdot {x}^{-0.5}
\] |
sqrt-undiv [=>]39.6 | \[ \left(\left(1 - {\left(\color{blue}{\sqrt{\frac{x}{1 + x}}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}^{\left(\frac{3}{2}\right)}\right) \cdot \frac{1}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}\right) \cdot {x}^{-0.5}
\] |
sqrt-undiv [=>]39.7 | \[ \left(\left(1 - {\left(\sqrt{\frac{x}{1 + x}} \cdot \color{blue}{\sqrt{\frac{x}{1 + x}}}\right)}^{\left(\frac{3}{2}\right)}\right) \cdot \frac{1}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}\right) \cdot {x}^{-0.5}
\] |
add-sqr-sqrt [<=]39.7 | \[ \left(\left(1 - {\color{blue}{\left(\frac{x}{1 + x}\right)}}^{\left(\frac{3}{2}\right)}\right) \cdot \frac{1}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}\right) \cdot {x}^{-0.5}
\] |
metadata-eval [=>]39.7 | \[ \left(\left(1 - {\left(\frac{x}{1 + x}\right)}^{\color{blue}{1.5}}\right) \cdot \frac{1}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}\right) \cdot {x}^{-0.5}
\] |
Simplified39.7%
[Start]39.7 | \[ \left(\left(1 - {\left(\frac{x}{1 + x}\right)}^{1.5}\right) \cdot \frac{1}{1 + \left(\sqrt{\frac{x}{1 + x}} + \frac{x}{1 + x}\right)}\right) \cdot {x}^{-0.5}
\] |
|---|---|
associate-*r/ [=>]39.7 | \[ \color{blue}{\frac{\left(1 - {\left(\frac{x}{1 + x}\right)}^{1.5}\right) \cdot 1}{1 + \left(\sqrt{\frac{x}{1 + x}} + \frac{x}{1 + x}\right)}} \cdot {x}^{-0.5}
\] |
*-rgt-identity [=>]39.7 | \[ \frac{\color{blue}{1 - {\left(\frac{x}{1 + x}\right)}^{1.5}}}{1 + \left(\sqrt{\frac{x}{1 + x}} + \frac{x}{1 + x}\right)} \cdot {x}^{-0.5}
\] |
+-commutative [=>]39.7 | \[ \frac{1 - {\left(\frac{x}{1 + x}\right)}^{1.5}}{1 + \color{blue}{\left(\frac{x}{1 + x} + \sqrt{\frac{x}{1 + x}}\right)}} \cdot {x}^{-0.5}
\] |
Taylor expanded in x around inf 99.6%
Simplified99.6%
[Start]99.6 | \[ \left(\left(0.5 \cdot \frac{1}{x} + 0.3125 \cdot \frac{1}{{x}^{3}}\right) - \left(0.2734375 \cdot \frac{1}{{x}^{4}} + 0.375 \cdot \frac{1}{{x}^{2}}\right)\right) \cdot {x}^{-0.5}
\] |
|---|---|
associate--l+ [=>]99.6 | \[ \color{blue}{\left(0.5 \cdot \frac{1}{x} + \left(0.3125 \cdot \frac{1}{{x}^{3}} - \left(0.2734375 \cdot \frac{1}{{x}^{4}} + 0.375 \cdot \frac{1}{{x}^{2}}\right)\right)\right)} \cdot {x}^{-0.5}
\] |
associate-*r/ [=>]99.6 | \[ \left(\color{blue}{\frac{0.5 \cdot 1}{x}} + \left(0.3125 \cdot \frac{1}{{x}^{3}} - \left(0.2734375 \cdot \frac{1}{{x}^{4}} + 0.375 \cdot \frac{1}{{x}^{2}}\right)\right)\right) \cdot {x}^{-0.5}
\] |
metadata-eval [=>]99.6 | \[ \left(\frac{\color{blue}{0.5}}{x} + \left(0.3125 \cdot \frac{1}{{x}^{3}} - \left(0.2734375 \cdot \frac{1}{{x}^{4}} + 0.375 \cdot \frac{1}{{x}^{2}}\right)\right)\right) \cdot {x}^{-0.5}
\] |
associate-*r/ [=>]99.6 | \[ \left(\frac{0.5}{x} + \left(\color{blue}{\frac{0.3125 \cdot 1}{{x}^{3}}} - \left(0.2734375 \cdot \frac{1}{{x}^{4}} + 0.375 \cdot \frac{1}{{x}^{2}}\right)\right)\right) \cdot {x}^{-0.5}
\] |
metadata-eval [=>]99.6 | \[ \left(\frac{0.5}{x} + \left(\frac{\color{blue}{0.3125}}{{x}^{3}} - \left(0.2734375 \cdot \frac{1}{{x}^{4}} + 0.375 \cdot \frac{1}{{x}^{2}}\right)\right)\right) \cdot {x}^{-0.5}
\] |
+-commutative [=>]99.6 | \[ \left(\frac{0.5}{x} + \left(\frac{0.3125}{{x}^{3}} - \color{blue}{\left(0.375 \cdot \frac{1}{{x}^{2}} + 0.2734375 \cdot \frac{1}{{x}^{4}}\right)}\right)\right) \cdot {x}^{-0.5}
\] |
associate-*r/ [=>]99.6 | \[ \left(\frac{0.5}{x} + \left(\frac{0.3125}{{x}^{3}} - \left(\color{blue}{\frac{0.375 \cdot 1}{{x}^{2}}} + 0.2734375 \cdot \frac{1}{{x}^{4}}\right)\right)\right) \cdot {x}^{-0.5}
\] |
metadata-eval [=>]99.6 | \[ \left(\frac{0.5}{x} + \left(\frac{0.3125}{{x}^{3}} - \left(\frac{\color{blue}{0.375}}{{x}^{2}} + 0.2734375 \cdot \frac{1}{{x}^{4}}\right)\right)\right) \cdot {x}^{-0.5}
\] |
unpow2 [=>]99.6 | \[ \left(\frac{0.5}{x} + \left(\frac{0.3125}{{x}^{3}} - \left(\frac{0.375}{\color{blue}{x \cdot x}} + 0.2734375 \cdot \frac{1}{{x}^{4}}\right)\right)\right) \cdot {x}^{-0.5}
\] |
associate-*r/ [=>]99.6 | \[ \left(\frac{0.5}{x} + \left(\frac{0.3125}{{x}^{3}} - \left(\frac{0.375}{x \cdot x} + \color{blue}{\frac{0.2734375 \cdot 1}{{x}^{4}}}\right)\right)\right) \cdot {x}^{-0.5}
\] |
metadata-eval [=>]99.6 | \[ \left(\frac{0.5}{x} + \left(\frac{0.3125}{{x}^{3}} - \left(\frac{0.375}{x \cdot x} + \frac{\color{blue}{0.2734375}}{{x}^{4}}\right)\right)\right) \cdot {x}^{-0.5}
\] |
if 1.9999999999999999e-7 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 99.4%
Applied egg-rr99.8%
[Start]99.4 | \[ \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\] |
|---|---|
frac-sub [=>]99.4 | \[ \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}}
\] |
div-inv [=>]99.4 | \[ \color{blue}{\left(1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}}
\] |
*-un-lft-identity [<=]99.4 | \[ \left(\color{blue}{\sqrt{x + 1}} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}
\] |
+-commutative [=>]99.4 | \[ \left(\sqrt{\color{blue}{1 + x}} - \sqrt{x} \cdot 1\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}
\] |
*-rgt-identity [=>]99.4 | \[ \left(\sqrt{1 + x} - \color{blue}{\sqrt{x}}\right) \cdot \frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}
\] |
metadata-eval [<=]99.4 | \[ \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{\color{blue}{1 \cdot 1}}{\sqrt{x} \cdot \sqrt{x + 1}}
\] |
frac-times [<=]99.4 | \[ \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \color{blue}{\left(\frac{1}{\sqrt{x}} \cdot \frac{1}{\sqrt{x + 1}}\right)}
\] |
un-div-inv [=>]99.4 | \[ \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \color{blue}{\frac{\frac{1}{\sqrt{x}}}{\sqrt{x + 1}}}
\] |
pow1/2 [=>]99.4 | \[ \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{\frac{1}{\color{blue}{{x}^{0.5}}}}{\sqrt{x + 1}}
\] |
pow-flip [=>]99.8 | \[ \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{\color{blue}{{x}^{\left(-0.5\right)}}}{\sqrt{x + 1}}
\] |
metadata-eval [=>]99.8 | \[ \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{{x}^{\color{blue}{-0.5}}}{\sqrt{x + 1}}
\] |
+-commutative [=>]99.8 | \[ \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{{x}^{-0.5}}{\sqrt{\color{blue}{1 + x}}}
\] |
Simplified99.8%
[Start]99.8 | \[ \left(\sqrt{1 + x} - \sqrt{x}\right) \cdot \frac{{x}^{-0.5}}{\sqrt{1 + x}}
\] |
|---|---|
associate-*r/ [=>]99.8 | \[ \color{blue}{\frac{\left(\sqrt{1 + x} - \sqrt{x}\right) \cdot {x}^{-0.5}}{\sqrt{1 + x}}}
\] |
*-rgt-identity [<=]99.8 | \[ \frac{\left(\sqrt{1 + x} - \sqrt{x}\right) \cdot {x}^{-0.5}}{\color{blue}{\sqrt{1 + x} \cdot 1}}
\] |
times-frac [=>]99.8 | \[ \color{blue}{\frac{\sqrt{1 + x} - \sqrt{x}}{\sqrt{1 + x}} \cdot \frac{{x}^{-0.5}}{1}}
\] |
div-sub [=>]99.8 | \[ \color{blue}{\left(\frac{\sqrt{1 + x}}{\sqrt{1 + x}} - \frac{\sqrt{x}}{\sqrt{1 + x}}\right)} \cdot \frac{{x}^{-0.5}}{1}
\] |
*-inverses [=>]99.8 | \[ \left(\color{blue}{1} - \frac{\sqrt{x}}{\sqrt{1 + x}}\right) \cdot \frac{{x}^{-0.5}}{1}
\] |
/-rgt-identity [=>]99.8 | \[ \left(1 - \frac{\sqrt{x}}{\sqrt{1 + x}}\right) \cdot \color{blue}{{x}^{-0.5}}
\] |
Applied egg-rr99.9%
[Start]99.8 | \[ \left(1 - \frac{\sqrt{x}}{\sqrt{1 + x}}\right) \cdot {x}^{-0.5}
\] |
|---|---|
flip3-- [=>]99.8 | \[ \color{blue}{\frac{{1}^{3} - {\left(\frac{\sqrt{x}}{\sqrt{1 + x}}\right)}^{3}}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}} \cdot {x}^{-0.5}
\] |
div-inv [=>]99.8 | \[ \color{blue}{\left(\left({1}^{3} - {\left(\frac{\sqrt{x}}{\sqrt{1 + x}}\right)}^{3}\right) \cdot \frac{1}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}\right)} \cdot {x}^{-0.5}
\] |
metadata-eval [=>]99.8 | \[ \left(\left(\color{blue}{1} - {\left(\frac{\sqrt{x}}{\sqrt{1 + x}}\right)}^{3}\right) \cdot \frac{1}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}\right) \cdot {x}^{-0.5}
\] |
add-sqr-sqrt [=>]99.9 | \[ \left(\left(1 - {\color{blue}{\left(\sqrt{\frac{\sqrt{x}}{\sqrt{1 + x}}} \cdot \sqrt{\frac{\sqrt{x}}{\sqrt{1 + x}}}\right)}}^{3}\right) \cdot \frac{1}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}\right) \cdot {x}^{-0.5}
\] |
sqrt-unprod [=>]99.8 | \[ \left(\left(1 - {\color{blue}{\left(\sqrt{\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}}\right)}}^{3}\right) \cdot \frac{1}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}\right) \cdot {x}^{-0.5}
\] |
sqrt-pow2 [=>]99.8 | \[ \left(\left(1 - \color{blue}{{\left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}^{\left(\frac{3}{2}\right)}}\right) \cdot \frac{1}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}\right) \cdot {x}^{-0.5}
\] |
sqrt-undiv [=>]99.8 | \[ \left(\left(1 - {\left(\color{blue}{\sqrt{\frac{x}{1 + x}}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}^{\left(\frac{3}{2}\right)}\right) \cdot \frac{1}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}\right) \cdot {x}^{-0.5}
\] |
sqrt-undiv [=>]99.9 | \[ \left(\left(1 - {\left(\sqrt{\frac{x}{1 + x}} \cdot \color{blue}{\sqrt{\frac{x}{1 + x}}}\right)}^{\left(\frac{3}{2}\right)}\right) \cdot \frac{1}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}\right) \cdot {x}^{-0.5}
\] |
add-sqr-sqrt [<=]99.9 | \[ \left(\left(1 - {\color{blue}{\left(\frac{x}{1 + x}\right)}}^{\left(\frac{3}{2}\right)}\right) \cdot \frac{1}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}\right) \cdot {x}^{-0.5}
\] |
metadata-eval [=>]99.9 | \[ \left(\left(1 - {\left(\frac{x}{1 + x}\right)}^{\color{blue}{1.5}}\right) \cdot \frac{1}{1 \cdot 1 + \left(\frac{\sqrt{x}}{\sqrt{1 + x}} \cdot \frac{\sqrt{x}}{\sqrt{1 + x}} + 1 \cdot \frac{\sqrt{x}}{\sqrt{1 + x}}\right)}\right) \cdot {x}^{-0.5}
\] |
Simplified99.9%
[Start]99.9 | \[ \left(\left(1 - {\left(\frac{x}{1 + x}\right)}^{1.5}\right) \cdot \frac{1}{1 + \left(\sqrt{\frac{x}{1 + x}} + \frac{x}{1 + x}\right)}\right) \cdot {x}^{-0.5}
\] |
|---|---|
associate-*r/ [=>]99.9 | \[ \color{blue}{\frac{\left(1 - {\left(\frac{x}{1 + x}\right)}^{1.5}\right) \cdot 1}{1 + \left(\sqrt{\frac{x}{1 + x}} + \frac{x}{1 + x}\right)}} \cdot {x}^{-0.5}
\] |
*-rgt-identity [=>]99.9 | \[ \frac{\color{blue}{1 - {\left(\frac{x}{1 + x}\right)}^{1.5}}}{1 + \left(\sqrt{\frac{x}{1 + x}} + \frac{x}{1 + x}\right)} \cdot {x}^{-0.5}
\] |
+-commutative [=>]99.9 | \[ \frac{1 - {\left(\frac{x}{1 + x}\right)}^{1.5}}{1 + \color{blue}{\left(\frac{x}{1 + x} + \sqrt{\frac{x}{1 + x}}\right)}} \cdot {x}^{-0.5}
\] |
Applied egg-rr99.9%
[Start]99.9 | \[ \frac{1 - {\left(\frac{x}{1 + x}\right)}^{1.5}}{1 + \left(\frac{x}{1 + x} + \sqrt{\frac{x}{1 + x}}\right)} \cdot {x}^{-0.5}
\] |
|---|---|
sub-neg [=>]99.9 | \[ \frac{\color{blue}{1 + \left(-{\left(\frac{x}{1 + x}\right)}^{1.5}\right)}}{1 + \left(\frac{x}{1 + x} + \sqrt{\frac{x}{1 + x}}\right)} \cdot {x}^{-0.5}
\] |
+-commutative [=>]99.9 | \[ \frac{\color{blue}{\left(-{\left(\frac{x}{1 + x}\right)}^{1.5}\right) + 1}}{1 + \left(\frac{x}{1 + x} + \sqrt{\frac{x}{1 + x}}\right)} \cdot {x}^{-0.5}
\] |
sqr-pow [=>]99.9 | \[ \frac{\left(-\color{blue}{{\left(\frac{x}{1 + x}\right)}^{\left(\frac{1.5}{2}\right)} \cdot {\left(\frac{x}{1 + x}\right)}^{\left(\frac{1.5}{2}\right)}}\right) + 1}{1 + \left(\frac{x}{1 + x} + \sqrt{\frac{x}{1 + x}}\right)} \cdot {x}^{-0.5}
\] |
distribute-rgt-neg-in [=>]99.9 | \[ \frac{\color{blue}{{\left(\frac{x}{1 + x}\right)}^{\left(\frac{1.5}{2}\right)} \cdot \left(-{\left(\frac{x}{1 + x}\right)}^{\left(\frac{1.5}{2}\right)}\right)} + 1}{1 + \left(\frac{x}{1 + x} + \sqrt{\frac{x}{1 + x}}\right)} \cdot {x}^{-0.5}
\] |
fma-def [=>]99.9 | \[ \frac{\color{blue}{\mathsf{fma}\left({\left(\frac{x}{1 + x}\right)}^{\left(\frac{1.5}{2}\right)}, -{\left(\frac{x}{1 + x}\right)}^{\left(\frac{1.5}{2}\right)}, 1\right)}}{1 + \left(\frac{x}{1 + x} + \sqrt{\frac{x}{1 + x}}\right)} \cdot {x}^{-0.5}
\] |
metadata-eval [=>]99.9 | \[ \frac{\mathsf{fma}\left({\left(\frac{x}{1 + x}\right)}^{\color{blue}{0.75}}, -{\left(\frac{x}{1 + x}\right)}^{\left(\frac{1.5}{2}\right)}, 1\right)}{1 + \left(\frac{x}{1 + x} + \sqrt{\frac{x}{1 + x}}\right)} \cdot {x}^{-0.5}
\] |
metadata-eval [=>]99.9 | \[ \frac{\mathsf{fma}\left({\left(\frac{x}{1 + x}\right)}^{0.75}, -{\left(\frac{x}{1 + x}\right)}^{\color{blue}{0.75}}, 1\right)}{1 + \left(\frac{x}{1 + x} + \sqrt{\frac{x}{1 + x}}\right)} \cdot {x}^{-0.5}
\] |
Final simplification99.8%
| Alternative 1 | |
|---|---|
| Accuracy | 99.7% |
| Cost | 34244 |
| Alternative 2 | |
|---|---|
| Accuracy | 99.8% |
| Cost | 34052 |
| Alternative 3 | |
|---|---|
| Accuracy | 99.7% |
| Cost | 27332 |
| Alternative 4 | |
|---|---|
| Accuracy | 99.6% |
| Cost | 26884 |
| Alternative 5 | |
|---|---|
| Accuracy | 99.6% |
| Cost | 26692 |
| Alternative 6 | |
|---|---|
| Accuracy | 98.8% |
| Cost | 7300 |
| Alternative 7 | |
|---|---|
| Accuracy | 98.4% |
| Cost | 7044 |
| Alternative 8 | |
|---|---|
| Accuracy | 98.1% |
| Cost | 6916 |
| Alternative 9 | |
|---|---|
| Accuracy | 98.1% |
| Cost | 6916 |
| Alternative 10 | |
|---|---|
| Accuracy | 49.9% |
| Cost | 6528 |
| Alternative 11 | |
|---|---|
| Accuracy | 3.9% |
| Cost | 192 |
| Alternative 12 | |
|---|---|
| Accuracy | 1.9% |
| Cost | 64 |
herbie shell --seed 2023160
(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)))))