
(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 13 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)))) 0.0)
(* 0.5 (pow x -1.5))
(/
(/ (+ x (- -1.0 x)) (* x (- -1.0 x)))
(+ (pow x -0.5) (pow (+ 1.0 x) -0.5)))))
double code(double x) {
double tmp;
if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 0.0) {
tmp = 0.5 * pow(x, -1.5);
} else {
tmp = ((x + (-1.0 - x)) / (x * (-1.0 - x))) / (pow(x, -0.5) + pow((1.0 + x), -0.5));
}
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)))) <= 0.0d0) then
tmp = 0.5d0 * (x ** (-1.5d0))
else
tmp = ((x + ((-1.0d0) - x)) / (x * ((-1.0d0) - x))) / ((x ** (-0.5d0)) + ((1.0d0 + x) ** (-0.5d0)))
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)))) <= 0.0) {
tmp = 0.5 * Math.pow(x, -1.5);
} else {
tmp = ((x + (-1.0 - x)) / (x * (-1.0 - x))) / (Math.pow(x, -0.5) + Math.pow((1.0 + x), -0.5));
}
return tmp;
}
def code(x): tmp = 0 if ((1.0 / math.sqrt(x)) + (-1.0 / math.sqrt((1.0 + x)))) <= 0.0: tmp = 0.5 * math.pow(x, -1.5) else: tmp = ((x + (-1.0 - x)) / (x * (-1.0 - x))) / (math.pow(x, -0.5) + math.pow((1.0 + x), -0.5)) return tmp
function code(x) tmp = 0.0 if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / sqrt(Float64(1.0 + x)))) <= 0.0) tmp = Float64(0.5 * (x ^ -1.5)); else tmp = Float64(Float64(Float64(x + Float64(-1.0 - x)) / Float64(x * Float64(-1.0 - x))) / Float64((x ^ -0.5) + (Float64(1.0 + x) ^ -0.5))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 0.0) tmp = 0.5 * (x ^ -1.5); else tmp = ((x + (-1.0 - x)) / (x * (-1.0 - x))) / ((x ^ -0.5) + ((1.0 + x) ^ -0.5)); 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], 0.0], N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision], N[(N[(N[(x + N[(-1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(x * N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x, -0.5], $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{1 + x}} \leq 0:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x + \left(-1 - x\right)}{x \cdot \left(-1 - x\right)}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\\
\end{array}
\end{array}
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 0.0Initial program 43.3%
flip--43.3%
frac-times19.5%
metadata-eval19.5%
add-sqr-sqrt23.0%
frac-times29.0%
metadata-eval29.0%
add-sqr-sqrt43.3%
+-commutative43.3%
pow1/243.3%
pow-flip43.3%
metadata-eval43.3%
inv-pow43.3%
sqrt-pow243.3%
+-commutative43.3%
metadata-eval43.3%
Applied egg-rr43.3%
Taylor expanded in x around inf 70.6%
exp-to-pow68.3%
*-commutative68.3%
exp-neg69.0%
distribute-lft-neg-in69.0%
metadata-eval69.0%
*-commutative69.0%
exp-to-pow71.3%
metadata-eval71.3%
pow-sqr71.4%
rem-sqrt-square100.0%
rem-square-sqrt99.5%
fabs-sqr99.5%
rem-square-sqrt100.0%
Simplified100.0%
if 0.0 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 98.4%
flip--98.3%
frac-times98.1%
metadata-eval98.1%
add-sqr-sqrt98.2%
frac-times98.2%
metadata-eval98.2%
add-sqr-sqrt98.2%
+-commutative98.2%
pow1/298.2%
pow-flip98.2%
metadata-eval98.2%
inv-pow98.2%
sqrt-pow298.2%
+-commutative98.2%
metadata-eval98.2%
Applied egg-rr98.2%
frac-2neg98.2%
metadata-eval98.2%
frac-sub99.3%
*-un-lft-identity99.3%
distribute-neg-in99.3%
metadata-eval99.3%
distribute-neg-in99.3%
metadata-eval99.3%
Applied egg-rr99.3%
*-commutative99.3%
neg-mul-199.3%
*-rgt-identity99.3%
distribute-rgt-in99.3%
neg-mul-199.3%
*-rgt-identity99.3%
distribute-lft-in99.3%
unsub-neg99.3%
*-rgt-identity99.3%
distribute-lft-neg-out99.3%
distribute-rgt-neg-in99.3%
distribute-neg-in99.3%
metadata-eval99.3%
unsub-neg99.3%
Simplified99.3%
Final simplification99.6%
(FPCore (x) :precision binary64 (if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 (sqrt (+ 1.0 x)))) 0.0) (* 0.5 (pow x -1.5)) (/ (/ (/ -1.0 x) (- -1.0 x)) (+ (pow x -0.5) (pow (+ 1.0 x) -0.5)))))
double code(double x) {
double tmp;
if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 0.0) {
tmp = 0.5 * pow(x, -1.5);
} else {
tmp = ((-1.0 / x) / (-1.0 - x)) / (pow(x, -0.5) + pow((1.0 + x), -0.5));
}
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)))) <= 0.0d0) then
tmp = 0.5d0 * (x ** (-1.5d0))
else
tmp = (((-1.0d0) / x) / ((-1.0d0) - x)) / ((x ** (-0.5d0)) + ((1.0d0 + x) ** (-0.5d0)))
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)))) <= 0.0) {
tmp = 0.5 * Math.pow(x, -1.5);
} else {
tmp = ((-1.0 / x) / (-1.0 - x)) / (Math.pow(x, -0.5) + Math.pow((1.0 + x), -0.5));
}
return tmp;
}
def code(x): tmp = 0 if ((1.0 / math.sqrt(x)) + (-1.0 / math.sqrt((1.0 + x)))) <= 0.0: tmp = 0.5 * math.pow(x, -1.5) else: tmp = ((-1.0 / x) / (-1.0 - x)) / (math.pow(x, -0.5) + math.pow((1.0 + x), -0.5)) return tmp
function code(x) tmp = 0.0 if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / sqrt(Float64(1.0 + x)))) <= 0.0) tmp = Float64(0.5 * (x ^ -1.5)); else tmp = Float64(Float64(Float64(-1.0 / x) / Float64(-1.0 - x)) / Float64((x ^ -0.5) + (Float64(1.0 + x) ^ -0.5))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 0.0) tmp = 0.5 * (x ^ -1.5); else tmp = ((-1.0 / x) / (-1.0 - x)) / ((x ^ -0.5) + ((1.0 + x) ^ -0.5)); 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], 0.0], N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision], N[(N[(N[(-1.0 / x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x, -0.5], $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{1 + x}} \leq 0:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{-1}{x}}{-1 - x}}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}\\
\end{array}
\end{array}
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 0.0Initial program 43.3%
flip--43.3%
frac-times19.5%
metadata-eval19.5%
add-sqr-sqrt23.0%
frac-times29.0%
metadata-eval29.0%
add-sqr-sqrt43.3%
+-commutative43.3%
pow1/243.3%
pow-flip43.3%
metadata-eval43.3%
inv-pow43.3%
sqrt-pow243.3%
+-commutative43.3%
metadata-eval43.3%
Applied egg-rr43.3%
Taylor expanded in x around inf 70.6%
exp-to-pow68.3%
*-commutative68.3%
exp-neg69.0%
distribute-lft-neg-in69.0%
metadata-eval69.0%
*-commutative69.0%
exp-to-pow71.3%
metadata-eval71.3%
pow-sqr71.4%
rem-sqrt-square100.0%
rem-square-sqrt99.5%
fabs-sqr99.5%
rem-square-sqrt100.0%
Simplified100.0%
if 0.0 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 98.4%
flip--98.3%
frac-times98.1%
metadata-eval98.1%
add-sqr-sqrt98.2%
frac-times98.2%
metadata-eval98.2%
add-sqr-sqrt98.2%
+-commutative98.2%
pow1/298.2%
pow-flip98.2%
metadata-eval98.2%
inv-pow98.2%
sqrt-pow298.2%
+-commutative98.2%
metadata-eval98.2%
Applied egg-rr98.2%
frac-2neg98.2%
metadata-eval98.2%
frac-sub99.3%
*-un-lft-identity99.3%
distribute-neg-in99.3%
metadata-eval99.3%
distribute-neg-in99.3%
metadata-eval99.3%
Applied egg-rr99.3%
associate-/r*99.3%
*-commutative99.3%
neg-mul-199.3%
associate--l+99.2%
+-inverses99.2%
metadata-eval99.2%
unsub-neg99.2%
Simplified99.2%
Final simplification99.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (sqrt (+ 1.0 x))))
(if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 t_0)) 2e-9)
(* (/ 1.0 (+ t_0 (sqrt x))) (/ 1.0 (+ x 0.5)))
(- (pow x -0.5) (pow (+ 1.0 x) -0.5)))))
double code(double x) {
double t_0 = sqrt((1.0 + x));
double tmp;
if (((1.0 / sqrt(x)) + (-1.0 / t_0)) <= 2e-9) {
tmp = (1.0 / (t_0 + sqrt(x))) * (1.0 / (x + 0.5));
} else {
tmp = pow(x, -0.5) - pow((1.0 + x), -0.5);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((1.0d0 + x))
if (((1.0d0 / sqrt(x)) + ((-1.0d0) / t_0)) <= 2d-9) then
tmp = (1.0d0 / (t_0 + sqrt(x))) * (1.0d0 / (x + 0.5d0))
else
tmp = (x ** (-0.5d0)) - ((1.0d0 + x) ** (-0.5d0))
end if
code = tmp
end function
public static double code(double x) {
double t_0 = Math.sqrt((1.0 + x));
double tmp;
if (((1.0 / Math.sqrt(x)) + (-1.0 / t_0)) <= 2e-9) {
tmp = (1.0 / (t_0 + Math.sqrt(x))) * (1.0 / (x + 0.5));
} else {
tmp = Math.pow(x, -0.5) - Math.pow((1.0 + x), -0.5);
}
return tmp;
}
def code(x): t_0 = math.sqrt((1.0 + x)) tmp = 0 if ((1.0 / math.sqrt(x)) + (-1.0 / t_0)) <= 2e-9: tmp = (1.0 / (t_0 + math.sqrt(x))) * (1.0 / (x + 0.5)) else: tmp = math.pow(x, -0.5) - math.pow((1.0 + x), -0.5) return tmp
function code(x) t_0 = sqrt(Float64(1.0 + x)) tmp = 0.0 if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / t_0)) <= 2e-9) tmp = Float64(Float64(1.0 / Float64(t_0 + sqrt(x))) * Float64(1.0 / Float64(x + 0.5))); else tmp = Float64((x ^ -0.5) - (Float64(1.0 + x) ^ -0.5)); end return tmp end
function tmp_2 = code(x) t_0 = sqrt((1.0 + x)); tmp = 0.0; if (((1.0 / sqrt(x)) + (-1.0 / t_0)) <= 2e-9) tmp = (1.0 / (t_0 + sqrt(x))) * (1.0 / (x + 0.5)); else tmp = (x ^ -0.5) - ((1.0 + x) ^ -0.5); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], 2e-9], N[(N[(1.0 / N[(t$95$0 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] - N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{1 + x}\\
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{t_0} \leq 2 \cdot 10^{-9}:\\
\;\;\;\;\frac{1}{t_0 + \sqrt{x}} \cdot \frac{1}{x + 0.5}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\
\end{array}
\end{array}
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 2.00000000000000012e-9Initial program 43.7%
frac-sub43.7%
div-inv43.7%
*-un-lft-identity43.7%
*-rgt-identity43.7%
+-commutative43.7%
sqrt-unprod43.7%
+-commutative43.7%
Applied egg-rr43.7%
flip--43.7%
add-sqr-sqrt44.2%
add-sqr-sqrt44.6%
Applied egg-rr44.6%
associate--l+85.7%
+-inverses85.7%
metadata-eval85.7%
+-commutative85.7%
Simplified85.7%
Taylor expanded in x around inf 99.4%
+-commutative7.5%
Simplified99.4%
if 2.00000000000000012e-9 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 99.3%
*-un-lft-identity99.3%
clear-num99.3%
associate-/r/99.3%
prod-diff99.3%
*-un-lft-identity99.3%
fma-neg99.3%
*-un-lft-identity99.3%
pow1/299.3%
pow-flip99.8%
metadata-eval99.8%
pow1/299.8%
pow-flip99.8%
+-commutative99.8%
metadata-eval99.8%
Applied egg-rr99.8%
+-commutative99.8%
sub-neg99.8%
fma-udef99.8%
distribute-lft1-in99.8%
metadata-eval99.8%
mul0-lft99.8%
+-commutative99.8%
associate-+r+99.8%
sub-neg99.8%
neg-sub099.8%
+-commutative99.8%
sub-neg99.8%
Simplified99.8%
Final simplification99.6%
(FPCore (x) :precision binary64 (if (<= (+ (/ 1.0 (sqrt x)) (/ -1.0 (sqrt (+ 1.0 x)))) 1e-16) (* 0.5 (pow x -1.5)) (- (pow x -0.5) (pow (+ 1.0 x) -0.5))))
double code(double x) {
double tmp;
if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 1e-16) {
tmp = 0.5 * pow(x, -1.5);
} else {
tmp = pow(x, -0.5) - pow((1.0 + x), -0.5);
}
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)))) <= 1d-16) then
tmp = 0.5d0 * (x ** (-1.5d0))
else
tmp = (x ** (-0.5d0)) - ((1.0d0 + x) ** (-0.5d0))
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)))) <= 1e-16) {
tmp = 0.5 * Math.pow(x, -1.5);
} else {
tmp = Math.pow(x, -0.5) - Math.pow((1.0 + x), -0.5);
}
return tmp;
}
def code(x): tmp = 0 if ((1.0 / math.sqrt(x)) + (-1.0 / math.sqrt((1.0 + x)))) <= 1e-16: tmp = 0.5 * math.pow(x, -1.5) else: tmp = math.pow(x, -0.5) - math.pow((1.0 + x), -0.5) return tmp
function code(x) tmp = 0.0 if (Float64(Float64(1.0 / sqrt(x)) + Float64(-1.0 / sqrt(Float64(1.0 + x)))) <= 1e-16) tmp = Float64(0.5 * (x ^ -1.5)); else tmp = Float64((x ^ -0.5) - (Float64(1.0 + x) ^ -0.5)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((1.0 / sqrt(x)) + (-1.0 / sqrt((1.0 + x)))) <= 1e-16) tmp = 0.5 * (x ^ -1.5); else tmp = (x ^ -0.5) - ((1.0 + x) ^ -0.5); 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], 1e-16], N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] - N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{x}} + \frac{-1}{\sqrt{1 + x}} \leq 10^{-16}:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} - {\left(1 + x\right)}^{-0.5}\\
\end{array}
\end{array}
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 9.9999999999999998e-17Initial program 43.3%
flip--43.3%
frac-times19.7%
metadata-eval19.7%
add-sqr-sqrt23.2%
frac-times29.1%
metadata-eval29.1%
add-sqr-sqrt43.3%
+-commutative43.3%
pow1/243.3%
pow-flip43.3%
metadata-eval43.3%
inv-pow43.3%
sqrt-pow243.3%
+-commutative43.3%
metadata-eval43.3%
Applied egg-rr43.3%
Taylor expanded in x around inf 70.7%
exp-to-pow68.3%
*-commutative68.3%
exp-neg69.0%
distribute-lft-neg-in69.0%
metadata-eval69.0%
*-commutative69.0%
exp-to-pow71.4%
metadata-eval71.4%
pow-sqr71.4%
rem-sqrt-square99.8%
rem-square-sqrt99.3%
fabs-sqr99.3%
rem-square-sqrt99.8%
Simplified99.8%
if 9.9999999999999998e-17 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 98.8%
*-un-lft-identity98.8%
clear-num98.8%
associate-/r/98.8%
prod-diff98.8%
*-un-lft-identity98.8%
fma-neg98.8%
*-un-lft-identity98.8%
pow1/298.8%
pow-flip99.3%
metadata-eval99.3%
pow1/299.3%
pow-flip99.3%
+-commutative99.3%
metadata-eval99.3%
Applied egg-rr99.3%
+-commutative99.3%
sub-neg99.3%
fma-udef99.3%
distribute-lft1-in99.3%
metadata-eval99.3%
mul0-lft99.3%
+-commutative99.3%
associate-+r+99.3%
sub-neg99.3%
neg-sub099.3%
+-commutative99.3%
sub-neg99.3%
Simplified99.3%
Final simplification99.5%
(FPCore (x) :precision binary64 (let* ((t_0 (sqrt (+ 1.0 x)))) (/ (/ 1.0 (+ x (* t_0 (sqrt x)))) t_0)))
double code(double x) {
double t_0 = sqrt((1.0 + x));
return (1.0 / (x + (t_0 * sqrt(x)))) / t_0;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
t_0 = sqrt((1.0d0 + x))
code = (1.0d0 / (x + (t_0 * sqrt(x)))) / t_0
end function
public static double code(double x) {
double t_0 = Math.sqrt((1.0 + x));
return (1.0 / (x + (t_0 * Math.sqrt(x)))) / t_0;
}
def code(x): t_0 = math.sqrt((1.0 + x)) return (1.0 / (x + (t_0 * math.sqrt(x)))) / t_0
function code(x) t_0 = sqrt(Float64(1.0 + x)) return Float64(Float64(1.0 / Float64(x + Float64(t_0 * sqrt(x)))) / t_0) end
function tmp = code(x) t_0 = sqrt((1.0 + x)); tmp = (1.0 / (x + (t_0 * sqrt(x)))) / t_0; end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, N[(N[(1.0 / N[(x + N[(t$95$0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{1 + x}\\
\frac{\frac{1}{x + t_0 \cdot \sqrt{x}}}{t_0}
\end{array}
\end{array}
Initial program 71.3%
frac-sub71.3%
div-inv71.3%
*-un-lft-identity71.3%
*-rgt-identity71.3%
+-commutative71.3%
sqrt-unprod71.2%
+-commutative71.2%
Applied egg-rr71.2%
flip--71.2%
add-sqr-sqrt71.6%
add-sqr-sqrt71.8%
Applied egg-rr71.8%
associate--l+92.5%
+-inverses92.5%
metadata-eval92.5%
+-commutative92.5%
Simplified92.5%
un-div-inv92.5%
sqrt-prod99.3%
associate-/r*99.3%
Applied egg-rr99.3%
associate-/l/99.3%
distribute-rgt-in99.3%
rem-square-sqrt99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x) :precision binary64 (if (<= x 0.95) (- (/ 1.0 (sqrt x)) (+ 1.0 (* x (+ -0.5 (* x 0.375))))) (* 0.5 (pow x -1.5))))
double code(double x) {
double tmp;
if (x <= 0.95) {
tmp = (1.0 / sqrt(x)) - (1.0 + (x * (-0.5 + (x * 0.375))));
} 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.95d0) then
tmp = (1.0d0 / sqrt(x)) - (1.0d0 + (x * ((-0.5d0) + (x * 0.375d0))))
else
tmp = 0.5d0 * (x ** (-1.5d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.95) {
tmp = (1.0 / Math.sqrt(x)) - (1.0 + (x * (-0.5 + (x * 0.375))));
} else {
tmp = 0.5 * Math.pow(x, -1.5);
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.95: tmp = (1.0 / math.sqrt(x)) - (1.0 + (x * (-0.5 + (x * 0.375)))) else: tmp = 0.5 * math.pow(x, -1.5) return tmp
function code(x) tmp = 0.0 if (x <= 0.95) tmp = Float64(Float64(1.0 / sqrt(x)) - Float64(1.0 + Float64(x * Float64(-0.5 + Float64(x * 0.375))))); else tmp = Float64(0.5 * (x ^ -1.5)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.95) tmp = (1.0 / sqrt(x)) - (1.0 + (x * (-0.5 + (x * 0.375)))); else tmp = 0.5 * (x ^ -1.5); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.95], N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[(1.0 + N[(x * N[(-0.5 + N[(x * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.95:\\
\;\;\;\;\frac{1}{\sqrt{x}} - \left(1 + x \cdot \left(-0.5 + x \cdot 0.375\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\
\end{array}
\end{array}
if x < 0.94999999999999996Initial program 99.5%
Taylor expanded in x around 0 97.1%
*-commutative97.1%
*-commutative97.1%
unpow297.1%
associate-*l*97.1%
distribute-lft-out97.1%
Simplified97.1%
if 0.94999999999999996 < x Initial program 44.8%
flip--44.7%
frac-times22.0%
metadata-eval22.0%
add-sqr-sqrt25.4%
frac-times31.1%
metadata-eval31.1%
add-sqr-sqrt44.8%
+-commutative44.8%
pow1/244.8%
pow-flip44.8%
metadata-eval44.8%
inv-pow44.8%
sqrt-pow244.8%
+-commutative44.8%
metadata-eval44.8%
Applied egg-rr44.8%
Taylor expanded in x around inf 69.4%
exp-to-pow67.1%
*-commutative67.1%
exp-neg67.8%
distribute-lft-neg-in67.8%
metadata-eval67.8%
*-commutative67.8%
exp-to-pow70.0%
metadata-eval70.0%
pow-sqr70.1%
rem-sqrt-square97.4%
rem-square-sqrt96.9%
fabs-sqr96.9%
rem-square-sqrt97.4%
Simplified97.4%
Final simplification97.2%
(FPCore (x) :precision binary64 (if (<= x 1.0) (+ -1.0 (+ (pow x -0.5) (* x 0.5))) (* 0.5 (pow x -1.5))))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = -1.0 + (pow(x, -0.5) + (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.0d0) then
tmp = (-1.0d0) + ((x ** (-0.5d0)) + (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.0) {
tmp = -1.0 + (Math.pow(x, -0.5) + (x * 0.5));
} else {
tmp = 0.5 * Math.pow(x, -1.5);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.0: tmp = -1.0 + (math.pow(x, -0.5) + (x * 0.5)) else: tmp = 0.5 * math.pow(x, -1.5) return tmp
function code(x) tmp = 0.0 if (x <= 1.0) tmp = Float64(-1.0 + Float64((x ^ -0.5) + 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.0) tmp = -1.0 + ((x ^ -0.5) + (x * 0.5)); else tmp = 0.5 * (x ^ -1.5); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.0], N[(-1.0 + N[(N[Power[x, -0.5], $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;-1 + \left({x}^{-0.5} + x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\
\end{array}
\end{array}
if x < 1Initial 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%
pow1/299.4%
pow-flip99.9%
metadata-eval99.9%
pow1/299.9%
pow-flip99.9%
+-commutative99.9%
metadata-eval99.9%
Applied egg-rr99.9%
+-commutative99.9%
sub-neg99.9%
fma-udef99.9%
distribute-lft1-in99.9%
metadata-eval99.9%
mul0-lft99.9%
+-commutative99.9%
associate-+r+99.9%
sub-neg99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in x around 0 97.1%
if 1 < x Initial program 44.8%
flip--44.7%
frac-times22.0%
metadata-eval22.0%
add-sqr-sqrt25.4%
frac-times31.1%
metadata-eval31.1%
add-sqr-sqrt44.8%
+-commutative44.8%
pow1/244.8%
pow-flip44.8%
metadata-eval44.8%
inv-pow44.8%
sqrt-pow244.8%
+-commutative44.8%
metadata-eval44.8%
Applied egg-rr44.8%
Taylor expanded in x around inf 69.4%
exp-to-pow67.1%
*-commutative67.1%
exp-neg67.8%
distribute-lft-neg-in67.8%
metadata-eval67.8%
*-commutative67.8%
exp-to-pow70.0%
metadata-eval70.0%
pow-sqr70.1%
rem-sqrt-square97.4%
rem-square-sqrt96.9%
fabs-sqr96.9%
rem-square-sqrt97.4%
Simplified97.4%
Final simplification97.2%
(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.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%
pow1/299.5%
pow-flip99.9%
metadata-eval99.9%
pow1/299.9%
pow-flip99.9%
+-commutative99.9%
metadata-eval99.9%
Applied egg-rr99.9%
+-commutative99.9%
sub-neg99.9%
fma-udef99.9%
distribute-lft1-in99.9%
metadata-eval99.9%
mul0-lft99.9%
+-commutative99.9%
associate-+r+99.9%
sub-neg99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Applied egg-rr95.2%
associate-*r/95.2%
*-rgt-identity95.2%
Simplified95.2%
Taylor expanded in x around inf 94.4%
inv-pow94.4%
sqrt-pow194.6%
metadata-eval94.6%
expm1-log1p-u87.4%
expm1-udef87.4%
Applied egg-rr87.4%
expm1-def87.4%
expm1-log1p94.6%
Simplified94.6%
if 0.5 < x Initial program 45.2%
flip--45.1%
frac-times22.6%
metadata-eval22.6%
add-sqr-sqrt26.0%
frac-times31.6%
metadata-eval31.6%
add-sqr-sqrt45.2%
+-commutative45.2%
pow1/245.2%
pow-flip45.2%
metadata-eval45.2%
inv-pow45.2%
sqrt-pow245.2%
+-commutative45.2%
metadata-eval45.2%
Applied egg-rr45.2%
Taylor expanded in x around inf 69.0%
exp-to-pow66.8%
*-commutative66.8%
exp-neg67.4%
distribute-lft-neg-in67.4%
metadata-eval67.4%
*-commutative67.4%
exp-to-pow69.7%
metadata-eval69.7%
pow-sqr69.7%
rem-sqrt-square96.8%
rem-square-sqrt96.3%
fabs-sqr96.3%
rem-square-sqrt96.8%
Simplified96.8%
Final simplification95.7%
(FPCore (x) :precision binary64 (if (<= x 0.65) (+ -1.0 (pow x -0.5)) (* 0.5 (pow x -1.5))))
double code(double x) {
double tmp;
if (x <= 0.65) {
tmp = -1.0 + 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.65d0) then
tmp = (-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 <= 0.65) {
tmp = -1.0 + Math.pow(x, -0.5);
} else {
tmp = 0.5 * Math.pow(x, -1.5);
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.65: tmp = -1.0 + 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.65) tmp = Float64(-1.0 + (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.65) tmp = -1.0 + (x ^ -0.5); else tmp = 0.5 * (x ^ -1.5); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.65], N[(-1.0 + N[Power[x, -0.5], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.65:\\
\;\;\;\;-1 + {x}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\
\end{array}
\end{array}
if x < 0.650000000000000022Initial 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%
pow1/299.5%
pow-flip99.9%
metadata-eval99.9%
pow1/299.9%
pow-flip99.9%
+-commutative99.9%
metadata-eval99.9%
Applied egg-rr99.9%
+-commutative99.9%
sub-neg99.9%
fma-udef99.9%
distribute-lft1-in99.9%
metadata-eval99.9%
mul0-lft99.9%
+-commutative99.9%
associate-+r+99.9%
sub-neg99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in x around 0 96.8%
if 0.650000000000000022 < x Initial program 45.2%
flip--45.1%
frac-times22.6%
metadata-eval22.6%
add-sqr-sqrt26.0%
frac-times31.6%
metadata-eval31.6%
add-sqr-sqrt45.2%
+-commutative45.2%
pow1/245.2%
pow-flip45.2%
metadata-eval45.2%
inv-pow45.2%
sqrt-pow245.2%
+-commutative45.2%
metadata-eval45.2%
Applied egg-rr45.2%
Taylor expanded in x around inf 69.0%
exp-to-pow66.8%
*-commutative66.8%
exp-neg67.4%
distribute-lft-neg-in67.4%
metadata-eval67.4%
*-commutative67.4%
exp-to-pow69.7%
metadata-eval69.7%
pow-sqr69.7%
rem-sqrt-square96.8%
rem-square-sqrt96.3%
fabs-sqr96.3%
rem-square-sqrt96.8%
Simplified96.8%
Final simplification96.8%
(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}
Initial program 71.3%
*-un-lft-identity71.3%
clear-num71.3%
associate-/r/71.3%
prod-diff71.3%
*-un-lft-identity71.3%
fma-neg71.3%
*-un-lft-identity71.3%
pow1/271.3%
pow-flip69.2%
metadata-eval69.2%
pow1/269.2%
pow-flip71.5%
+-commutative71.5%
metadata-eval71.5%
Applied egg-rr71.5%
+-commutative71.5%
sub-neg71.5%
fma-udef71.5%
distribute-lft1-in71.5%
metadata-eval71.5%
mul0-lft71.5%
+-commutative71.5%
associate-+r+71.5%
sub-neg71.5%
neg-sub071.5%
+-commutative71.5%
sub-neg71.5%
Simplified71.5%
Applied egg-rr48.7%
associate-*r/48.7%
*-rgt-identity48.7%
Simplified48.7%
Taylor expanded in x around inf 48.3%
inv-pow48.3%
sqrt-pow148.4%
metadata-eval48.4%
expm1-log1p-u44.9%
expm1-udef63.8%
Applied egg-rr63.8%
expm1-def44.9%
expm1-log1p48.4%
Simplified48.4%
Final simplification48.4%
(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}
Initial program 71.3%
frac-sub71.3%
div-inv71.3%
*-un-lft-identity71.3%
*-rgt-identity71.3%
+-commutative71.3%
sqrt-unprod71.2%
+-commutative71.2%
Applied egg-rr71.2%
Taylor expanded in x around 0 67.7%
Taylor expanded in x around inf 7.5%
+-commutative7.5%
Simplified7.5%
Final simplification7.5%
(FPCore (x) :precision binary64 (/ 1.0 x))
double code(double x) {
return 1.0 / x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0 / x
end function
public static double code(double x) {
return 1.0 / x;
}
def code(x): return 1.0 / x
function code(x) return Float64(1.0 / x) end
function tmp = code(x) tmp = 1.0 / x; end
code[x_] := N[(1.0 / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x}
\end{array}
Initial program 71.3%
frac-sub71.3%
div-inv71.3%
*-un-lft-identity71.3%
*-rgt-identity71.3%
+-commutative71.3%
sqrt-unprod71.2%
+-commutative71.2%
Applied egg-rr71.2%
Taylor expanded in x around 0 67.7%
Taylor expanded in x around inf 7.5%
Final simplification7.5%
(FPCore (x) :precision binary64 -1.0)
double code(double x) {
return -1.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = -1.0d0
end function
public static double code(double x) {
return -1.0;
}
def code(x): return -1.0
function code(x) return -1.0 end
function tmp = code(x) tmp = -1.0; end
code[x_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 71.3%
Taylor expanded in x around 0 47.7%
Taylor expanded in x around inf 2.0%
Final simplification2.0%
(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 2023332
(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)))))