
(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 12 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
(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) (sqrt (/ 1.0 (+ 1.0 x))))))
double code(double x) {
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) - sqrt((1.0 / (1.0 + x)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (((1.0d0 / sqrt(x)) + ((-1.0d0) / sqrt((1.0d0 + x)))) <= 2d-7) then
tmp = ((0.5d0 / x) + ((0.3125d0 / (x ** 3.0d0)) - ((0.375d0 / (x * x)) + (0.2734375d0 / (x ** 4.0d0))))) * (x ** (-0.5d0))
else
tmp = (x ** (-0.5d0)) - sqrt((1.0d0 / (1.0d0 + x)))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (((1.0 / Math.sqrt(x)) + (-1.0 / Math.sqrt((1.0 + x)))) <= 2e-7) {
tmp = ((0.5 / x) + ((0.3125 / Math.pow(x, 3.0)) - ((0.375 / (x * x)) + (0.2734375 / Math.pow(x, 4.0))))) * Math.pow(x, -0.5);
} else {
tmp = Math.pow(x, -0.5) - Math.sqrt((1.0 / (1.0 + x)));
}
return tmp;
}
def code(x): tmp = 0 if ((1.0 / math.sqrt(x)) + (-1.0 / math.sqrt((1.0 + x)))) <= 2e-7: tmp = ((0.5 / x) + ((0.3125 / math.pow(x, 3.0)) - ((0.375 / (x * x)) + (0.2734375 / math.pow(x, 4.0))))) * math.pow(x, -0.5) else: tmp = math.pow(x, -0.5) - math.sqrt((1.0 / (1.0 + x))) return tmp
function code(x) 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) - sqrt(Float64(1.0 / Float64(1.0 + x)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 2e-7) tmp = ((0.5 / x) + ((0.3125 / (x ^ 3.0)) - ((0.375 / (x * x)) + (0.2734375 / (x ^ 4.0))))) * (x ^ -0.5); else tmp = (x ^ -0.5) - sqrt((1.0 / (1.0 + x))); end tmp_2 = tmp; end
code[x_] := 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[Sqrt[N[(1.0 / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\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} - \sqrt{\frac{1}{1 + x}}\\
\end{array}
\end{array}
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 1.9999999999999999e-7Initial program 35.6%
frac-sub35.6%
div-inv35.6%
*-un-lft-identity35.6%
+-commutative35.6%
*-rgt-identity35.6%
metadata-eval35.6%
frac-times35.6%
un-div-inv35.6%
pow1/235.6%
pow-flip35.6%
metadata-eval35.6%
+-commutative35.6%
Applied egg-rr35.6%
associate-*r/35.6%
*-rgt-identity35.6%
times-frac35.6%
div-sub35.5%
*-inverses35.5%
/-rgt-identity35.5%
Simplified35.5%
Taylor expanded in x around inf 99.7%
associate--l+99.7%
associate-*r/99.7%
metadata-eval99.7%
associate-*r/99.7%
metadata-eval99.7%
+-commutative99.7%
associate-*r/99.7%
metadata-eval99.7%
unpow299.7%
associate-*r/99.7%
metadata-eval99.7%
Simplified99.7%
if 1.9999999999999999e-7 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 99.7%
add-log-exp6.9%
*-un-lft-identity6.9%
log-prod6.9%
metadata-eval6.9%
add-log-exp99.7%
pow1/299.7%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
Simplified100.0%
add-sqr-sqrt100.0%
sqrt-unprod100.0%
frac-times100.0%
metadata-eval100.0%
add-sqr-sqrt100.0%
+-commutative100.0%
Applied egg-rr100.0%
Final simplification99.9%
(FPCore (x) :precision binary64 (if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 (sqrt (+ 1.0 x)))) 2e-7) (* (pow x -0.5) (+ (/ 0.5 x) (- (/ 0.3125 (pow x 3.0)) (/ 0.375 (* x x))))) (- (pow x -0.5) (sqrt (/ 1.0 (+ 1.0 x))))))
double code(double x) {
double tmp;
if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 2e-7) {
tmp = pow(x, -0.5) * ((0.5 / x) + ((0.3125 / pow(x, 3.0)) - (0.375 / (x * x))));
} else {
tmp = pow(x, -0.5) - sqrt((1.0 / (1.0 + x)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (((1.0d0 / sqrt(x)) + ((-1.0d0) / sqrt((1.0d0 + x)))) <= 2d-7) then
tmp = (x ** (-0.5d0)) * ((0.5d0 / x) + ((0.3125d0 / (x ** 3.0d0)) - (0.375d0 / (x * x))))
else
tmp = (x ** (-0.5d0)) - sqrt((1.0d0 / (1.0d0 + x)))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (((1.0 / Math.sqrt(x)) + (-1.0 / Math.sqrt((1.0 + x)))) <= 2e-7) {
tmp = Math.pow(x, -0.5) * ((0.5 / x) + ((0.3125 / Math.pow(x, 3.0)) - (0.375 / (x * x))));
} else {
tmp = Math.pow(x, -0.5) - Math.sqrt((1.0 / (1.0 + x)));
}
return tmp;
}
def code(x): tmp = 0 if ((1.0 / math.sqrt(x)) + (-1.0 / math.sqrt((1.0 + x)))) <= 2e-7: tmp = math.pow(x, -0.5) * ((0.5 / x) + ((0.3125 / math.pow(x, 3.0)) - (0.375 / (x * x)))) else: tmp = math.pow(x, -0.5) - math.sqrt((1.0 / (1.0 + x))) return tmp
function code(x) tmp = 0.0 if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / sqrt(Float64(1.0 + x)))) <= 2e-7) tmp = Float64((x ^ -0.5) * Float64(Float64(0.5 / x) + Float64(Float64(0.3125 / (x ^ 3.0)) - Float64(0.375 / Float64(x * x))))); else tmp = Float64((x ^ -0.5) - sqrt(Float64(1.0 / Float64(1.0 + x)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 2e-7) tmp = (x ^ -0.5) * ((0.5 / x) + ((0.3125 / (x ^ 3.0)) - (0.375 / (x * x)))); else tmp = (x ^ -0.5) - sqrt((1.0 / (1.0 + x))); end tmp_2 = tmp; end
code[x_] := 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[Power[x, -0.5], $MachinePrecision] * N[(N[(0.5 / x), $MachinePrecision] + N[(N[(0.3125 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] - N[(0.375 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] - N[Sqrt[N[(1.0 / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{1 + x}} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;{x}^{-0.5} \cdot \left(\frac{0.5}{x} + \left(\frac{0.3125}{{x}^{3}} - \frac{0.375}{x \cdot x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} - \sqrt{\frac{1}{1 + x}}\\
\end{array}
\end{array}
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 1.9999999999999999e-7Initial program 35.6%
frac-sub35.6%
div-inv35.6%
*-un-lft-identity35.6%
+-commutative35.6%
*-rgt-identity35.6%
metadata-eval35.6%
frac-times35.6%
un-div-inv35.6%
pow1/235.6%
pow-flip35.6%
metadata-eval35.6%
+-commutative35.6%
Applied egg-rr35.6%
associate-*r/35.6%
*-rgt-identity35.6%
times-frac35.6%
div-sub35.5%
*-inverses35.5%
/-rgt-identity35.5%
Simplified35.5%
Taylor expanded in x around inf 99.6%
associate--l+99.6%
associate-*r/99.6%
metadata-eval99.6%
associate-*r/99.6%
metadata-eval99.6%
associate-*r/99.6%
metadata-eval99.6%
unpow299.6%
Simplified99.6%
if 1.9999999999999999e-7 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 99.7%
add-log-exp6.9%
*-un-lft-identity6.9%
log-prod6.9%
metadata-eval6.9%
add-log-exp99.7%
pow1/299.7%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
Simplified100.0%
add-sqr-sqrt100.0%
sqrt-unprod100.0%
frac-times100.0%
metadata-eval100.0%
add-sqr-sqrt100.0%
+-commutative100.0%
Applied egg-rr100.0%
Final simplification99.8%
(FPCore (x) :precision binary64 (if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 (sqrt (+ 1.0 x)))) 5e-18) (* (pow x -0.5) (- (/ 0.5 x) (/ 0.375 (* x x)))) (- (pow x -0.5) (sqrt (/ 1.0 (+ 1.0 x))))))
double code(double x) {
double tmp;
if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 5e-18) {
tmp = pow(x, -0.5) * ((0.5 / x) - (0.375 / (x * x)));
} else {
tmp = pow(x, -0.5) - sqrt((1.0 / (1.0 + x)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (((1.0d0 / sqrt(x)) + ((-1.0d0) / sqrt((1.0d0 + x)))) <= 5d-18) then
tmp = (x ** (-0.5d0)) * ((0.5d0 / x) - (0.375d0 / (x * x)))
else
tmp = (x ** (-0.5d0)) - sqrt((1.0d0 / (1.0d0 + x)))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (((1.0 / Math.sqrt(x)) + (-1.0 / Math.sqrt((1.0 + x)))) <= 5e-18) {
tmp = Math.pow(x, -0.5) * ((0.5 / x) - (0.375 / (x * x)));
} else {
tmp = Math.pow(x, -0.5) - Math.sqrt((1.0 / (1.0 + x)));
}
return tmp;
}
def code(x): tmp = 0 if ((1.0 / math.sqrt(x)) + (-1.0 / math.sqrt((1.0 + x)))) <= 5e-18: tmp = math.pow(x, -0.5) * ((0.5 / x) - (0.375 / (x * x))) else: tmp = math.pow(x, -0.5) - math.sqrt((1.0 / (1.0 + x))) return tmp
function code(x) tmp = 0.0 if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / sqrt(Float64(1.0 + x)))) <= 5e-18) tmp = Float64((x ^ -0.5) * Float64(Float64(0.5 / x) - Float64(0.375 / Float64(x * x)))); else tmp = Float64((x ^ -0.5) - sqrt(Float64(1.0 / Float64(1.0 + x)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 5e-18) tmp = (x ^ -0.5) * ((0.5 / x) - (0.375 / (x * x))); else tmp = (x ^ -0.5) - sqrt((1.0 / (1.0 + x))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-18], N[(N[Power[x, -0.5], $MachinePrecision] * N[(N[(0.5 / x), $MachinePrecision] - N[(0.375 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] - N[Sqrt[N[(1.0 / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{1 + x}} \leq 5 \cdot 10^{-18}:\\
\;\;\;\;{x}^{-0.5} \cdot \left(\frac{0.5}{x} - \frac{0.375}{x \cdot x}\right)\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} - \sqrt{\frac{1}{1 + x}}\\
\end{array}
\end{array}
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 5.00000000000000036e-18Initial program 35.3%
frac-sub35.3%
div-inv35.3%
*-un-lft-identity35.3%
+-commutative35.3%
*-rgt-identity35.3%
metadata-eval35.3%
frac-times35.3%
un-div-inv35.3%
pow1/235.3%
pow-flip35.3%
metadata-eval35.3%
+-commutative35.3%
Applied egg-rr35.3%
associate-*r/35.3%
*-rgt-identity35.3%
times-frac35.3%
div-sub35.2%
*-inverses35.2%
/-rgt-identity35.2%
Simplified35.2%
Taylor expanded in x around inf 99.7%
associate-*r/99.7%
metadata-eval99.7%
associate-*r/99.7%
metadata-eval99.7%
unpow299.7%
Simplified99.7%
if 5.00000000000000036e-18 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 99.5%
add-log-exp7.4%
*-un-lft-identity7.4%
log-prod7.4%
metadata-eval7.4%
add-log-exp99.5%
pow1/299.5%
pow-flip99.8%
metadata-eval99.8%
Applied egg-rr99.8%
+-lft-identity99.8%
Simplified99.8%
add-sqr-sqrt99.8%
sqrt-unprod99.8%
frac-times99.8%
metadata-eval99.8%
add-sqr-sqrt99.8%
+-commutative99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x) :precision binary64 (if (<= x 160000.0) (- (pow x -0.5) (pow (+ 1.0 x) -0.5)) (* (pow x -0.5) (- (/ 0.5 x) (/ 0.375 (* x x))))))
double code(double x) {
double tmp;
if (x <= 160000.0) {
tmp = pow(x, -0.5) - pow((1.0 + x), -0.5);
} else {
tmp = pow(x, -0.5) * ((0.5 / x) - (0.375 / (x * x)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 160000.0d0) then
tmp = (x ** (-0.5d0)) - ((1.0d0 + x) ** (-0.5d0))
else
tmp = (x ** (-0.5d0)) * ((0.5d0 / x) - (0.375d0 / (x * x)))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 160000.0) {
tmp = Math.pow(x, -0.5) - Math.pow((1.0 + x), -0.5);
} else {
tmp = Math.pow(x, -0.5) * ((0.5 / x) - (0.375 / (x * x)));
}
return tmp;
}
def code(x): tmp = 0 if x <= 160000.0: tmp = math.pow(x, -0.5) - math.pow((1.0 + x), -0.5) else: tmp = math.pow(x, -0.5) * ((0.5 / x) - (0.375 / (x * x))) return tmp
function code(x) tmp = 0.0 if (x <= 160000.0) tmp = Float64((x ^ -0.5) - (Float64(1.0 + x) ^ -0.5)); else tmp = Float64((x ^ -0.5) * Float64(Float64(0.5 / x) - Float64(0.375 / Float64(x * x)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 160000.0) tmp = (x ^ -0.5) - ((1.0 + x) ^ -0.5); else tmp = (x ^ -0.5) * ((0.5 / x) - (0.375 / (x * x))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 160000.0], N[(N[Power[x, -0.5], $MachinePrecision] - N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] * N[(N[(0.5 / x), $MachinePrecision] - N[(0.375 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 160000:\\
\;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \left(\frac{0.5}{x} - \frac{0.375}{x \cdot x}\right)\\
\end{array}
\end{array}
if x < 1.6e5Initial program 99.5%
*-un-lft-identity99.5%
clear-num99.5%
associate-/r/99.5%
prod-diff99.5%
*-un-lft-identity99.5%
fma-neg99.5%
*-un-lft-identity99.5%
inv-pow99.5%
sqrt-pow299.8%
metadata-eval99.8%
pow1/299.8%
pow-flip99.8%
+-commutative99.8%
metadata-eval99.8%
Applied egg-rr99.8%
fma-udef99.8%
distribute-lft1-in99.8%
metadata-eval99.8%
mul0-lft99.8%
+-rgt-identity99.8%
Simplified99.8%
if 1.6e5 < x Initial program 35.3%
frac-sub35.3%
div-inv35.3%
*-un-lft-identity35.3%
+-commutative35.3%
*-rgt-identity35.3%
metadata-eval35.3%
frac-times35.3%
un-div-inv35.3%
pow1/235.3%
pow-flip35.3%
metadata-eval35.3%
+-commutative35.3%
Applied egg-rr35.3%
associate-*r/35.3%
*-rgt-identity35.3%
times-frac35.3%
div-sub35.2%
*-inverses35.2%
/-rgt-identity35.2%
Simplified35.2%
Taylor expanded in x around inf 99.7%
associate-*r/99.7%
metadata-eval99.7%
associate-*r/99.7%
metadata-eval99.7%
unpow299.7%
Simplified99.7%
Final simplification99.8%
(FPCore (x) :precision binary64 (if (<= x 1.4) (+ (pow x -0.5) (/ -1.0 (+ 1.0 (* x 0.5)))) (* (pow x -0.5) (- (/ 0.5 x) (/ 0.375 (* x x))))))
double code(double x) {
double tmp;
if (x <= 1.4) {
tmp = pow(x, -0.5) + (-1.0 / (1.0 + (x * 0.5)));
} else {
tmp = pow(x, -0.5) * ((0.5 / x) - (0.375 / (x * 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)) + ((-1.0d0) / (1.0d0 + (x * 0.5d0)))
else
tmp = (x ** (-0.5d0)) * ((0.5d0 / x) - (0.375d0 / (x * 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) + (-1.0 / (1.0 + (x * 0.5)));
} else {
tmp = Math.pow(x, -0.5) * ((0.5 / x) - (0.375 / (x * x)));
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.4: tmp = math.pow(x, -0.5) + (-1.0 / (1.0 + (x * 0.5))) else: tmp = math.pow(x, -0.5) * ((0.5 / x) - (0.375 / (x * x))) return tmp
function code(x) tmp = 0.0 if (x <= 1.4) tmp = Float64((x ^ -0.5) + Float64(-1.0 / Float64(1.0 + Float64(x * 0.5)))); else tmp = Float64((x ^ -0.5) * Float64(Float64(0.5 / x) - Float64(0.375 / Float64(x * x)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.4) tmp = (x ^ -0.5) + (-1.0 / (1.0 + (x * 0.5))); else tmp = (x ^ -0.5) * ((0.5 / x) - (0.375 / (x * x))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.4], N[(N[Power[x, -0.5], $MachinePrecision] + N[(-1.0 / N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] * N[(N[(0.5 / x), $MachinePrecision] - N[(0.375 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;{x}^{-0.5} + \frac{-1}{1 + x \cdot 0.5}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} \cdot \left(\frac{0.5}{x} - \frac{0.375}{x \cdot x}\right)\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 99.7%
add-log-exp6.9%
*-un-lft-identity6.9%
log-prod6.9%
metadata-eval6.9%
add-log-exp99.7%
pow1/299.7%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 98.6%
if 1.3999999999999999 < x Initial program 35.6%
frac-sub35.6%
div-inv35.6%
*-un-lft-identity35.6%
+-commutative35.6%
*-rgt-identity35.6%
metadata-eval35.6%
frac-times35.6%
un-div-inv35.6%
pow1/235.6%
pow-flip35.6%
metadata-eval35.6%
+-commutative35.6%
Applied egg-rr35.6%
associate-*r/35.6%
*-rgt-identity35.6%
times-frac35.6%
div-sub35.5%
*-inverses35.5%
/-rgt-identity35.5%
Simplified35.5%
Taylor expanded in x around inf 99.5%
associate-*r/99.5%
metadata-eval99.5%
associate-*r/99.5%
metadata-eval99.5%
unpow299.5%
Simplified99.5%
Final simplification99.0%
(FPCore (x) :precision binary64 (if (<= x 1.7) (+ (pow x -0.5) (/ -1.0 (+ 1.0 (* x 0.5)))) (* 0.5 (pow x -1.5))))
double code(double x) {
double tmp;
if (x <= 1.7) {
tmp = pow(x, -0.5) + (-1.0 / (1.0 + (x * 0.5)));
} else {
tmp = 0.5 * pow(x, -1.5);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 1.7d0) then
tmp = (x ** (-0.5d0)) + ((-1.0d0) / (1.0d0 + (x * 0.5d0)))
else
tmp = 0.5d0 * (x ** (-1.5d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 1.7) {
tmp = Math.pow(x, -0.5) + (-1.0 / (1.0 + (x * 0.5)));
} else {
tmp = 0.5 * Math.pow(x, -1.5);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.7: tmp = math.pow(x, -0.5) + (-1.0 / (1.0 + (x * 0.5))) else: tmp = 0.5 * math.pow(x, -1.5) return tmp
function code(x) tmp = 0.0 if (x <= 1.7) tmp = Float64((x ^ -0.5) + Float64(-1.0 / Float64(1.0 + Float64(x * 0.5)))); else tmp = Float64(0.5 * (x ^ -1.5)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.7) tmp = (x ^ -0.5) + (-1.0 / (1.0 + (x * 0.5))); else tmp = 0.5 * (x ^ -1.5); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.7], N[(N[Power[x, -0.5], $MachinePrecision] + N[(-1.0 / N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.7:\\
\;\;\;\;{x}^{-0.5} + \frac{-1}{1 + x \cdot 0.5}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\
\end{array}
\end{array}
if x < 1.69999999999999996Initial program 99.7%
add-log-exp6.9%
*-un-lft-identity6.9%
log-prod6.9%
metadata-eval6.9%
add-log-exp99.7%
pow1/299.7%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 98.6%
if 1.69999999999999996 < x Initial program 35.6%
frac-sub35.6%
div-inv35.6%
*-un-lft-identity35.6%
+-commutative35.6%
*-rgt-identity35.6%
metadata-eval35.6%
frac-times35.6%
un-div-inv35.6%
pow1/235.6%
pow-flip35.6%
metadata-eval35.6%
+-commutative35.6%
Applied egg-rr35.6%
associate-*r/35.6%
*-rgt-identity35.6%
times-frac35.6%
div-sub35.5%
*-inverses35.5%
/-rgt-identity35.5%
Simplified35.5%
Taylor expanded in x around inf 99.0%
expm1-log1p-u99.0%
expm1-udef34.4%
Applied egg-rr34.4%
expm1-def99.2%
expm1-log1p99.2%
Simplified99.2%
Final simplification98.9%
(FPCore (x) :precision binary64 (if (<= x 1.0) (+ (+ (pow x -0.5) (* x 0.5)) -1.0) (* 0.5 (pow x -1.5))))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = (pow(x, -0.5) + (x * 0.5)) + -1.0;
} else {
tmp = 0.5 * pow(x, -1.5);
}
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 * (x ** (-1.5d0))
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.pow(x, -1.5);
}
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.pow(x, -1.5) 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 * (x ^ -1.5)); 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 * (x ^ -1.5); 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[Power[x, -1.5], $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 {x}^{-1.5}\\
\end{array}
\end{array}
if x < 1Initial program 99.7%
sub-neg99.7%
+-commutative99.7%
add-sqr-sqrt99.7%
distribute-rgt-neg-in99.7%
fma-def99.7%
inv-pow99.7%
sqrt-pow299.7%
+-commutative99.7%
metadata-eval99.7%
inv-pow99.7%
sqrt-pow299.7%
+-commutative99.7%
metadata-eval99.7%
pow1/299.7%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 98.5%
if 1 < x Initial program 35.6%
frac-sub35.6%
div-inv35.6%
*-un-lft-identity35.6%
+-commutative35.6%
*-rgt-identity35.6%
metadata-eval35.6%
frac-times35.6%
un-div-inv35.6%
pow1/235.6%
pow-flip35.6%
metadata-eval35.6%
+-commutative35.6%
Applied egg-rr35.6%
associate-*r/35.6%
*-rgt-identity35.6%
times-frac35.6%
div-sub35.5%
*-inverses35.5%
/-rgt-identity35.5%
Simplified35.5%
Taylor expanded in x around inf 99.0%
expm1-log1p-u99.0%
expm1-udef34.4%
Applied egg-rr34.4%
expm1-def99.2%
expm1-log1p99.2%
Simplified99.2%
Final simplification98.8%
(FPCore (x) :precision binary64 (if (<= x 0.5) (sqrt (/ 1.0 x)) (* 0.5 (pow x -1.5))))
double code(double x) {
double tmp;
if (x <= 0.5) {
tmp = sqrt((1.0 / x));
} else {
tmp = 0.5 * pow(x, -1.5);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.5d0) then
tmp = sqrt((1.0d0 / x))
else
tmp = 0.5d0 * (x ** (-1.5d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.5) {
tmp = Math.sqrt((1.0 / x));
} else {
tmp = 0.5 * Math.pow(x, -1.5);
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.5: tmp = math.sqrt((1.0 / x)) else: tmp = 0.5 * math.pow(x, -1.5) return tmp
function code(x) tmp = 0.0 if (x <= 0.5) tmp = sqrt(Float64(1.0 / x)); else tmp = Float64(0.5 * (x ^ -1.5)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.5) tmp = sqrt((1.0 / x)); else tmp = 0.5 * (x ^ -1.5); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.5], N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision], N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.5:\\
\;\;\;\;\sqrt{\frac{1}{x}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\
\end{array}
\end{array}
if x < 0.5Initial program 99.7%
add-log-exp6.2%
*-un-lft-identity6.2%
log-prod6.2%
metadata-eval6.2%
add-log-exp99.7%
pow1/299.7%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around inf 95.3%
if 0.5 < x Initial program 36.1%
frac-sub36.1%
div-inv36.1%
*-un-lft-identity36.1%
+-commutative36.1%
*-rgt-identity36.1%
metadata-eval36.1%
frac-times36.1%
un-div-inv36.1%
pow1/236.1%
pow-flip36.1%
metadata-eval36.1%
+-commutative36.1%
Applied egg-rr36.1%
associate-*r/36.1%
*-rgt-identity36.1%
times-frac36.1%
div-sub36.0%
*-inverses36.0%
/-rgt-identity36.0%
Simplified36.0%
Taylor expanded in x around inf 98.4%
expm1-log1p-u98.4%
expm1-udef34.3%
Applied egg-rr34.3%
expm1-def98.6%
expm1-log1p98.6%
Simplified98.6%
Final simplification97.0%
(FPCore (x) :precision binary64 (if (<= x 0.5) (pow x -0.5) (* 0.5 (pow x -1.5))))
double code(double x) {
double tmp;
if (x <= 0.5) {
tmp = pow(x, -0.5);
} else {
tmp = 0.5 * pow(x, -1.5);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.5d0) then
tmp = x ** (-0.5d0)
else
tmp = 0.5d0 * (x ** (-1.5d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.5) {
tmp = Math.pow(x, -0.5);
} else {
tmp = 0.5 * Math.pow(x, -1.5);
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.5: tmp = math.pow(x, -0.5) else: tmp = 0.5 * math.pow(x, -1.5) return tmp
function code(x) tmp = 0.0 if (x <= 0.5) tmp = x ^ -0.5; else tmp = Float64(0.5 * (x ^ -1.5)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.5) tmp = x ^ -0.5; else tmp = 0.5 * (x ^ -1.5); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.5], N[Power[x, -0.5], $MachinePrecision], N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.5:\\
\;\;\;\;{x}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\
\end{array}
\end{array}
if x < 0.5Initial program 99.7%
frac-sub99.7%
div-inv99.7%
*-un-lft-identity99.7%
+-commutative99.7%
*-rgt-identity99.7%
metadata-eval99.7%
frac-times99.7%
un-div-inv99.7%
pow1/299.7%
pow-flip100.0%
metadata-eval100.0%
+-commutative100.0%
Applied egg-rr100.0%
associate-*r/100.0%
*-rgt-identity100.0%
times-frac100.0%
div-sub100.0%
*-inverses100.0%
/-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 95.5%
if 0.5 < x Initial program 36.1%
frac-sub36.1%
div-inv36.1%
*-un-lft-identity36.1%
+-commutative36.1%
*-rgt-identity36.1%
metadata-eval36.1%
frac-times36.1%
un-div-inv36.1%
pow1/236.1%
pow-flip36.1%
metadata-eval36.1%
+-commutative36.1%
Applied egg-rr36.1%
associate-*r/36.1%
*-rgt-identity36.1%
times-frac36.1%
div-sub36.0%
*-inverses36.0%
/-rgt-identity36.0%
Simplified36.0%
Taylor expanded in x around inf 98.4%
expm1-log1p-u98.4%
expm1-udef34.3%
Applied egg-rr34.3%
expm1-def98.6%
expm1-log1p98.6%
Simplified98.6%
Final simplification97.1%
(FPCore (x) :precision binary64 (if (<= x 0.65) (+ (pow x -0.5) -1.0) (* 0.5 (pow x -1.5))))
double code(double x) {
double tmp;
if (x <= 0.65) {
tmp = pow(x, -0.5) + -1.0;
} else {
tmp = 0.5 * pow(x, -1.5);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.65d0) then
tmp = (x ** (-0.5d0)) + (-1.0d0)
else
tmp = 0.5d0 * (x ** (-1.5d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.65) {
tmp = Math.pow(x, -0.5) + -1.0;
} else {
tmp = 0.5 * Math.pow(x, -1.5);
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.65: tmp = math.pow(x, -0.5) + -1.0 else: tmp = 0.5 * math.pow(x, -1.5) return tmp
function code(x) tmp = 0.0 if (x <= 0.65) tmp = Float64((x ^ -0.5) + -1.0); else tmp = Float64(0.5 * (x ^ -1.5)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.65) tmp = (x ^ -0.5) + -1.0; else tmp = 0.5 * (x ^ -1.5); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.65], N[(N[Power[x, -0.5], $MachinePrecision] + -1.0), $MachinePrecision], N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.65:\\
\;\;\;\;{x}^{-0.5} + -1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\
\end{array}
\end{array}
if x < 0.650000000000000022Initial program 99.7%
sub-neg99.7%
+-commutative99.7%
add-sqr-sqrt99.7%
distribute-rgt-neg-in99.7%
fma-def99.7%
inv-pow99.7%
sqrt-pow299.7%
+-commutative99.7%
metadata-eval99.7%
inv-pow99.7%
sqrt-pow299.7%
+-commutative99.7%
metadata-eval99.7%
pow1/299.7%
pow-flip100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 98.2%
if 0.650000000000000022 < x Initial program 36.1%
frac-sub36.1%
div-inv36.1%
*-un-lft-identity36.1%
+-commutative36.1%
*-rgt-identity36.1%
metadata-eval36.1%
frac-times36.1%
un-div-inv36.1%
pow1/236.1%
pow-flip36.1%
metadata-eval36.1%
+-commutative36.1%
Applied egg-rr36.1%
associate-*r/36.1%
*-rgt-identity36.1%
times-frac36.1%
div-sub36.0%
*-inverses36.0%
/-rgt-identity36.0%
Simplified36.0%
Taylor expanded in x around inf 98.4%
expm1-log1p-u98.4%
expm1-udef34.3%
Applied egg-rr34.3%
expm1-def98.6%
expm1-log1p98.6%
Simplified98.6%
Final simplification98.4%
(FPCore (x) :precision binary64 (sqrt (/ 1.0 x)))
double code(double x) {
return sqrt((1.0 / x));
}
real(8) function code(x)
real(8), intent (in) :: x
code = sqrt((1.0d0 / x))
end function
public static double code(double x) {
return Math.sqrt((1.0 / x));
}
def code(x): return math.sqrt((1.0 / x))
function code(x) return sqrt(Float64(1.0 / x)) end
function tmp = code(x) tmp = sqrt((1.0 / x)); end
code[x_] := N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{1}{x}}
\end{array}
Initial program 66.9%
add-log-exp5.4%
*-un-lft-identity5.4%
log-prod5.4%
metadata-eval5.4%
add-log-exp66.9%
pow1/266.9%
pow-flip63.2%
metadata-eval63.2%
Applied egg-rr63.2%
+-lft-identity63.2%
Simplified63.2%
Taylor expanded in x around inf 49.1%
Final simplification49.1%
(FPCore (x) :precision binary64 (+ (* x 0.5) -1.0))
double code(double x) {
return (x * 0.5) + -1.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (x * 0.5d0) + (-1.0d0)
end function
public static double code(double x) {
return (x * 0.5) + -1.0;
}
def code(x): return (x * 0.5) + -1.0
function code(x) return Float64(Float64(x * 0.5) + -1.0) end
function tmp = code(x) tmp = (x * 0.5) + -1.0; end
code[x_] := N[(N[(x * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 + -1
\end{array}
Initial program 66.9%
sub-neg66.9%
+-commutative66.9%
add-sqr-sqrt60.0%
distribute-rgt-neg-in60.0%
fma-def51.7%
inv-pow51.7%
sqrt-pow251.7%
+-commutative51.7%
metadata-eval51.7%
inv-pow51.7%
sqrt-pow251.6%
+-commutative51.6%
metadata-eval51.6%
pow1/251.6%
pow-flip51.9%
metadata-eval51.9%
Applied egg-rr51.9%
Taylor expanded in x around 0 49.8%
Taylor expanded in x around inf 2.3%
*-commutative2.3%
Simplified2.3%
Final simplification2.3%
(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}
herbie shell --seed 2023201
(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)))))