
(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 14 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
(let* ((t_0 (sqrt (+ x 1.0))))
(if (<= (- (/ 1.0 (sqrt x)) (/ 1.0 t_0)) 0.0)
(* 0.5 (pow x -1.5))
(/ (/ 1.0 (+ t_0 (sqrt x))) (sqrt (* x (+ x 1.0)))))))
double code(double x) {
double t_0 = sqrt((x + 1.0));
double tmp;
if (((1.0 / sqrt(x)) - (1.0 / t_0)) <= 0.0) {
tmp = 0.5 * pow(x, -1.5);
} else {
tmp = (1.0 / (t_0 + sqrt(x))) / sqrt((x * (x + 1.0)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((x + 1.0d0))
if (((1.0d0 / sqrt(x)) - (1.0d0 / t_0)) <= 0.0d0) then
tmp = 0.5d0 * (x ** (-1.5d0))
else
tmp = (1.0d0 / (t_0 + sqrt(x))) / sqrt((x * (x + 1.0d0)))
end if
code = tmp
end function
public static double code(double x) {
double t_0 = Math.sqrt((x + 1.0));
double tmp;
if (((1.0 / Math.sqrt(x)) - (1.0 / t_0)) <= 0.0) {
tmp = 0.5 * Math.pow(x, -1.5);
} else {
tmp = (1.0 / (t_0 + Math.sqrt(x))) / Math.sqrt((x * (x + 1.0)));
}
return tmp;
}
def code(x): t_0 = math.sqrt((x + 1.0)) tmp = 0 if ((1.0 / math.sqrt(x)) - (1.0 / t_0)) <= 0.0: tmp = 0.5 * math.pow(x, -1.5) else: tmp = (1.0 / (t_0 + math.sqrt(x))) / math.sqrt((x * (x + 1.0))) return tmp
function code(x) t_0 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (Float64(Float64(1.0 / sqrt(x)) - Float64(1.0 / t_0)) <= 0.0) tmp = Float64(0.5 * (x ^ -1.5)); else tmp = Float64(Float64(1.0 / Float64(t_0 + sqrt(x))) / sqrt(Float64(x * Float64(x + 1.0)))); end return tmp end
function tmp_2 = code(x) t_0 = sqrt((x + 1.0)); tmp = 0.0; if (((1.0 / sqrt(x)) - (1.0 / t_0)) <= 0.0) tmp = 0.5 * (x ^ -1.5); else tmp = (1.0 / (t_0 + sqrt(x))) / sqrt((x * (x + 1.0))); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], 0.0], N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(t$95$0 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{x + 1}\\
\mathbf{if}\;\frac{1}{\sqrt{x}} - \frac{1}{t_0} \leq 0:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{t_0 + \sqrt{x}}}{\sqrt{x \cdot \left(x + 1\right)}}\\
\end{array}
\end{array}
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 0.0Initial program 38.6%
*-un-lft-identity38.6%
clear-num38.6%
associate-/r/38.6%
prod-diff38.6%
*-un-lft-identity38.6%
fma-neg38.6%
*-un-lft-identity38.6%
pow1/238.6%
pow-flip26.3%
metadata-eval26.3%
pow1/226.3%
pow-flip38.6%
+-commutative38.6%
metadata-eval38.6%
Applied egg-rr38.6%
+-commutative38.6%
sub-neg38.6%
fma-udef38.6%
distribute-lft1-in38.6%
metadata-eval38.6%
mul0-lft38.6%
+-commutative38.6%
associate-+r+38.6%
sub-neg38.6%
neg-sub038.6%
+-commutative38.6%
sub-neg38.6%
Simplified38.6%
flip--38.6%
pow-prod-up21.6%
metadata-eval21.6%
inv-pow21.6%
pow-prod-up38.6%
metadata-eval38.6%
inv-pow38.6%
+-commutative38.6%
+-commutative38.6%
Applied egg-rr38.6%
Taylor expanded in x around inf 66.1%
unpow-166.1%
exp-to-pow63.9%
*-commutative63.9%
log-pow64.7%
associate-*r*64.7%
metadata-eval64.7%
*-commutative64.7%
exp-to-pow67.0%
metadata-eval67.0%
pow-sqr67.1%
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.2%
frac-sub98.3%
*-un-lft-identity98.3%
*-rgt-identity98.3%
+-commutative98.3%
sqrt-unprod98.3%
+-commutative98.3%
Applied egg-rr98.3%
flip--99.1%
div-inv99.1%
add-sqr-sqrt98.7%
add-sqr-sqrt99.5%
Applied egg-rr99.5%
associate-*r/99.5%
*-rgt-identity99.5%
associate--l+99.5%
+-inverses99.5%
metadata-eval99.5%
Simplified99.5%
Final simplification99.7%
(FPCore (x)
:precision binary64
(let* ((t_0 (sqrt (+ x 1.0))))
(if (<= (- (/ 1.0 (sqrt x)) (/ 1.0 t_0)) 5e-10)
(/ (/ 1.0 (+ t_0 (sqrt x))) (+ x 0.5))
(+ (pow x -0.5) (/ -1.0 t_0)))))
double code(double x) {
double t_0 = sqrt((x + 1.0));
double tmp;
if (((1.0 / sqrt(x)) - (1.0 / t_0)) <= 5e-10) {
tmp = (1.0 / (t_0 + sqrt(x))) / (x + 0.5);
} else {
tmp = pow(x, -0.5) + (-1.0 / t_0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((x + 1.0d0))
if (((1.0d0 / sqrt(x)) - (1.0d0 / t_0)) <= 5d-10) then
tmp = (1.0d0 / (t_0 + sqrt(x))) / (x + 0.5d0)
else
tmp = (x ** (-0.5d0)) + ((-1.0d0) / t_0)
end if
code = tmp
end function
public static double code(double x) {
double t_0 = Math.sqrt((x + 1.0));
double tmp;
if (((1.0 / Math.sqrt(x)) - (1.0 / t_0)) <= 5e-10) {
tmp = (1.0 / (t_0 + Math.sqrt(x))) / (x + 0.5);
} else {
tmp = Math.pow(x, -0.5) + (-1.0 / t_0);
}
return tmp;
}
def code(x): t_0 = math.sqrt((x + 1.0)) tmp = 0 if ((1.0 / math.sqrt(x)) - (1.0 / t_0)) <= 5e-10: tmp = (1.0 / (t_0 + math.sqrt(x))) / (x + 0.5) else: tmp = math.pow(x, -0.5) + (-1.0 / t_0) return tmp
function code(x) t_0 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (Float64(Float64(1.0 / sqrt(x)) - Float64(1.0 / t_0)) <= 5e-10) tmp = Float64(Float64(1.0 / Float64(t_0 + sqrt(x))) / Float64(x + 0.5)); else tmp = Float64((x ^ -0.5) + Float64(-1.0 / t_0)); end return tmp end
function tmp_2 = code(x) t_0 = sqrt((x + 1.0)); tmp = 0.0; if (((1.0 / sqrt(x)) - (1.0 / t_0)) <= 5e-10) tmp = (1.0 / (t_0 + sqrt(x))) / (x + 0.5); else tmp = (x ^ -0.5) + (-1.0 / t_0); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], 5e-10], N[(N[(1.0 / N[(t$95$0 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 0.5), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] + N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{x + 1}\\
\mathbf{if}\;\frac{1}{\sqrt{x}} - \frac{1}{t_0} \leq 5 \cdot 10^{-10}:\\
\;\;\;\;\frac{\frac{1}{t_0 + \sqrt{x}}}{x + 0.5}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} + \frac{-1}{t_0}\\
\end{array}
\end{array}
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 5.00000000000000031e-10Initial program 39.0%
frac-sub39.0%
*-un-lft-identity39.0%
*-rgt-identity39.0%
+-commutative39.0%
sqrt-unprod39.0%
+-commutative39.0%
Applied egg-rr39.0%
flip--39.7%
div-inv39.7%
add-sqr-sqrt39.8%
add-sqr-sqrt40.0%
Applied egg-rr40.0%
associate-*r/40.0%
*-rgt-identity40.0%
associate--l+83.9%
+-inverses83.9%
metadata-eval83.9%
Simplified83.9%
Taylor expanded in x around inf 99.5%
+-commutative99.5%
Simplified99.5%
if 5.00000000000000031e-10 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 99.3%
expm1-log1p-u92.4%
expm1-udef92.2%
pow1/292.2%
pow-flip92.2%
metadata-eval92.2%
Applied egg-rr92.2%
expm1-def92.4%
expm1-log1p99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (sqrt (+ x 1.0))))
(if (<= (- (/ 1.0 (sqrt x)) (/ 1.0 t_0)) 5e-23)
(* 0.5 (pow x -1.5))
(+ (pow x -0.5) (/ -1.0 t_0)))))
double code(double x) {
double t_0 = sqrt((x + 1.0));
double tmp;
if (((1.0 / sqrt(x)) - (1.0 / t_0)) <= 5e-23) {
tmp = 0.5 * pow(x, -1.5);
} else {
tmp = pow(x, -0.5) + (-1.0 / t_0);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((x + 1.0d0))
if (((1.0d0 / sqrt(x)) - (1.0d0 / t_0)) <= 5d-23) then
tmp = 0.5d0 * (x ** (-1.5d0))
else
tmp = (x ** (-0.5d0)) + ((-1.0d0) / t_0)
end if
code = tmp
end function
public static double code(double x) {
double t_0 = Math.sqrt((x + 1.0));
double tmp;
if (((1.0 / Math.sqrt(x)) - (1.0 / t_0)) <= 5e-23) {
tmp = 0.5 * Math.pow(x, -1.5);
} else {
tmp = Math.pow(x, -0.5) + (-1.0 / t_0);
}
return tmp;
}
def code(x): t_0 = math.sqrt((x + 1.0)) tmp = 0 if ((1.0 / math.sqrt(x)) - (1.0 / t_0)) <= 5e-23: tmp = 0.5 * math.pow(x, -1.5) else: tmp = math.pow(x, -0.5) + (-1.0 / t_0) return tmp
function code(x) t_0 = sqrt(Float64(x + 1.0)) tmp = 0.0 if (Float64(Float64(1.0 / sqrt(x)) - Float64(1.0 / t_0)) <= 5e-23) tmp = Float64(0.5 * (x ^ -1.5)); else tmp = Float64((x ^ -0.5) + Float64(-1.0 / t_0)); end return tmp end
function tmp_2 = code(x) t_0 = sqrt((x + 1.0)); tmp = 0.0; if (((1.0 / sqrt(x)) - (1.0 / t_0)) <= 5e-23) tmp = 0.5 * (x ^ -1.5); else tmp = (x ^ -0.5) + (-1.0 / t_0); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], 5e-23], N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision], N[(N[Power[x, -0.5], $MachinePrecision] + N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{x + 1}\\
\mathbf{if}\;\frac{1}{\sqrt{x}} - \frac{1}{t_0} \leq 5 \cdot 10^{-23}:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\
\mathbf{else}:\\
\;\;\;\;{x}^{-0.5} + \frac{-1}{t_0}\\
\end{array}
\end{array}
if (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) < 5.0000000000000002e-23Initial program 38.5%
*-un-lft-identity38.5%
clear-num38.5%
associate-/r/38.5%
prod-diff38.5%
*-un-lft-identity38.5%
fma-neg38.5%
*-un-lft-identity38.5%
pow1/238.5%
pow-flip26.3%
metadata-eval26.3%
pow1/226.3%
pow-flip38.5%
+-commutative38.5%
metadata-eval38.5%
Applied egg-rr38.5%
+-commutative38.5%
sub-neg38.5%
fma-udef38.5%
distribute-lft1-in38.5%
metadata-eval38.5%
mul0-lft38.5%
+-commutative38.5%
associate-+r+38.5%
sub-neg38.5%
neg-sub038.5%
+-commutative38.5%
sub-neg38.5%
Simplified38.5%
flip--38.5%
pow-prod-up21.6%
metadata-eval21.6%
inv-pow21.6%
pow-prod-up38.5%
metadata-eval38.5%
inv-pow38.5%
+-commutative38.5%
+-commutative38.5%
Applied egg-rr38.5%
Taylor expanded in x around inf 66.3%
unpow-166.3%
exp-to-pow64.1%
*-commutative64.1%
log-pow64.9%
associate-*r*64.9%
metadata-eval64.9%
*-commutative64.9%
exp-to-pow67.2%
metadata-eval67.2%
pow-sqr67.3%
rem-sqrt-square99.9%
rem-square-sqrt99.5%
fabs-sqr99.5%
rem-square-sqrt99.9%
Simplified99.9%
if 5.0000000000000002e-23 < (-.f64 (/.f64 1 (sqrt.f64 x)) (/.f64 1 (sqrt.f64 (+.f64 x 1)))) Initial program 98.8%
expm1-log1p-u92.0%
expm1-udef91.6%
pow1/291.6%
pow-flip91.6%
metadata-eval91.6%
Applied egg-rr91.6%
expm1-def92.0%
expm1-log1p99.1%
Simplified99.1%
Final simplification99.5%
(FPCore (x) :precision binary64 (let* ((t_0 (sqrt (+ x 1.0)))) (/ (pow x -0.5) (* t_0 (+ t_0 (sqrt x))))))
double code(double x) {
double t_0 = sqrt((x + 1.0));
return pow(x, -0.5) / (t_0 * (t_0 + sqrt(x)));
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
t_0 = sqrt((x + 1.0d0))
code = (x ** (-0.5d0)) / (t_0 * (t_0 + sqrt(x)))
end function
public static double code(double x) {
double t_0 = Math.sqrt((x + 1.0));
return Math.pow(x, -0.5) / (t_0 * (t_0 + Math.sqrt(x)));
}
def code(x): t_0 = math.sqrt((x + 1.0)) return math.pow(x, -0.5) / (t_0 * (t_0 + math.sqrt(x)))
function code(x) t_0 = sqrt(Float64(x + 1.0)) return Float64((x ^ -0.5) / Float64(t_0 * Float64(t_0 + sqrt(x)))) end
function tmp = code(x) t_0 = sqrt((x + 1.0)); tmp = (x ^ -0.5) / (t_0 * (t_0 + sqrt(x))); end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, N[(N[Power[x, -0.5], $MachinePrecision] / N[(t$95$0 * N[(t$95$0 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{x + 1}\\
\frac{{x}^{-0.5}}{t_0 \cdot \left(t_0 + \sqrt{x}\right)}
\end{array}
\end{array}
Initial program 68.2%
frac-sub68.2%
*-un-lft-identity68.2%
*-rgt-identity68.2%
+-commutative68.2%
sqrt-unprod68.2%
+-commutative68.2%
Applied egg-rr68.2%
flip--68.6%
div-inv68.6%
add-sqr-sqrt68.6%
add-sqr-sqrt68.8%
Applied egg-rr68.8%
associate-*r/68.8%
*-rgt-identity68.8%
associate--l+91.5%
+-inverses91.5%
metadata-eval91.5%
Simplified91.5%
*-un-lft-identity91.5%
sqrt-prod99.4%
times-frac99.4%
pow1/299.4%
pow-flip99.6%
metadata-eval99.6%
Applied egg-rr99.6%
associate-/l/99.6%
associate-*r/99.6%
*-rgt-identity99.6%
+-commutative99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x) :precision binary64 (/ 1.0 (* (+ (sqrt (+ x 1.0)) (sqrt x)) (hypot (sqrt x) x))))
double code(double x) {
return 1.0 / ((sqrt((x + 1.0)) + sqrt(x)) * hypot(sqrt(x), x));
}
public static double code(double x) {
return 1.0 / ((Math.sqrt((x + 1.0)) + Math.sqrt(x)) * Math.hypot(Math.sqrt(x), x));
}
def code(x): return 1.0 / ((math.sqrt((x + 1.0)) + math.sqrt(x)) * math.hypot(math.sqrt(x), x))
function code(x) return Float64(1.0 / Float64(Float64(sqrt(Float64(x + 1.0)) + sqrt(x)) * hypot(sqrt(x), x))) end
function tmp = code(x) tmp = 1.0 / ((sqrt((x + 1.0)) + sqrt(x)) * hypot(sqrt(x), x)); end
code[x_] := N[(1.0 / N[(N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Sqrt[x], $MachinePrecision] ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\left(\sqrt{x + 1} + \sqrt{x}\right) \cdot \mathsf{hypot}\left(\sqrt{x}, x\right)}
\end{array}
Initial program 68.2%
frac-sub68.2%
*-un-lft-identity68.2%
*-rgt-identity68.2%
+-commutative68.2%
sqrt-unprod68.2%
+-commutative68.2%
Applied egg-rr68.2%
flip--68.6%
div-inv68.6%
add-sqr-sqrt68.6%
add-sqr-sqrt68.8%
Applied egg-rr68.8%
associate-*r/68.8%
*-rgt-identity68.8%
associate--l+91.5%
+-inverses91.5%
metadata-eval91.5%
Simplified91.5%
expm1-log1p-u88.2%
expm1-udef64.6%
associate-/l/64.6%
*-commutative64.6%
distribute-rgt-in64.6%
*-un-lft-identity64.6%
add-sqr-sqrt64.6%
hypot-def64.6%
Applied egg-rr64.6%
expm1-def95.7%
expm1-log1p98.9%
+-commutative98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x) :precision binary64 (if (<= x 108000000.0) (- (pow x -0.5) (pow (+ x 1.0) -0.5)) (* 0.5 (pow x -1.5))))
double code(double x) {
double tmp;
if (x <= 108000000.0) {
tmp = pow(x, -0.5) - pow((x + 1.0), -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 <= 108000000.0d0) then
tmp = (x ** (-0.5d0)) - ((x + 1.0d0) ** (-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 <= 108000000.0) {
tmp = Math.pow(x, -0.5) - Math.pow((x + 1.0), -0.5);
} else {
tmp = 0.5 * Math.pow(x, -1.5);
}
return tmp;
}
def code(x): tmp = 0 if x <= 108000000.0: tmp = math.pow(x, -0.5) - math.pow((x + 1.0), -0.5) else: tmp = 0.5 * math.pow(x, -1.5) return tmp
function code(x) tmp = 0.0 if (x <= 108000000.0) tmp = Float64((x ^ -0.5) - (Float64(x + 1.0) ^ -0.5)); else tmp = Float64(0.5 * (x ^ -1.5)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 108000000.0) tmp = (x ^ -0.5) - ((x + 1.0) ^ -0.5); else tmp = 0.5 * (x ^ -1.5); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 108000000.0], N[(N[Power[x, -0.5], $MachinePrecision] - N[Power[N[(x + 1.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Power[x, -1.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 108000000:\\
\;\;\;\;{x}^{-0.5} - {\left(x + 1\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\
\end{array}
\end{array}
if x < 1.08e8Initial 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.1%
metadata-eval99.1%
pow1/299.1%
pow-flip99.1%
+-commutative99.1%
metadata-eval99.1%
Applied egg-rr99.1%
+-commutative99.1%
sub-neg99.1%
fma-udef99.1%
distribute-lft1-in99.1%
metadata-eval99.1%
mul0-lft99.1%
+-commutative99.1%
associate-+r+99.1%
sub-neg99.1%
neg-sub099.1%
+-commutative99.1%
sub-neg99.1%
Simplified99.1%
if 1.08e8 < x Initial program 38.5%
*-un-lft-identity38.5%
clear-num38.5%
associate-/r/38.5%
prod-diff38.5%
*-un-lft-identity38.5%
fma-neg38.5%
*-un-lft-identity38.5%
pow1/238.5%
pow-flip26.3%
metadata-eval26.3%
pow1/226.3%
pow-flip38.5%
+-commutative38.5%
metadata-eval38.5%
Applied egg-rr38.5%
+-commutative38.5%
sub-neg38.5%
fma-udef38.5%
distribute-lft1-in38.5%
metadata-eval38.5%
mul0-lft38.5%
+-commutative38.5%
associate-+r+38.5%
sub-neg38.5%
neg-sub038.5%
+-commutative38.5%
sub-neg38.5%
Simplified38.5%
flip--38.5%
pow-prod-up21.6%
metadata-eval21.6%
inv-pow21.6%
pow-prod-up38.5%
metadata-eval38.5%
inv-pow38.5%
+-commutative38.5%
+-commutative38.5%
Applied egg-rr38.5%
Taylor expanded in x around inf 66.3%
unpow-166.3%
exp-to-pow64.1%
*-commutative64.1%
log-pow64.9%
associate-*r*64.9%
metadata-eval64.9%
*-commutative64.9%
exp-to-pow67.2%
metadata-eval67.2%
pow-sqr67.3%
rem-sqrt-square99.9%
rem-square-sqrt99.5%
fabs-sqr99.5%
rem-square-sqrt99.9%
Simplified99.9%
Final simplification99.5%
(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.6%
*-un-lft-identity99.6%
clear-num99.6%
associate-/r/99.6%
prod-diff99.6%
*-un-lft-identity99.6%
fma-neg99.6%
*-un-lft-identity99.6%
pow1/299.6%
pow-flip100.0%
metadata-eval100.0%
pow1/2100.0%
pow-flip100.0%
+-commutative100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-commutative100.0%
sub-neg100.0%
fma-udef100.0%
distribute-lft1-in100.0%
metadata-eval100.0%
mul0-lft100.0%
+-commutative100.0%
associate-+r+100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 98.2%
if 1 < x Initial program 40.0%
*-un-lft-identity40.0%
clear-num40.0%
associate-/r/40.0%
prod-diff40.0%
*-un-lft-identity40.0%
fma-neg40.0%
*-un-lft-identity40.0%
pow1/240.0%
pow-flip28.2%
metadata-eval28.2%
pow1/228.2%
pow-flip39.9%
+-commutative39.9%
metadata-eval39.9%
Applied egg-rr39.9%
+-commutative39.9%
sub-neg39.9%
fma-udef39.9%
distribute-lft1-in39.9%
metadata-eval39.9%
mul0-lft39.9%
+-commutative39.9%
associate-+r+39.9%
sub-neg39.9%
neg-sub039.9%
+-commutative39.9%
sub-neg39.9%
Simplified39.9%
flip--40.0%
pow-prod-up23.8%
metadata-eval23.8%
inv-pow23.8%
pow-prod-up40.1%
metadata-eval40.1%
inv-pow40.1%
+-commutative40.1%
+-commutative40.1%
Applied egg-rr40.1%
Taylor expanded in x around inf 65.3%
unpow-165.3%
exp-to-pow63.3%
*-commutative63.3%
log-pow64.0%
associate-*r*64.0%
metadata-eval64.0%
*-commutative64.0%
exp-to-pow66.3%
metadata-eval66.3%
pow-sqr66.3%
rem-sqrt-square97.7%
rem-square-sqrt97.3%
fabs-sqr97.3%
rem-square-sqrt97.7%
Simplified97.7%
Final simplification98.0%
(FPCore (x) :precision binary64 (if (<= x 0.5) (/ 1.0 (sqrt x)) (* 0.5 (pow x -1.5))))
double code(double x) {
double tmp;
if (x <= 0.5) {
tmp = 1.0 / sqrt(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 = 1.0d0 / sqrt(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 = 1.0 / Math.sqrt(x);
} else {
tmp = 0.5 * Math.pow(x, -1.5);
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.5: tmp = 1.0 / math.sqrt(x) else: tmp = 0.5 * math.pow(x, -1.5) return tmp
function code(x) tmp = 0.0 if (x <= 0.5) tmp = Float64(1.0 / sqrt(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 = 1.0 / sqrt(x); else tmp = 0.5 * (x ^ -1.5); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.5], N[(1.0 / N[Sqrt[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:\\
\;\;\;\;\frac{1}{\sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\
\end{array}
\end{array}
if x < 0.5Initial program 99.6%
inv-pow99.6%
add-sqr-sqrt99.1%
unpow-prod-down99.0%
pow1/299.0%
sqrt-pow199.2%
metadata-eval99.2%
pow1/299.2%
sqrt-pow199.1%
metadata-eval99.1%
Applied egg-rr99.1%
pow-sqr99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in x around inf 93.4%
sqrt-div94.1%
metadata-eval94.1%
frac-2neg94.1%
metadata-eval94.1%
div-inv94.1%
Applied egg-rr94.1%
associate-*r/94.1%
metadata-eval94.1%
neg-mul-194.1%
associate-/r*94.1%
metadata-eval94.1%
Simplified94.1%
if 0.5 < x Initial program 40.9%
*-un-lft-identity40.9%
clear-num40.9%
associate-/r/40.9%
prod-diff40.9%
*-un-lft-identity40.9%
fma-neg40.9%
*-un-lft-identity40.9%
pow1/240.9%
pow-flip29.2%
metadata-eval29.2%
pow1/229.2%
pow-flip40.8%
+-commutative40.8%
metadata-eval40.8%
Applied egg-rr40.8%
+-commutative40.8%
sub-neg40.8%
fma-udef40.8%
distribute-lft1-in40.8%
metadata-eval40.8%
mul0-lft40.8%
+-commutative40.8%
associate-+r+40.8%
sub-neg40.8%
neg-sub040.8%
+-commutative40.8%
sub-neg40.8%
Simplified40.8%
flip--40.9%
pow-prod-up24.9%
metadata-eval24.9%
inv-pow24.9%
pow-prod-up40.9%
metadata-eval40.9%
inv-pow40.9%
+-commutative40.9%
+-commutative40.9%
Applied egg-rr40.9%
Taylor expanded in x around inf 64.7%
unpow-164.7%
exp-to-pow62.6%
*-commutative62.6%
log-pow63.4%
associate-*r*63.4%
metadata-eval63.4%
*-commutative63.4%
exp-to-pow65.6%
metadata-eval65.6%
pow-sqr65.6%
rem-sqrt-square96.6%
rem-square-sqrt96.1%
fabs-sqr96.1%
rem-square-sqrt96.6%
Simplified96.6%
Final simplification95.4%
(FPCore (x) :precision binary64 (if (<= x 0.68) (+ (pow x -0.5) -1.0) (* 0.5 (pow x -1.5))))
double code(double x) {
double tmp;
if (x <= 0.68) {
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.68d0) 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.68) {
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.68: 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.68) 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.68) tmp = (x ^ -0.5) + -1.0; else tmp = 0.5 * (x ^ -1.5); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.68], 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.68:\\
\;\;\;\;{x}^{-0.5} + -1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {x}^{-1.5}\\
\end{array}
\end{array}
if x < 0.680000000000000049Initial program 99.6%
*-un-lft-identity99.6%
clear-num99.6%
associate-/r/99.6%
prod-diff99.6%
*-un-lft-identity99.6%
fma-neg99.6%
*-un-lft-identity99.6%
pow1/299.6%
pow-flip100.0%
metadata-eval100.0%
pow1/2100.0%
pow-flip100.0%
+-commutative100.0%
metadata-eval100.0%
Applied egg-rr100.0%
+-commutative100.0%
sub-neg100.0%
fma-udef100.0%
distribute-lft1-in100.0%
metadata-eval100.0%
mul0-lft100.0%
+-commutative100.0%
associate-+r+100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 98.4%
if 0.680000000000000049 < x Initial program 40.9%
*-un-lft-identity40.9%
clear-num40.9%
associate-/r/40.9%
prod-diff40.9%
*-un-lft-identity40.9%
fma-neg40.9%
*-un-lft-identity40.9%
pow1/240.9%
pow-flip29.2%
metadata-eval29.2%
pow1/229.2%
pow-flip40.8%
+-commutative40.8%
metadata-eval40.8%
Applied egg-rr40.8%
+-commutative40.8%
sub-neg40.8%
fma-udef40.8%
distribute-lft1-in40.8%
metadata-eval40.8%
mul0-lft40.8%
+-commutative40.8%
associate-+r+40.8%
sub-neg40.8%
neg-sub040.8%
+-commutative40.8%
sub-neg40.8%
Simplified40.8%
flip--40.9%
pow-prod-up24.9%
metadata-eval24.9%
inv-pow24.9%
pow-prod-up40.9%
metadata-eval40.9%
inv-pow40.9%
+-commutative40.9%
+-commutative40.9%
Applied egg-rr40.9%
Taylor expanded in x around inf 64.7%
unpow-164.7%
exp-to-pow62.6%
*-commutative62.6%
log-pow63.4%
associate-*r*63.4%
metadata-eval63.4%
*-commutative63.4%
exp-to-pow65.6%
metadata-eval65.6%
pow-sqr65.6%
rem-sqrt-square96.6%
rem-square-sqrt96.1%
fabs-sqr96.1%
rem-square-sqrt96.6%
Simplified96.6%
Final simplification97.4%
(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 Float64(-(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 68.2%
add-exp-log51.1%
log-rec51.1%
pow1/251.1%
log-pow51.1%
+-commutative51.1%
log1p-udef51.1%
Applied egg-rr51.1%
distribute-lft-neg-in51.1%
metadata-eval51.1%
Simplified51.1%
Taylor expanded in x around inf 2.2%
unpow1/22.2%
sqr-pow2.2%
sqr-pow2.2%
rem-exp-log2.2%
exp-neg2.2%
exp-prod2.2%
distribute-lft-neg-out2.2%
distribute-rgt-neg-in2.2%
metadata-eval2.2%
exp-to-pow2.2%
neg-mul-12.2%
Simplified2.2%
Final simplification2.2%
(FPCore (x) :precision binary64 (sqrt (/ 0.1111111111111111 x)))
double code(double x) {
return sqrt((0.1111111111111111 / x));
}
real(8) function code(x)
real(8), intent (in) :: x
code = sqrt((0.1111111111111111d0 / x))
end function
public static double code(double x) {
return Math.sqrt((0.1111111111111111 / x));
}
def code(x): return math.sqrt((0.1111111111111111 / x))
function code(x) return sqrt(Float64(0.1111111111111111 / x)) end
function tmp = code(x) tmp = sqrt((0.1111111111111111 / x)); end
code[x_] := N[Sqrt[N[(0.1111111111111111 / x), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{0.1111111111111111}{x}}
\end{array}
Initial program 68.2%
sub-neg68.2%
flip3-+55.4%
inv-pow55.4%
pow-pow55.2%
metadata-eval55.2%
distribute-neg-frac55.2%
metadata-eval55.2%
+-commutative55.2%
frac-times55.3%
metadata-eval55.3%
add-sqr-sqrt55.1%
Applied egg-rr55.1%
cube-div53.8%
metadata-eval53.8%
cancel-sign-sub-inv53.8%
associate-*r/53.8%
associate-*l/53.8%
metadata-eval53.8%
associate-/l/53.8%
rem-square-sqrt53.8%
associate-*r/53.8%
Simplified53.8%
expm1-log1p-u51.2%
expm1-udef51.0%
sqrt-pow251.0%
metadata-eval51.0%
Applied egg-rr51.0%
expm1-def51.3%
expm1-log1p54.1%
Simplified54.1%
Taylor expanded in x around inf 11.4%
*-commutative11.4%
Simplified11.4%
add-sqr-sqrt11.4%
sqrt-unprod11.4%
*-commutative11.4%
inv-pow11.4%
sqrt-pow111.4%
metadata-eval11.4%
*-commutative11.4%
inv-pow11.4%
sqrt-pow111.4%
metadata-eval11.4%
swap-sqr11.4%
pow-prod-up11.4%
metadata-eval11.4%
inv-pow11.4%
metadata-eval11.4%
Applied egg-rr11.4%
associate-*l/11.4%
metadata-eval11.4%
Simplified11.4%
Final simplification11.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 68.2%
inv-pow68.2%
add-sqr-sqrt59.8%
unpow-prod-down58.2%
pow1/258.2%
sqrt-pow159.0%
metadata-eval59.0%
pow1/259.0%
sqrt-pow157.8%
metadata-eval57.8%
Applied egg-rr57.8%
pow-sqr60.7%
metadata-eval60.7%
Simplified60.7%
Taylor expanded in x around inf 46.5%
Final simplification46.5%
(FPCore (x) :precision binary64 (/ 1.0 (sqrt x)))
double code(double x) {
return 1.0 / sqrt(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0 / sqrt(x)
end function
public static double code(double x) {
return 1.0 / Math.sqrt(x);
}
def code(x): return 1.0 / math.sqrt(x)
function code(x) return Float64(1.0 / sqrt(x)) end
function tmp = code(x) tmp = 1.0 / sqrt(x); end
code[x_] := N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{x}}
\end{array}
Initial program 68.2%
inv-pow68.2%
add-sqr-sqrt59.8%
unpow-prod-down58.2%
pow1/258.2%
sqrt-pow159.0%
metadata-eval59.0%
pow1/259.0%
sqrt-pow157.8%
metadata-eval57.8%
Applied egg-rr57.8%
pow-sqr60.7%
metadata-eval60.7%
Simplified60.7%
Taylor expanded in x around inf 46.5%
sqrt-div46.9%
metadata-eval46.9%
frac-2neg46.9%
metadata-eval46.9%
div-inv46.9%
Applied egg-rr46.9%
associate-*r/46.9%
metadata-eval46.9%
neg-mul-146.9%
associate-/r*46.9%
metadata-eval46.9%
Simplified46.9%
Final simplification46.9%
(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 68.2%
Taylor expanded in x around 0 47.0%
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 2023334
(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)))))