
(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:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(FPCore (x) :precision binary64 (/ (pow (* x (+ 1.0 (/ 1.0 x))) -0.5) (+ x (hypot (sqrt x) x))))
double code(double x) {
return pow((x * (1.0 + (1.0 / x))), -0.5) / (x + hypot(sqrt(x), x));
}
public static double code(double x) {
return Math.pow((x * (1.0 + (1.0 / x))), -0.5) / (x + Math.hypot(Math.sqrt(x), x));
}
def code(x): return math.pow((x * (1.0 + (1.0 / x))), -0.5) / (x + math.hypot(math.sqrt(x), x))
function code(x) return Float64((Float64(x * Float64(1.0 + Float64(1.0 / x))) ^ -0.5) / Float64(x + hypot(sqrt(x), x))) end
function tmp = code(x) tmp = ((x * (1.0 + (1.0 / x))) ^ -0.5) / (x + hypot(sqrt(x), x)); end
code[x_] := N[(N[Power[N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[(x + N[Sqrt[N[Sqrt[x], $MachinePrecision] ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(x \cdot \left(1 + \frac{1}{x}\right)\right)}^{-0.5}}{x + \mathsf{hypot}\left(\sqrt{x}, x\right)}
\end{array}
Initial program 39.8%
frac-sub39.9%
div-inv39.9%
*-un-lft-identity39.9%
*-rgt-identity39.9%
+-commutative39.9%
metadata-eval39.9%
frac-times39.9%
associate-*l/39.9%
*-un-lft-identity39.9%
inv-pow39.9%
sqrt-pow239.9%
+-commutative39.9%
metadata-eval39.9%
Applied egg-rr39.9%
flip--40.3%
metadata-eval40.3%
pow-pow40.3%
frac-times40.3%
add-sqr-sqrt22.5%
add-sqr-sqrt41.1%
pow-pow41.1%
metadata-eval41.1%
Applied egg-rr41.1%
associate--l+99.4%
+-inverses99.4%
metadata-eval99.4%
*-lft-identity99.4%
*-commutative99.4%
distribute-lft-in99.4%
sqr-neg99.4%
fma-define99.4%
sqr-neg99.4%
rem-square-sqrt99.7%
Simplified99.7%
fma-undefine99.6%
sqrt-prod86.5%
distribute-rgt-in86.5%
*-un-lft-identity86.5%
add-sqr-sqrt86.5%
hypot-define99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 99.8%
Final simplification99.8%
(FPCore (x) :precision binary64 (/ (pow (+ x 1.0) -0.5) (+ x (hypot (sqrt x) x))))
double code(double x) {
return pow((x + 1.0), -0.5) / (x + hypot(sqrt(x), x));
}
public static double code(double x) {
return Math.pow((x + 1.0), -0.5) / (x + Math.hypot(Math.sqrt(x), x));
}
def code(x): return math.pow((x + 1.0), -0.5) / (x + math.hypot(math.sqrt(x), x))
function code(x) return Float64((Float64(x + 1.0) ^ -0.5) / Float64(x + hypot(sqrt(x), x))) end
function tmp = code(x) tmp = ((x + 1.0) ^ -0.5) / (x + hypot(sqrt(x), x)); end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision] / N[(x + N[Sqrt[N[Sqrt[x], $MachinePrecision] ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(x + 1\right)}^{-0.5}}{x + \mathsf{hypot}\left(\sqrt{x}, x\right)}
\end{array}
Initial program 39.8%
frac-sub39.9%
div-inv39.9%
*-un-lft-identity39.9%
*-rgt-identity39.9%
+-commutative39.9%
metadata-eval39.9%
frac-times39.9%
associate-*l/39.9%
*-un-lft-identity39.9%
inv-pow39.9%
sqrt-pow239.9%
+-commutative39.9%
metadata-eval39.9%
Applied egg-rr39.9%
flip--40.3%
metadata-eval40.3%
pow-pow40.3%
frac-times40.3%
add-sqr-sqrt22.5%
add-sqr-sqrt41.1%
pow-pow41.1%
metadata-eval41.1%
Applied egg-rr41.1%
associate--l+99.4%
+-inverses99.4%
metadata-eval99.4%
*-lft-identity99.4%
*-commutative99.4%
distribute-lft-in99.4%
sqr-neg99.4%
fma-define99.4%
sqr-neg99.4%
rem-square-sqrt99.7%
Simplified99.7%
fma-undefine99.6%
sqrt-prod86.5%
distribute-rgt-in86.5%
*-un-lft-identity86.5%
add-sqr-sqrt86.5%
hypot-define99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x) :precision binary64 (/ (pow (+ x 1.0) -0.5) (* x (+ 2.0 (+ (/ 0.0625 (pow x 3.0)) (/ (+ 0.5 (/ -0.125 x)) x))))))
double code(double x) {
return pow((x + 1.0), -0.5) / (x * (2.0 + ((0.0625 / pow(x, 3.0)) + ((0.5 + (-0.125 / x)) / x))));
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((x + 1.0d0) ** (-0.5d0)) / (x * (2.0d0 + ((0.0625d0 / (x ** 3.0d0)) + ((0.5d0 + ((-0.125d0) / x)) / x))))
end function
public static double code(double x) {
return Math.pow((x + 1.0), -0.5) / (x * (2.0 + ((0.0625 / Math.pow(x, 3.0)) + ((0.5 + (-0.125 / x)) / x))));
}
def code(x): return math.pow((x + 1.0), -0.5) / (x * (2.0 + ((0.0625 / math.pow(x, 3.0)) + ((0.5 + (-0.125 / x)) / x))))
function code(x) return Float64((Float64(x + 1.0) ^ -0.5) / Float64(x * Float64(2.0 + Float64(Float64(0.0625 / (x ^ 3.0)) + Float64(Float64(0.5 + Float64(-0.125 / x)) / x))))) end
function tmp = code(x) tmp = ((x + 1.0) ^ -0.5) / (x * (2.0 + ((0.0625 / (x ^ 3.0)) + ((0.5 + (-0.125 / x)) / x)))); end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision] / N[(x * N[(2.0 + N[(N[(0.0625 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 + N[(-0.125 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(x + 1\right)}^{-0.5}}{x \cdot \left(2 + \left(\frac{0.0625}{{x}^{3}} + \frac{0.5 + \frac{-0.125}{x}}{x}\right)\right)}
\end{array}
Initial program 39.8%
frac-sub39.9%
div-inv39.9%
*-un-lft-identity39.9%
*-rgt-identity39.9%
+-commutative39.9%
metadata-eval39.9%
frac-times39.9%
associate-*l/39.9%
*-un-lft-identity39.9%
inv-pow39.9%
sqrt-pow239.9%
+-commutative39.9%
metadata-eval39.9%
Applied egg-rr39.9%
flip--40.3%
metadata-eval40.3%
pow-pow40.3%
frac-times40.3%
add-sqr-sqrt22.5%
add-sqr-sqrt41.1%
pow-pow41.1%
metadata-eval41.1%
Applied egg-rr41.1%
associate--l+99.4%
+-inverses99.4%
metadata-eval99.4%
*-lft-identity99.4%
*-commutative99.4%
distribute-lft-in99.4%
sqr-neg99.4%
fma-define99.4%
sqr-neg99.4%
rem-square-sqrt99.7%
Simplified99.7%
fma-undefine99.6%
sqrt-prod86.5%
distribute-rgt-in86.5%
*-un-lft-identity86.5%
add-sqr-sqrt86.5%
hypot-define99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 99.8%
associate--l+99.8%
associate-*r/99.8%
metadata-eval99.8%
+-commutative99.8%
associate--l+99.8%
associate-*r/99.8%
metadata-eval99.8%
unpow299.8%
associate-/r*99.8%
metadata-eval99.8%
associate-*r/99.8%
div-sub99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x) :precision binary64 (/ (pow (+ x 1.0) -0.5) (* x (- (+ 2.0 (/ 0.5 x)) (/ 0.125 (pow x 2.0))))))
double code(double x) {
return pow((x + 1.0), -0.5) / (x * ((2.0 + (0.5 / x)) - (0.125 / pow(x, 2.0))));
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((x + 1.0d0) ** (-0.5d0)) / (x * ((2.0d0 + (0.5d0 / x)) - (0.125d0 / (x ** 2.0d0))))
end function
public static double code(double x) {
return Math.pow((x + 1.0), -0.5) / (x * ((2.0 + (0.5 / x)) - (0.125 / Math.pow(x, 2.0))));
}
def code(x): return math.pow((x + 1.0), -0.5) / (x * ((2.0 + (0.5 / x)) - (0.125 / math.pow(x, 2.0))))
function code(x) return Float64((Float64(x + 1.0) ^ -0.5) / Float64(x * Float64(Float64(2.0 + Float64(0.5 / x)) - Float64(0.125 / (x ^ 2.0))))) end
function tmp = code(x) tmp = ((x + 1.0) ^ -0.5) / (x * ((2.0 + (0.5 / x)) - (0.125 / (x ^ 2.0)))); end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision] / N[(x * N[(N[(2.0 + N[(0.5 / x), $MachinePrecision]), $MachinePrecision] - N[(0.125 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(x + 1\right)}^{-0.5}}{x \cdot \left(\left(2 + \frac{0.5}{x}\right) - \frac{0.125}{{x}^{2}}\right)}
\end{array}
Initial program 39.8%
frac-sub39.9%
div-inv39.9%
*-un-lft-identity39.9%
*-rgt-identity39.9%
+-commutative39.9%
metadata-eval39.9%
frac-times39.9%
associate-*l/39.9%
*-un-lft-identity39.9%
inv-pow39.9%
sqrt-pow239.9%
+-commutative39.9%
metadata-eval39.9%
Applied egg-rr39.9%
flip--40.3%
metadata-eval40.3%
pow-pow40.3%
frac-times40.3%
add-sqr-sqrt22.5%
add-sqr-sqrt41.1%
pow-pow41.1%
metadata-eval41.1%
Applied egg-rr41.1%
associate--l+99.4%
+-inverses99.4%
metadata-eval99.4%
*-lft-identity99.4%
*-commutative99.4%
distribute-lft-in99.4%
sqr-neg99.4%
fma-define99.4%
sqr-neg99.4%
rem-square-sqrt99.7%
Simplified99.7%
Taylor expanded in x around inf 99.7%
+-commutative99.7%
associate-*r/99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x) :precision binary64 (/ (/ (pow (+ x 1.0) -0.5) x) (+ (/ 0.5 x) (+ 2.0 (* -0.125 (pow x -2.0))))))
double code(double x) {
return (pow((x + 1.0), -0.5) / x) / ((0.5 / x) + (2.0 + (-0.125 * pow(x, -2.0))));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (((x + 1.0d0) ** (-0.5d0)) / x) / ((0.5d0 / x) + (2.0d0 + ((-0.125d0) * (x ** (-2.0d0)))))
end function
public static double code(double x) {
return (Math.pow((x + 1.0), -0.5) / x) / ((0.5 / x) + (2.0 + (-0.125 * Math.pow(x, -2.0))));
}
def code(x): return (math.pow((x + 1.0), -0.5) / x) / ((0.5 / x) + (2.0 + (-0.125 * math.pow(x, -2.0))))
function code(x) return Float64(Float64((Float64(x + 1.0) ^ -0.5) / x) / Float64(Float64(0.5 / x) + Float64(2.0 + Float64(-0.125 * (x ^ -2.0))))) end
function tmp = code(x) tmp = (((x + 1.0) ^ -0.5) / x) / ((0.5 / x) + (2.0 + (-0.125 * (x ^ -2.0)))); end
code[x_] := N[(N[(N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision] / x), $MachinePrecision] / N[(N[(0.5 / x), $MachinePrecision] + N[(2.0 + N[(-0.125 * N[Power[x, -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{{\left(x + 1\right)}^{-0.5}}{x}}{\frac{0.5}{x} + \left(2 + -0.125 \cdot {x}^{-2}\right)}
\end{array}
Initial program 39.8%
frac-sub39.9%
div-inv39.9%
*-un-lft-identity39.9%
*-rgt-identity39.9%
+-commutative39.9%
metadata-eval39.9%
frac-times39.9%
associate-*l/39.9%
*-un-lft-identity39.9%
inv-pow39.9%
sqrt-pow239.9%
+-commutative39.9%
metadata-eval39.9%
Applied egg-rr39.9%
flip--40.3%
metadata-eval40.3%
pow-pow40.3%
frac-times40.3%
add-sqr-sqrt22.5%
add-sqr-sqrt41.1%
pow-pow41.1%
metadata-eval41.1%
Applied egg-rr41.1%
associate--l+99.4%
+-inverses99.4%
metadata-eval99.4%
*-lft-identity99.4%
*-commutative99.4%
distribute-lft-in99.4%
sqr-neg99.4%
fma-define99.4%
sqr-neg99.4%
rem-square-sqrt99.7%
Simplified99.7%
Taylor expanded in x around inf 99.7%
+-commutative99.7%
associate-*r/99.7%
metadata-eval99.7%
Simplified99.7%
*-un-lft-identity99.7%
associate-/r*99.6%
associate--l+99.6%
div-inv99.6%
pow-flip99.6%
metadata-eval99.6%
Applied egg-rr99.6%
*-lft-identity99.6%
cancel-sign-sub-inv99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x) :precision binary64 (/ (pow (+ x 1.0) -0.5) (* x (+ 2.0 (/ 0.5 x)))))
double code(double x) {
return pow((x + 1.0), -0.5) / (x * (2.0 + (0.5 / x)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((x + 1.0d0) ** (-0.5d0)) / (x * (2.0d0 + (0.5d0 / x)))
end function
public static double code(double x) {
return Math.pow((x + 1.0), -0.5) / (x * (2.0 + (0.5 / x)));
}
def code(x): return math.pow((x + 1.0), -0.5) / (x * (2.0 + (0.5 / x)))
function code(x) return Float64((Float64(x + 1.0) ^ -0.5) / Float64(x * Float64(2.0 + Float64(0.5 / x)))) end
function tmp = code(x) tmp = ((x + 1.0) ^ -0.5) / (x * (2.0 + (0.5 / x))); end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision] / N[(x * N[(2.0 + N[(0.5 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(x + 1\right)}^{-0.5}}{x \cdot \left(2 + \frac{0.5}{x}\right)}
\end{array}
Initial program 39.8%
frac-sub39.9%
div-inv39.9%
*-un-lft-identity39.9%
*-rgt-identity39.9%
+-commutative39.9%
metadata-eval39.9%
frac-times39.9%
associate-*l/39.9%
*-un-lft-identity39.9%
inv-pow39.9%
sqrt-pow239.9%
+-commutative39.9%
metadata-eval39.9%
Applied egg-rr39.9%
flip--40.3%
metadata-eval40.3%
pow-pow40.3%
frac-times40.3%
add-sqr-sqrt22.5%
add-sqr-sqrt41.1%
pow-pow41.1%
metadata-eval41.1%
Applied egg-rr41.1%
associate--l+99.4%
+-inverses99.4%
metadata-eval99.4%
*-lft-identity99.4%
*-commutative99.4%
distribute-lft-in99.4%
sqr-neg99.4%
fma-define99.4%
sqr-neg99.4%
rem-square-sqrt99.7%
Simplified99.7%
Taylor expanded in x around inf 99.4%
+-commutative99.4%
associate-*r/99.4%
metadata-eval99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x) :precision binary64 (* 0.5 (pow x -1.5)))
double code(double x) {
return 0.5 * pow(x, -1.5);
}
real(8) function code(x)
real(8), intent (in) :: x
code = 0.5d0 * (x ** (-1.5d0))
end function
public static double code(double x) {
return 0.5 * Math.pow(x, -1.5);
}
def code(x): return 0.5 * math.pow(x, -1.5)
function code(x) return Float64(0.5 * (x ^ -1.5)) end
function tmp = code(x) tmp = 0.5 * (x ^ -1.5); end
code[x_] := N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot {x}^{-1.5}
\end{array}
Initial program 39.8%
expm1-log1p-u39.8%
expm1-undefine4.6%
inv-pow4.6%
sqrt-pow24.6%
metadata-eval4.6%
Applied egg-rr4.6%
log1p-undefine4.6%
rem-exp-log4.6%
+-commutative4.6%
associate--l+33.0%
metadata-eval33.0%
+-rgt-identity33.0%
Simplified33.0%
Taylor expanded in x around inf 68.7%
*-commutative68.7%
Simplified68.7%
*-un-lft-identity68.7%
pow-flip69.0%
sqrt-pow198.8%
metadata-eval98.8%
metadata-eval98.8%
Applied egg-rr98.8%
*-lft-identity98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x) :precision binary64 (if (<= x 6.4e+153) (/ 0.5 x) 0.0))
double code(double x) {
double tmp;
if (x <= 6.4e+153) {
tmp = 0.5 / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 6.4d+153) then
tmp = 0.5d0 / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 6.4e+153) {
tmp = 0.5 / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x): tmp = 0 if x <= 6.4e+153: tmp = 0.5 / x else: tmp = 0.0 return tmp
function code(x) tmp = 0.0 if (x <= 6.4e+153) tmp = Float64(0.5 / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 6.4e+153) tmp = 0.5 / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 6.4e+153], N[(0.5 / x), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.4 \cdot 10^{+153}:\\
\;\;\;\;\frac{0.5}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 6.4000000000000003e153Initial program 7.8%
frac-sub7.9%
div-inv7.9%
*-un-lft-identity7.9%
*-rgt-identity7.9%
+-commutative7.9%
metadata-eval7.9%
frac-times7.9%
associate-*l/7.9%
*-un-lft-identity7.9%
inv-pow7.9%
sqrt-pow27.9%
+-commutative7.9%
metadata-eval7.9%
Applied egg-rr7.9%
flip--8.7%
metadata-eval8.7%
pow-pow8.7%
frac-times8.7%
add-sqr-sqrt8.8%
add-sqr-sqrt10.3%
pow-pow10.3%
metadata-eval10.3%
Applied egg-rr10.3%
associate--l+99.1%
+-inverses99.1%
metadata-eval99.1%
*-lft-identity99.1%
*-commutative99.1%
distribute-lft-in99.1%
sqr-neg99.1%
fma-define99.0%
sqr-neg99.0%
rem-square-sqrt99.6%
Simplified99.6%
Taylor expanded in x around inf 97.5%
*-commutative97.5%
Simplified97.5%
Taylor expanded in x around 0 8.3%
if 6.4000000000000003e153 < x Initial program 72.8%
inv-pow72.8%
add-sqr-sqrt51.7%
unpow-prod-down29.7%
pow1/229.7%
sqrt-pow134.1%
+-commutative34.1%
metadata-eval34.1%
pow1/234.1%
sqrt-pow128.8%
+-commutative28.8%
metadata-eval28.8%
Applied egg-rr28.8%
pow-sqr46.5%
metadata-eval46.5%
Simplified46.5%
Taylor expanded in x around inf 46.5%
Taylor expanded in x around 0 72.8%
(FPCore (x) :precision binary64 0.0)
double code(double x) {
return 0.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 0.0d0
end function
public static double code(double x) {
return 0.0;
}
def code(x): return 0.0
function code(x) return 0.0 end
function tmp = code(x) tmp = 0.0; end
code[x_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 39.8%
inv-pow39.8%
add-sqr-sqrt29.5%
unpow-prod-down18.7%
pow1/218.7%
sqrt-pow120.9%
+-commutative20.9%
metadata-eval20.9%
pow1/220.9%
sqrt-pow118.3%
+-commutative18.3%
metadata-eval18.3%
Applied egg-rr18.3%
pow-sqr27.0%
metadata-eval27.0%
Simplified27.0%
Taylor expanded in x around inf 25.4%
Taylor expanded in x around 0 38.1%
(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}
(FPCore (x) :precision binary64 (- (pow x -0.5) (pow (+ x 1.0) -0.5)))
double code(double x) {
return pow(x, -0.5) - pow((x + 1.0), -0.5);
}
real(8) function code(x)
real(8), intent (in) :: x
code = (x ** (-0.5d0)) - ((x + 1.0d0) ** (-0.5d0))
end function
public static double code(double x) {
return Math.pow(x, -0.5) - Math.pow((x + 1.0), -0.5);
}
def code(x): return math.pow(x, -0.5) - math.pow((x + 1.0), -0.5)
function code(x) return Float64((x ^ -0.5) - (Float64(x + 1.0) ^ -0.5)) end
function tmp = code(x) tmp = (x ^ -0.5) - ((x + 1.0) ^ -0.5); end
code[x_] := N[(N[Power[x, -0.5], $MachinePrecision] - N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{x}^{-0.5} - {\left(x + 1\right)}^{-0.5}
\end{array}
herbie shell --seed 2024177
(FPCore (x)
:name "2isqrt (example 3.6)"
:precision binary64
:pre (and (> x 1.0) (< x 1e+308))
:alt
(! :herbie-platform default (/ 1 (+ (* (+ x 1) (sqrt x)) (* x (sqrt (+ x 1))))))
:alt
(! :herbie-platform default (- (pow x -1/2) (pow (+ x 1) -1/2)))
(- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))