
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 23 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (log1p x) n)))
(if (<= (/ 1.0 n) -2e-115)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 1e-7)
(-
(+
(fma
0.5
(* (pow n -2.0) (pow (log1p x) 2.0))
(* 0.16666666666666666 (pow t_1 3.0)))
(/ (- (log1p x) (log x)) n))
(fma
0.5
(* (pow n -2.0) (pow (log x) 2.0))
(* 0.16666666666666666 (pow (/ (log x) n) 3.0))))
(- (cbrt (exp (* t_1 3.0))) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = log1p(x) / n;
double tmp;
if ((1.0 / n) <= -2e-115) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-7) {
tmp = (fma(0.5, (pow(n, -2.0) * pow(log1p(x), 2.0)), (0.16666666666666666 * pow(t_1, 3.0))) + ((log1p(x) - log(x)) / n)) - fma(0.5, (pow(n, -2.0) * pow(log(x), 2.0)), (0.16666666666666666 * pow((log(x) / n), 3.0)));
} else {
tmp = cbrt(exp((t_1 * 3.0))) - t_0;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(log1p(x) / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-115) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-7) tmp = Float64(Float64(fma(0.5, Float64((n ^ -2.0) * (log1p(x) ^ 2.0)), Float64(0.16666666666666666 * (t_1 ^ 3.0))) + Float64(Float64(log1p(x) - log(x)) / n)) - fma(0.5, Float64((n ^ -2.0) * (log(x) ^ 2.0)), Float64(0.16666666666666666 * (Float64(log(x) / n) ^ 3.0)))); else tmp = Float64(cbrt(exp(Float64(t_1 * 3.0))) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-115], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-7], N[(N[(N[(0.5 * N[(N[Power[n, -2.0], $MachinePrecision] * N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * N[Power[t$95$1, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[(0.5 * N[(N[Power[n, -2.0], $MachinePrecision] * N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * N[Power[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Exp[N[(t$95$1 * 3.0), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\mathsf{log1p}\left(x\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-7}:\\
\;\;\;\;\left(\mathsf{fma}\left(0.5, {n}^{-2} \cdot {\left(\mathsf{log1p}\left(x\right)\right)}^{2}, 0.16666666666666666 \cdot {t_1}^{3}\right) + \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\right) - \mathsf{fma}\left(0.5, {n}^{-2} \cdot {\log x}^{2}, 0.16666666666666666 \cdot {\left(\frac{\log x}{n}\right)}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{e^{t_1 \cdot 3}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -2.0000000000000001e-115Initial program 78.9%
Taylor expanded in x around inf 90.0%
log-rec90.0%
mul-1-neg90.0%
mul-1-neg90.0%
distribute-frac-neg90.0%
neg-mul-190.0%
remove-double-neg90.0%
*-rgt-identity90.0%
associate-*r/90.0%
unpow-190.0%
exp-to-pow90.0%
unpow-190.0%
*-commutative90.0%
Simplified90.0%
if -2.0000000000000001e-115 < (/.f64 1 n) < 9.9999999999999995e-8Initial program 34.1%
Taylor expanded in n around inf 85.1%
Simplified85.1%
if 9.9999999999999995e-8 < (/.f64 1 n) Initial program 59.1%
add-cbrt-cube59.1%
pow359.1%
pow-to-exp59.1%
pow-exp59.1%
un-div-inv59.1%
+-commutative59.1%
log1p-udef97.5%
Applied egg-rr97.5%
Final simplification88.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-115)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 1e-7)
(+
(+
(fma 0.5 (/ (pow (log1p x) 2.0) (* n n)) (/ (- (log1p x) (log x)) n))
(/
(* 0.16666666666666666 (- (pow (log1p x) 3.0) (pow (log x) 3.0)))
(pow n 3.0)))
(* (/ (pow (log x) 2.0) (* n n)) -0.5))
(- (cbrt (exp (* (/ (log1p x) n) 3.0))) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-115) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-7) {
tmp = (fma(0.5, (pow(log1p(x), 2.0) / (n * n)), ((log1p(x) - log(x)) / n)) + ((0.16666666666666666 * (pow(log1p(x), 3.0) - pow(log(x), 3.0))) / pow(n, 3.0))) + ((pow(log(x), 2.0) / (n * n)) * -0.5);
} else {
tmp = cbrt(exp(((log1p(x) / n) * 3.0))) - t_0;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-115) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-7) tmp = Float64(Float64(fma(0.5, Float64((log1p(x) ^ 2.0) / Float64(n * n)), Float64(Float64(log1p(x) - log(x)) / n)) + Float64(Float64(0.16666666666666666 * Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0))) / (n ^ 3.0))) + Float64(Float64((log(x) ^ 2.0) / Float64(n * n)) * -0.5)); else tmp = Float64(cbrt(exp(Float64(Float64(log1p(x) / n) * 3.0))) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-115], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-7], N[(N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(N[(0.16666666666666666 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[n, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Exp[N[(N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision] * 3.0), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-7}:\\
\;\;\;\;\left(\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\right) + \frac{0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right)}{{n}^{3}}\right) + \frac{{\log x}^{2}}{n \cdot n} \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n} \cdot 3}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -2.0000000000000001e-115Initial program 78.9%
Taylor expanded in x around inf 90.0%
log-rec90.0%
mul-1-neg90.0%
mul-1-neg90.0%
distribute-frac-neg90.0%
neg-mul-190.0%
remove-double-neg90.0%
*-rgt-identity90.0%
associate-*r/90.0%
unpow-190.0%
exp-to-pow90.0%
unpow-190.0%
*-commutative90.0%
Simplified90.0%
if -2.0000000000000001e-115 < (/.f64 1 n) < 9.9999999999999995e-8Initial program 34.1%
Taylor expanded in n around -inf 85.1%
sub-neg85.1%
Simplified85.1%
if 9.9999999999999995e-8 < (/.f64 1 n) Initial program 59.1%
add-cbrt-cube59.1%
pow359.1%
pow-to-exp59.1%
pow-exp59.1%
un-div-inv59.1%
+-commutative59.1%
log1p-udef97.5%
Applied egg-rr97.5%
Final simplification88.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log1p x) n)) (t_1 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-115)
(/ t_1 (* n x))
(if (<= (/ 1.0 n) 1e-14)
(/
(-
(* 2.0 (+ t_0 (/ (pow (log1p x) 2.0) (* n n))))
(* 2.0 (+ (/ (log x) n) (/ (pow (log x) 2.0) (* n n)))))
(+ t_1 (exp t_0)))
(- (cbrt (exp (* t_0 3.0))) t_1)))))
double code(double x, double n) {
double t_0 = log1p(x) / n;
double t_1 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-115) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= 1e-14) {
tmp = ((2.0 * (t_0 + (pow(log1p(x), 2.0) / (n * n)))) - (2.0 * ((log(x) / n) + (pow(log(x), 2.0) / (n * n))))) / (t_1 + exp(t_0));
} else {
tmp = cbrt(exp((t_0 * 3.0))) - t_1;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.log1p(x) / n;
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-115) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= 1e-14) {
tmp = ((2.0 * (t_0 + (Math.pow(Math.log1p(x), 2.0) / (n * n)))) - (2.0 * ((Math.log(x) / n) + (Math.pow(Math.log(x), 2.0) / (n * n))))) / (t_1 + Math.exp(t_0));
} else {
tmp = Math.cbrt(Math.exp((t_0 * 3.0))) - t_1;
}
return tmp;
}
function code(x, n) t_0 = Float64(log1p(x) / n) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-115) tmp = Float64(t_1 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-14) tmp = Float64(Float64(Float64(2.0 * Float64(t_0 + Float64((log1p(x) ^ 2.0) / Float64(n * n)))) - Float64(2.0 * Float64(Float64(log(x) / n) + Float64((log(x) ^ 2.0) / Float64(n * n))))) / Float64(t_1 + exp(t_0))); else tmp = Float64(cbrt(exp(Float64(t_0 * 3.0))) - t_1); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-115], N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-14], N[(N[(N[(2.0 * N[(t$95$0 + N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(2.0 * N[(N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision] + N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 + N[Exp[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Exp[N[(t$95$0 * 3.0), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision] - t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{log1p}\left(x\right)}{n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-14}:\\
\;\;\;\;\frac{2 \cdot \left(t_0 + \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}\right) - 2 \cdot \left(\frac{\log x}{n} + \frac{{\log x}^{2}}{n \cdot n}\right)}{t_1 + e^{t_0}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{e^{t_0 \cdot 3}} - t_1\\
\end{array}
\end{array}
if (/.f64 1 n) < -2.0000000000000001e-115Initial program 78.9%
Taylor expanded in x around inf 90.0%
log-rec90.0%
mul-1-neg90.0%
mul-1-neg90.0%
distribute-frac-neg90.0%
neg-mul-190.0%
remove-double-neg90.0%
*-rgt-identity90.0%
associate-*r/90.0%
unpow-190.0%
exp-to-pow90.0%
unpow-190.0%
*-commutative90.0%
Simplified90.0%
if -2.0000000000000001e-115 < (/.f64 1 n) < 9.99999999999999999e-15Initial program 33.4%
flip--33.4%
div-inv33.4%
pow233.4%
pow-to-exp33.4%
un-div-inv33.4%
+-commutative33.4%
log1p-udef33.4%
pow-sqr33.4%
inv-pow33.4%
Applied egg-rr33.4%
associate-*r/33.4%
Simplified33.4%
Taylor expanded in n around inf 84.9%
distribute-lft-out84.9%
log1p-def84.9%
log1p-def84.9%
unpow284.9%
distribute-lft-out84.9%
unpow284.9%
Simplified84.9%
if 9.99999999999999999e-15 < (/.f64 1 n) Initial program 59.8%
add-cbrt-cube59.8%
pow359.8%
pow-to-exp59.8%
pow-exp59.8%
un-div-inv59.8%
+-commutative59.8%
log1p-udef96.7%
Applied egg-rr96.7%
Final simplification88.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log1p x) n)) (t_1 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-115)
(/ t_1 (* n x))
(if (<= (/ 1.0 n) 1e-8)
(-
(fma 0.5 (/ (pow (log1p x) 2.0) (* n n)) t_0)
(+ (/ (log x) n) (* 0.5 (/ (pow (log x) 2.0) (* n n)))))
(- (cbrt (exp (* t_0 3.0))) t_1)))))
double code(double x, double n) {
double t_0 = log1p(x) / n;
double t_1 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-115) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= 1e-8) {
tmp = fma(0.5, (pow(log1p(x), 2.0) / (n * n)), t_0) - ((log(x) / n) + (0.5 * (pow(log(x), 2.0) / (n * n))));
} else {
tmp = cbrt(exp((t_0 * 3.0))) - t_1;
}
return tmp;
}
function code(x, n) t_0 = Float64(log1p(x) / n) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-115) tmp = Float64(t_1 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-8) tmp = Float64(fma(0.5, Float64((log1p(x) ^ 2.0) / Float64(n * n)), t_0) - Float64(Float64(log(x) / n) + Float64(0.5 * Float64((log(x) ^ 2.0) / Float64(n * n))))); else tmp = Float64(cbrt(exp(Float64(t_0 * 3.0))) - t_1); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-115], N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-8], N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision] - N[(N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision] + N[(0.5 * N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Exp[N[(t$95$0 * 3.0), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision] - t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{log1p}\left(x\right)}{n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, t_0\right) - \left(\frac{\log x}{n} + 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{e^{t_0 \cdot 3}} - t_1\\
\end{array}
\end{array}
if (/.f64 1 n) < -2.0000000000000001e-115Initial program 78.9%
Taylor expanded in x around inf 90.0%
log-rec90.0%
mul-1-neg90.0%
mul-1-neg90.0%
distribute-frac-neg90.0%
neg-mul-190.0%
remove-double-neg90.0%
*-rgt-identity90.0%
associate-*r/90.0%
unpow-190.0%
exp-to-pow90.0%
unpow-190.0%
*-commutative90.0%
Simplified90.0%
if -2.0000000000000001e-115 < (/.f64 1 n) < 1e-8Initial program 33.8%
Taylor expanded in n around inf 84.8%
fma-def84.8%
log1p-def84.8%
unpow284.8%
log1p-def84.8%
unpow284.8%
Simplified84.8%
if 1e-8 < (/.f64 1 n) Initial program 59.5%
add-cbrt-cube59.5%
pow359.5%
pow-to-exp59.5%
pow-exp59.5%
un-div-inv59.5%
+-commutative59.5%
log1p-udef97.1%
Applied egg-rr97.1%
Final simplification88.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-115)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 1e-8)
(+
(fma 0.5 (/ (pow (log1p x) 2.0) (* n n)) (/ (- (log1p x) (log x)) n))
(* (/ (pow (log x) 2.0) (* n n)) -0.5))
(- (cbrt (exp (* (/ (log1p x) n) 3.0))) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-115) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-8) {
tmp = fma(0.5, (pow(log1p(x), 2.0) / (n * n)), ((log1p(x) - log(x)) / n)) + ((pow(log(x), 2.0) / (n * n)) * -0.5);
} else {
tmp = cbrt(exp(((log1p(x) / n) * 3.0))) - t_0;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-115) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-8) tmp = Float64(fma(0.5, Float64((log1p(x) ^ 2.0) / Float64(n * n)), Float64(Float64(log1p(x) - log(x)) / n)) + Float64(Float64((log(x) ^ 2.0) / Float64(n * n)) * -0.5)); else tmp = Float64(cbrt(exp(Float64(Float64(log1p(x) / n) * 3.0))) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-115], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-8], N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Exp[N[(N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision] * 3.0), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\right) + \frac{{\log x}^{2}}{n \cdot n} \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n} \cdot 3}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -2.0000000000000001e-115Initial program 78.9%
Taylor expanded in x around inf 90.0%
log-rec90.0%
mul-1-neg90.0%
mul-1-neg90.0%
distribute-frac-neg90.0%
neg-mul-190.0%
remove-double-neg90.0%
*-rgt-identity90.0%
associate-*r/90.0%
unpow-190.0%
exp-to-pow90.0%
unpow-190.0%
*-commutative90.0%
Simplified90.0%
if -2.0000000000000001e-115 < (/.f64 1 n) < 1e-8Initial program 33.8%
Taylor expanded in n around inf 84.8%
associate--r+79.3%
sub-neg79.3%
Simplified84.8%
if 1e-8 < (/.f64 1 n) Initial program 59.5%
add-cbrt-cube59.5%
pow359.5%
pow-to-exp59.5%
pow-exp59.5%
un-div-inv59.5%
+-commutative59.5%
log1p-udef97.1%
Applied egg-rr97.1%
Final simplification88.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-115)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 1e-14)
(/ (- (log1p x) (log x)) n)
(- (cbrt (exp (* (/ (log1p x) n) 3.0))) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-115) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-14) {
tmp = (log1p(x) - log(x)) / n;
} else {
tmp = cbrt(exp(((log1p(x) / n) * 3.0))) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-115) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-14) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else {
tmp = Math.cbrt(Math.exp(((Math.log1p(x) / n) * 3.0))) - t_0;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-115) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-14) tmp = Float64(Float64(log1p(x) - log(x)) / n); else tmp = Float64(cbrt(exp(Float64(Float64(log1p(x) / n) * 3.0))) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-115], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-14], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Power[N[Exp[N[(N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision] * 3.0), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-14}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{e^{\frac{\mathsf{log1p}\left(x\right)}{n} \cdot 3}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -2.0000000000000001e-115Initial program 78.9%
Taylor expanded in x around inf 90.0%
log-rec90.0%
mul-1-neg90.0%
mul-1-neg90.0%
distribute-frac-neg90.0%
neg-mul-190.0%
remove-double-neg90.0%
*-rgt-identity90.0%
associate-*r/90.0%
unpow-190.0%
exp-to-pow90.0%
unpow-190.0%
*-commutative90.0%
Simplified90.0%
if -2.0000000000000001e-115 < (/.f64 1 n) < 9.99999999999999999e-15Initial program 33.4%
Taylor expanded in n around inf 84.7%
log1p-def84.7%
Simplified84.7%
if 9.99999999999999999e-15 < (/.f64 1 n) Initial program 59.8%
add-cbrt-cube59.8%
pow359.8%
pow-to-exp59.8%
pow-exp59.8%
un-div-inv59.8%
+-commutative59.8%
log1p-udef96.7%
Applied egg-rr96.7%
Final simplification88.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-115)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 1e-14)
(/ (- (log1p x) (log x)) n)
(- (cbrt (exp (* 3.0 (/ x n)))) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-115) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-14) {
tmp = (log1p(x) - log(x)) / n;
} else {
tmp = cbrt(exp((3.0 * (x / n)))) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-115) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-14) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else {
tmp = Math.cbrt(Math.exp((3.0 * (x / n)))) - t_0;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-115) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-14) tmp = Float64(Float64(log1p(x) - log(x)) / n); else tmp = Float64(cbrt(exp(Float64(3.0 * Float64(x / n)))) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-115], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-14], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Power[N[Exp[N[(3.0 * N[(x / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-14}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{e^{3 \cdot \frac{x}{n}}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -2.0000000000000001e-115Initial program 78.9%
Taylor expanded in x around inf 90.0%
log-rec90.0%
mul-1-neg90.0%
mul-1-neg90.0%
distribute-frac-neg90.0%
neg-mul-190.0%
remove-double-neg90.0%
*-rgt-identity90.0%
associate-*r/90.0%
unpow-190.0%
exp-to-pow90.0%
unpow-190.0%
*-commutative90.0%
Simplified90.0%
if -2.0000000000000001e-115 < (/.f64 1 n) < 9.99999999999999999e-15Initial program 33.4%
Taylor expanded in n around inf 84.7%
log1p-def84.7%
Simplified84.7%
if 9.99999999999999999e-15 < (/.f64 1 n) Initial program 59.8%
add-cbrt-cube59.8%
pow359.8%
pow-to-exp59.8%
pow-exp59.8%
un-div-inv59.8%
+-commutative59.8%
log1p-udef96.7%
Applied egg-rr96.7%
Taylor expanded in x around 0 96.6%
*-commutative96.6%
Simplified96.6%
Final simplification88.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-115)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 1e-14)
(/ (- (log1p x) (log x)) n)
(- (exp (/ (log1p x) n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-115) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-14) {
tmp = (log1p(x) - log(x)) / n;
} else {
tmp = exp((log1p(x) / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-115) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-14) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-115: tmp = t_0 / (n * x) elif (1.0 / n) <= 1e-14: tmp = (math.log1p(x) - math.log(x)) / n else: tmp = math.exp((math.log1p(x) / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-115) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-14) tmp = Float64(Float64(log1p(x) - log(x)) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-115], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-14], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-14}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -2.0000000000000001e-115Initial program 78.9%
Taylor expanded in x around inf 90.0%
log-rec90.0%
mul-1-neg90.0%
mul-1-neg90.0%
distribute-frac-neg90.0%
neg-mul-190.0%
remove-double-neg90.0%
*-rgt-identity90.0%
associate-*r/90.0%
unpow-190.0%
exp-to-pow90.0%
unpow-190.0%
*-commutative90.0%
Simplified90.0%
if -2.0000000000000001e-115 < (/.f64 1 n) < 9.99999999999999999e-15Initial program 33.4%
Taylor expanded in n around inf 84.7%
log1p-def84.7%
Simplified84.7%
if 9.99999999999999999e-15 < (/.f64 1 n) Initial program 59.8%
Taylor expanded in n around 0 59.8%
log1p-def96.6%
*-rgt-identity96.6%
associate-*r/96.6%
unpow-196.6%
exp-to-pow96.6%
/-rgt-identity96.6%
metadata-eval96.6%
associate-/l*96.6%
*-commutative96.6%
*-commutative96.6%
associate-/l*96.6%
metadata-eval96.6%
/-rgt-identity96.6%
unpow-196.6%
Simplified96.6%
Final simplification88.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-115)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 1e-14)
(/ (- (log1p x) (log x)) n)
(- (exp (/ x n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-115) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-14) {
tmp = (log1p(x) - log(x)) / n;
} else {
tmp = exp((x / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-115) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-14) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-115: tmp = t_0 / (n * x) elif (1.0 / n) <= 1e-14: tmp = (math.log1p(x) - math.log(x)) / n else: tmp = math.exp((x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-115) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-14) tmp = Float64(Float64(log1p(x) - log(x)) / n); else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-115], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-14], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-14}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -2.0000000000000001e-115Initial program 78.9%
Taylor expanded in x around inf 90.0%
log-rec90.0%
mul-1-neg90.0%
mul-1-neg90.0%
distribute-frac-neg90.0%
neg-mul-190.0%
remove-double-neg90.0%
*-rgt-identity90.0%
associate-*r/90.0%
unpow-190.0%
exp-to-pow90.0%
unpow-190.0%
*-commutative90.0%
Simplified90.0%
if -2.0000000000000001e-115 < (/.f64 1 n) < 9.99999999999999999e-15Initial program 33.4%
Taylor expanded in n around inf 84.7%
log1p-def84.7%
Simplified84.7%
if 9.99999999999999999e-15 < (/.f64 1 n) Initial program 59.8%
Taylor expanded in n around 0 59.8%
log1p-def96.6%
*-rgt-identity96.6%
associate-*r/96.6%
unpow-196.6%
exp-to-pow96.6%
/-rgt-identity96.6%
metadata-eval96.6%
associate-/l*96.6%
*-commutative96.6%
*-commutative96.6%
associate-/l*96.6%
metadata-eval96.6%
/-rgt-identity96.6%
unpow-196.6%
Simplified96.6%
Taylor expanded in x around 0 96.5%
Final simplification88.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ 1.0 (* n x))) (t_1 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-115)
(/ t_1 (* n x))
(if (<= (/ 1.0 n) 1e-14)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 1e+105)
(- (+ (* (- (/ 0.5 (* n n)) (/ 0.5 n)) (* x x)) (+ 1.0 (/ x n))) t_1)
(cbrt (* t_0 (/ t_0 (* n x)))))))))
double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double t_1 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-115) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= 1e-14) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 1e+105) {
tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + (1.0 + (x / n))) - t_1;
} else {
tmp = cbrt((t_0 * (t_0 / (n * x))));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-115) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= 1e-14) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 1e+105) {
tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + (1.0 + (x / n))) - t_1;
} else {
tmp = Math.cbrt((t_0 * (t_0 / (n * x))));
}
return tmp;
}
function code(x, n) t_0 = Float64(1.0 / Float64(n * x)) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-115) tmp = Float64(t_1 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-14) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 1e+105) tmp = Float64(Float64(Float64(Float64(Float64(0.5 / Float64(n * n)) - Float64(0.5 / n)) * Float64(x * x)) + Float64(1.0 + Float64(x / n))) - t_1); else tmp = cbrt(Float64(t_0 * Float64(t_0 / Float64(n * x)))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-115], N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-14], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+105], N[(N[(N[(N[(N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], N[Power[N[(t$95$0 * N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{n \cdot x}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-14}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+105}:\\
\;\;\;\;\left(\left(\frac{0.5}{n \cdot n} - \frac{0.5}{n}\right) \cdot \left(x \cdot x\right) + \left(1 + \frac{x}{n}\right)\right) - t_1\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{t_0 \cdot \frac{t_0}{n \cdot x}}\\
\end{array}
\end{array}
if (/.f64 1 n) < -2.0000000000000001e-115Initial program 78.9%
Taylor expanded in x around inf 90.0%
log-rec90.0%
mul-1-neg90.0%
mul-1-neg90.0%
distribute-frac-neg90.0%
neg-mul-190.0%
remove-double-neg90.0%
*-rgt-identity90.0%
associate-*r/90.0%
unpow-190.0%
exp-to-pow90.0%
unpow-190.0%
*-commutative90.0%
Simplified90.0%
if -2.0000000000000001e-115 < (/.f64 1 n) < 9.99999999999999999e-15Initial program 33.4%
Taylor expanded in n around inf 84.7%
log1p-def84.7%
Simplified84.7%
if 9.99999999999999999e-15 < (/.f64 1 n) < 9.9999999999999994e104Initial program 82.6%
Taylor expanded in x around 0 84.7%
associate-+r+84.7%
+-commutative84.7%
associate-*r/84.7%
metadata-eval84.7%
unpow284.7%
associate-*r/84.7%
metadata-eval84.7%
unpow284.7%
Simplified84.7%
if 9.9999999999999994e104 < (/.f64 1 n) Initial program 46.5%
Taylor expanded in n around inf 5.6%
log1p-def5.6%
Simplified5.6%
Taylor expanded in x around inf 31.0%
*-commutative31.0%
Simplified31.0%
add-cbrt-cube66.6%
Applied egg-rr66.6%
associate-*l*66.6%
associate-*l/66.6%
*-lft-identity66.6%
Simplified66.6%
Final simplification84.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x n))) (t_1 (pow x (/ 1.0 n))))
(if (<= x 5.6e-209)
(- t_0 t_1)
(if (<= x 3.6e-130)
(/ (- (log x)) n)
(if (<= x 1.22e-122)
(- (+ (* (- (/ 0.5 (* n n)) (/ 0.5 n)) (* x x)) t_0) t_1)
(if (<= x 0.88)
(+ (- (/ x n) (/ (log x) n)) (* -0.5 (/ (* x x) n)))
(/ t_1 (* n x))))))))
double code(double x, double n) {
double t_0 = 1.0 + (x / n);
double t_1 = pow(x, (1.0 / n));
double tmp;
if (x <= 5.6e-209) {
tmp = t_0 - t_1;
} else if (x <= 3.6e-130) {
tmp = -log(x) / n;
} else if (x <= 1.22e-122) {
tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + t_0) - t_1;
} else if (x <= 0.88) {
tmp = ((x / n) - (log(x) / n)) + (-0.5 * ((x * x) / n));
} else {
tmp = t_1 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (x / n)
t_1 = x ** (1.0d0 / n)
if (x <= 5.6d-209) then
tmp = t_0 - t_1
else if (x <= 3.6d-130) then
tmp = -log(x) / n
else if (x <= 1.22d-122) then
tmp = ((((0.5d0 / (n * n)) - (0.5d0 / n)) * (x * x)) + t_0) - t_1
else if (x <= 0.88d0) then
tmp = ((x / n) - (log(x) / n)) + ((-0.5d0) * ((x * x) / n))
else
tmp = t_1 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 + (x / n);
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 5.6e-209) {
tmp = t_0 - t_1;
} else if (x <= 3.6e-130) {
tmp = -Math.log(x) / n;
} else if (x <= 1.22e-122) {
tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + t_0) - t_1;
} else if (x <= 0.88) {
tmp = ((x / n) - (Math.log(x) / n)) + (-0.5 * ((x * x) / n));
} else {
tmp = t_1 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = 1.0 + (x / n) t_1 = math.pow(x, (1.0 / n)) tmp = 0 if x <= 5.6e-209: tmp = t_0 - t_1 elif x <= 3.6e-130: tmp = -math.log(x) / n elif x <= 1.22e-122: tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + t_0) - t_1 elif x <= 0.88: tmp = ((x / n) - (math.log(x) / n)) + (-0.5 * ((x * x) / n)) else: tmp = t_1 / (n * x) return tmp
function code(x, n) t_0 = Float64(1.0 + Float64(x / n)) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 5.6e-209) tmp = Float64(t_0 - t_1); elseif (x <= 3.6e-130) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 1.22e-122) tmp = Float64(Float64(Float64(Float64(Float64(0.5 / Float64(n * n)) - Float64(0.5 / n)) * Float64(x * x)) + t_0) - t_1); elseif (x <= 0.88) tmp = Float64(Float64(Float64(x / n) - Float64(log(x) / n)) + Float64(-0.5 * Float64(Float64(x * x) / n))); else tmp = Float64(t_1 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 + (x / n); t_1 = x ^ (1.0 / n); tmp = 0.0; if (x <= 5.6e-209) tmp = t_0 - t_1; elseif (x <= 3.6e-130) tmp = -log(x) / n; elseif (x <= 1.22e-122) tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + t_0) - t_1; elseif (x <= 0.88) tmp = ((x / n) - (log(x) / n)) + (-0.5 * ((x * x) / n)); else tmp = t_1 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 5.6e-209], N[(t$95$0 - t$95$1), $MachinePrecision], If[LessEqual[x, 3.6e-130], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 1.22e-122], N[(N[(N[(N[(N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[x, 0.88], N[(N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(N[(x * x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 5.6 \cdot 10^{-209}:\\
\;\;\;\;t_0 - t_1\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-130}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{-122}:\\
\;\;\;\;\left(\left(\frac{0.5}{n \cdot n} - \frac{0.5}{n}\right) \cdot \left(x \cdot x\right) + t_0\right) - t_1\\
\mathbf{elif}\;x \leq 0.88:\\
\;\;\;\;\left(\frac{x}{n} - \frac{\log x}{n}\right) + -0.5 \cdot \frac{x \cdot x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\
\end{array}
\end{array}
if x < 5.60000000000000025e-209Initial program 63.4%
Taylor expanded in x around 0 64.1%
if 5.60000000000000025e-209 < x < 3.6000000000000001e-130Initial program 23.4%
Taylor expanded in n around inf 62.7%
log1p-def62.7%
Simplified62.7%
Taylor expanded in x around 0 62.7%
neg-mul-162.7%
Simplified62.7%
if 3.6000000000000001e-130 < x < 1.22000000000000003e-122Initial program 73.8%
Taylor expanded in x around 0 89.9%
associate-+r+89.9%
+-commutative89.9%
associate-*r/89.9%
metadata-eval89.9%
unpow289.9%
associate-*r/89.9%
metadata-eval89.9%
unpow289.9%
Simplified89.9%
if 1.22000000000000003e-122 < x < 0.880000000000000004Initial program 41.2%
Taylor expanded in n around inf 54.3%
log1p-def54.3%
Simplified54.3%
Taylor expanded in x around 0 52.0%
associate-+r+52.0%
mul-1-neg52.0%
unsub-neg52.0%
*-commutative52.0%
unpow252.0%
Simplified52.0%
if 0.880000000000000004 < x Initial program 67.3%
Taylor expanded in x around inf 97.3%
log-rec97.3%
mul-1-neg97.3%
mul-1-neg97.3%
distribute-frac-neg97.3%
neg-mul-197.3%
remove-double-neg97.3%
*-rgt-identity97.3%
associate-*r/97.3%
unpow-197.3%
exp-to-pow97.3%
unpow-197.3%
*-commutative97.3%
Simplified97.3%
Final simplification74.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x 2.1e-208)
(- (+ 1.0 (/ x n)) t_0)
(if (<= x 0.88)
(+ (- (/ x n) (/ (log x) n)) (* -0.5 (/ (* x x) n)))
(/ t_0 (* n x))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= 2.1e-208) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 0.88) {
tmp = ((x / n) - (log(x) / n)) + (-0.5 * ((x * x) / n));
} else {
tmp = t_0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (x <= 2.1d-208) then
tmp = (1.0d0 + (x / n)) - t_0
else if (x <= 0.88d0) then
tmp = ((x / n) - (log(x) / n)) + ((-0.5d0) * ((x * x) / n))
else
tmp = t_0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 2.1e-208) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 0.88) {
tmp = ((x / n) - (Math.log(x) / n)) + (-0.5 * ((x * x) / n));
} else {
tmp = t_0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if x <= 2.1e-208: tmp = (1.0 + (x / n)) - t_0 elif x <= 0.88: tmp = ((x / n) - (math.log(x) / n)) + (-0.5 * ((x * x) / n)) else: tmp = t_0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 2.1e-208) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); elseif (x <= 0.88) tmp = Float64(Float64(Float64(x / n) - Float64(log(x) / n)) + Float64(-0.5 * Float64(Float64(x * x) / n))); else tmp = Float64(t_0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (x <= 2.1e-208) tmp = (1.0 + (x / n)) - t_0; elseif (x <= 0.88) tmp = ((x / n) - (log(x) / n)) + (-0.5 * ((x * x) / n)); else tmp = t_0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 2.1e-208], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 0.88], N[(N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(N[(x * x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 2.1 \cdot 10^{-208}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{elif}\;x \leq 0.88:\\
\;\;\;\;\left(\frac{x}{n} - \frac{\log x}{n}\right) + -0.5 \cdot \frac{x \cdot x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\end{array}
\end{array}
if x < 2.10000000000000012e-208Initial program 63.4%
Taylor expanded in x around 0 64.1%
if 2.10000000000000012e-208 < x < 0.880000000000000004Initial program 36.7%
Taylor expanded in n around inf 55.3%
log1p-def55.3%
Simplified55.3%
Taylor expanded in x around 0 54.0%
associate-+r+54.0%
mul-1-neg54.0%
unsub-neg54.0%
*-commutative54.0%
unpow254.0%
Simplified54.0%
if 0.880000000000000004 < x Initial program 67.3%
Taylor expanded in x around inf 97.3%
log-rec97.3%
mul-1-neg97.3%
mul-1-neg97.3%
distribute-frac-neg97.3%
neg-mul-197.3%
remove-double-neg97.3%
*-rgt-identity97.3%
associate-*r/97.3%
unpow-197.3%
exp-to-pow97.3%
unpow-197.3%
*-commutative97.3%
Simplified97.3%
Final simplification72.6%
(FPCore (x n)
:precision binary64
(if (<= x 7e-208)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 1.0)
(/ (- x (log x)) n)
(if (<= x 6.6e+213)
(/ (- (/ 1.0 x) (/ 0.5 (* x x))) n)
(/ 0.3333333333333333 (* n (pow x 3.0)))))))
double code(double x, double n) {
double tmp;
if (x <= 7e-208) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 1.0) {
tmp = (x - log(x)) / n;
} else if (x <= 6.6e+213) {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
} else {
tmp = 0.3333333333333333 / (n * pow(x, 3.0));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 7d-208) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 1.0d0) then
tmp = (x - log(x)) / n
else if (x <= 6.6d+213) then
tmp = ((1.0d0 / x) - (0.5d0 / (x * x))) / n
else
tmp = 0.3333333333333333d0 / (n * (x ** 3.0d0))
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 7e-208) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 1.0) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 6.6e+213) {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
} else {
tmp = 0.3333333333333333 / (n * Math.pow(x, 3.0));
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 7e-208: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 1.0: tmp = (x - math.log(x)) / n elif x <= 6.6e+213: tmp = ((1.0 / x) - (0.5 / (x * x))) / n else: tmp = 0.3333333333333333 / (n * math.pow(x, 3.0)) return tmp
function code(x, n) tmp = 0.0 if (x <= 7e-208) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 1.0) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 6.6e+213) tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n); else tmp = Float64(0.3333333333333333 / Float64(n * (x ^ 3.0))); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 7e-208) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 1.0) tmp = (x - log(x)) / n; elseif (x <= 6.6e+213) tmp = ((1.0 / x) - (0.5 / (x * x))) / n; else tmp = 0.3333333333333333 / (n * (x ^ 3.0)); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 7e-208], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 6.6e+213], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(0.3333333333333333 / N[(n * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7 \cdot 10^{-208}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{+213}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\
\end{array}
\end{array}
if x < 6.99999999999999982e-208Initial program 63.4%
Taylor expanded in x around 0 63.4%
*-rgt-identity63.4%
associate-*r/63.4%
unpow-163.4%
exp-to-pow63.4%
unpow-163.4%
Simplified63.4%
if 6.99999999999999982e-208 < x < 1Initial program 36.7%
Taylor expanded in n around inf 55.3%
log1p-def55.3%
Simplified55.3%
Taylor expanded in x around 0 53.6%
neg-mul-153.6%
unsub-neg53.6%
Simplified53.6%
if 1 < x < 6.6000000000000002e213Initial program 52.3%
Taylor expanded in n around inf 50.1%
log1p-def50.1%
Simplified50.1%
Taylor expanded in x around inf 71.0%
associate-*r/71.0%
metadata-eval71.0%
unpow271.0%
Simplified71.0%
if 6.6000000000000002e213 < x Initial program 95.5%
Taylor expanded in n around inf 95.5%
log1p-def95.5%
Simplified95.5%
Taylor expanded in x around inf 71.8%
associate--l+71.8%
associate-*r/71.8%
metadata-eval71.8%
associate-*r/71.8%
metadata-eval71.8%
unpow271.8%
Simplified71.8%
Taylor expanded in x around 0 95.5%
Final simplification65.5%
(FPCore (x n)
:precision binary64
(if (<= x 5.6e-209)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.96)
(- (/ x n) (/ (log x) n))
(if (<= x 1e+215)
(/ (- (/ 1.0 x) (/ 0.5 (* x x))) n)
(/ 0.3333333333333333 (* n (pow x 3.0)))))))
double code(double x, double n) {
double tmp;
if (x <= 5.6e-209) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.96) {
tmp = (x / n) - (log(x) / n);
} else if (x <= 1e+215) {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
} else {
tmp = 0.3333333333333333 / (n * pow(x, 3.0));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 5.6d-209) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.96d0) then
tmp = (x / n) - (log(x) / n)
else if (x <= 1d+215) then
tmp = ((1.0d0 / x) - (0.5d0 / (x * x))) / n
else
tmp = 0.3333333333333333d0 / (n * (x ** 3.0d0))
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 5.6e-209) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.96) {
tmp = (x / n) - (Math.log(x) / n);
} else if (x <= 1e+215) {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
} else {
tmp = 0.3333333333333333 / (n * Math.pow(x, 3.0));
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 5.6e-209: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.96: tmp = (x / n) - (math.log(x) / n) elif x <= 1e+215: tmp = ((1.0 / x) - (0.5 / (x * x))) / n else: tmp = 0.3333333333333333 / (n * math.pow(x, 3.0)) return tmp
function code(x, n) tmp = 0.0 if (x <= 5.6e-209) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.96) tmp = Float64(Float64(x / n) - Float64(log(x) / n)); elseif (x <= 1e+215) tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n); else tmp = Float64(0.3333333333333333 / Float64(n * (x ^ 3.0))); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 5.6e-209) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.96) tmp = (x / n) - (log(x) / n); elseif (x <= 1e+215) tmp = ((1.0 / x) - (0.5 / (x * x))) / n; else tmp = 0.3333333333333333 / (n * (x ^ 3.0)); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 5.6e-209], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.96], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1e+215], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(0.3333333333333333 / N[(n * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.6 \cdot 10^{-209}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.96:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{elif}\;x \leq 10^{+215}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\
\end{array}
\end{array}
if x < 5.60000000000000025e-209Initial program 63.4%
Taylor expanded in x around 0 63.4%
*-rgt-identity63.4%
associate-*r/63.4%
unpow-163.4%
exp-to-pow63.4%
unpow-163.4%
Simplified63.4%
if 5.60000000000000025e-209 < x < 0.95999999999999996Initial program 36.7%
Taylor expanded in n around inf 55.3%
log1p-def55.3%
Simplified55.3%
Taylor expanded in x around 0 53.6%
mul-1-neg53.6%
unsub-neg53.6%
Simplified53.6%
if 0.95999999999999996 < x < 9.99999999999999907e214Initial program 52.3%
Taylor expanded in n around inf 50.1%
log1p-def50.1%
Simplified50.1%
Taylor expanded in x around inf 71.0%
associate-*r/71.0%
metadata-eval71.0%
unpow271.0%
Simplified71.0%
if 9.99999999999999907e214 < x Initial program 95.5%
Taylor expanded in n around inf 95.5%
log1p-def95.5%
Simplified95.5%
Taylor expanded in x around inf 71.8%
associate--l+71.8%
associate-*r/71.8%
metadata-eval71.8%
associate-*r/71.8%
metadata-eval71.8%
unpow271.8%
Simplified71.8%
Taylor expanded in x around 0 95.5%
Final simplification65.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x 2.8e-208)
(- 1.0 t_0)
(if (<= x 0.88) (- (/ x n) (/ (log x) n)) (/ t_0 (* n x))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= 2.8e-208) {
tmp = 1.0 - t_0;
} else if (x <= 0.88) {
tmp = (x / n) - (log(x) / n);
} else {
tmp = t_0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (x <= 2.8d-208) then
tmp = 1.0d0 - t_0
else if (x <= 0.88d0) then
tmp = (x / n) - (log(x) / n)
else
tmp = t_0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 2.8e-208) {
tmp = 1.0 - t_0;
} else if (x <= 0.88) {
tmp = (x / n) - (Math.log(x) / n);
} else {
tmp = t_0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if x <= 2.8e-208: tmp = 1.0 - t_0 elif x <= 0.88: tmp = (x / n) - (math.log(x) / n) else: tmp = t_0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 2.8e-208) tmp = Float64(1.0 - t_0); elseif (x <= 0.88) tmp = Float64(Float64(x / n) - Float64(log(x) / n)); else tmp = Float64(t_0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (x <= 2.8e-208) tmp = 1.0 - t_0; elseif (x <= 0.88) tmp = (x / n) - (log(x) / n); else tmp = t_0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 2.8e-208], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[x, 0.88], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 2.8 \cdot 10^{-208}:\\
\;\;\;\;1 - t_0\\
\mathbf{elif}\;x \leq 0.88:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\end{array}
\end{array}
if x < 2.80000000000000001e-208Initial program 63.4%
Taylor expanded in x around 0 63.4%
*-rgt-identity63.4%
associate-*r/63.4%
unpow-163.4%
exp-to-pow63.4%
unpow-163.4%
Simplified63.4%
if 2.80000000000000001e-208 < x < 0.880000000000000004Initial program 36.7%
Taylor expanded in n around inf 55.3%
log1p-def55.3%
Simplified55.3%
Taylor expanded in x around 0 53.6%
mul-1-neg53.6%
unsub-neg53.6%
Simplified53.6%
if 0.880000000000000004 < x Initial program 67.3%
Taylor expanded in x around inf 97.3%
log-rec97.3%
mul-1-neg97.3%
mul-1-neg97.3%
distribute-frac-neg97.3%
neg-mul-197.3%
remove-double-neg97.3%
*-rgt-identity97.3%
associate-*r/97.3%
unpow-197.3%
exp-to-pow97.3%
unpow-197.3%
*-commutative97.3%
Simplified97.3%
Final simplification72.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x 1.15e-208)
(- (+ 1.0 (/ x n)) t_0)
(if (<= x 0.88) (- (/ x n) (/ (log x) n)) (/ t_0 (* n x))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= 1.15e-208) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 0.88) {
tmp = (x / n) - (log(x) / n);
} else {
tmp = t_0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (x <= 1.15d-208) then
tmp = (1.0d0 + (x / n)) - t_0
else if (x <= 0.88d0) then
tmp = (x / n) - (log(x) / n)
else
tmp = t_0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 1.15e-208) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 0.88) {
tmp = (x / n) - (Math.log(x) / n);
} else {
tmp = t_0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if x <= 1.15e-208: tmp = (1.0 + (x / n)) - t_0 elif x <= 0.88: tmp = (x / n) - (math.log(x) / n) else: tmp = t_0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 1.15e-208) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); elseif (x <= 0.88) tmp = Float64(Float64(x / n) - Float64(log(x) / n)); else tmp = Float64(t_0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (x <= 1.15e-208) tmp = (1.0 + (x / n)) - t_0; elseif (x <= 0.88) tmp = (x / n) - (log(x) / n); else tmp = t_0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 1.15e-208], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 0.88], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 1.15 \cdot 10^{-208}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{elif}\;x \leq 0.88:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\end{array}
\end{array}
if x < 1.14999999999999998e-208Initial program 63.4%
Taylor expanded in x around 0 64.1%
if 1.14999999999999998e-208 < x < 0.880000000000000004Initial program 36.7%
Taylor expanded in n around inf 55.3%
log1p-def55.3%
Simplified55.3%
Taylor expanded in x around 0 53.6%
mul-1-neg53.6%
unsub-neg53.6%
Simplified53.6%
if 0.880000000000000004 < x Initial program 67.3%
Taylor expanded in x around inf 97.3%
log-rec97.3%
mul-1-neg97.3%
mul-1-neg97.3%
distribute-frac-neg97.3%
neg-mul-197.3%
remove-double-neg97.3%
*-rgt-identity97.3%
associate-*r/97.3%
unpow-197.3%
exp-to-pow97.3%
unpow-197.3%
*-commutative97.3%
Simplified97.3%
Final simplification72.5%
(FPCore (x n) :precision binary64 (if (<= x 2e-208) (- 1.0 (pow x (/ 1.0 n))) (if (<= x 0.96) (/ (- x (log x)) n) (/ (- (/ 1.0 x) (/ 0.5 (* x x))) n))))
double code(double x, double n) {
double tmp;
if (x <= 2e-208) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.96) {
tmp = (x - log(x)) / n;
} else {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 2d-208) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.96d0) then
tmp = (x - log(x)) / n
else
tmp = ((1.0d0 / x) - (0.5d0 / (x * x))) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 2e-208) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.96) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2e-208: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.96: tmp = (x - math.log(x)) / n else: tmp = ((1.0 / x) - (0.5 / (x * x))) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 2e-208) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.96) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 2e-208) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.96) tmp = (x - log(x)) / n; else tmp = ((1.0 / x) - (0.5 / (x * x))) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2e-208], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.96], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{-208}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.96:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\
\end{array}
\end{array}
if x < 2.0000000000000002e-208Initial program 63.4%
Taylor expanded in x around 0 63.4%
*-rgt-identity63.4%
associate-*r/63.4%
unpow-163.4%
exp-to-pow63.4%
unpow-163.4%
Simplified63.4%
if 2.0000000000000002e-208 < x < 0.95999999999999996Initial program 36.7%
Taylor expanded in n around inf 55.3%
log1p-def55.3%
Simplified55.3%
Taylor expanded in x around 0 53.6%
neg-mul-153.6%
unsub-neg53.6%
Simplified53.6%
if 0.95999999999999996 < x Initial program 67.3%
Taylor expanded in n around inf 65.9%
log1p-def65.9%
Simplified65.9%
Taylor expanded in x around inf 71.3%
associate-*r/71.3%
metadata-eval71.3%
unpow271.3%
Simplified71.3%
Final simplification62.4%
(FPCore (x n) :precision binary64 (if (<= x 1.0) (/ (- x (log x)) n) (/ (- (/ 1.0 x) (/ 0.5 (* x x))) n)))
double code(double x, double n) {
double tmp;
if (x <= 1.0) {
tmp = (x - log(x)) / n;
} else {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.0d0) then
tmp = (x - log(x)) / n
else
tmp = ((1.0d0 / x) - (0.5d0 / (x * x))) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.0) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.0: tmp = (x - math.log(x)) / n else: tmp = ((1.0 / x) - (0.5 / (x * x))) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.0) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.0) tmp = (x - log(x)) / n; else tmp = ((1.0 / x) - (0.5 / (x * x))) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\
\end{array}
\end{array}
if x < 1Initial program 45.5%
Taylor expanded in n around inf 50.0%
log1p-def50.0%
Simplified50.0%
Taylor expanded in x around 0 48.9%
neg-mul-148.9%
unsub-neg48.9%
Simplified48.9%
if 1 < x Initial program 67.3%
Taylor expanded in n around inf 65.9%
log1p-def65.9%
Simplified65.9%
Taylor expanded in x around inf 71.3%
associate-*r/71.3%
metadata-eval71.3%
unpow271.3%
Simplified71.3%
Final simplification57.4%
(FPCore (x n) :precision binary64 (if (<= x 0.68) (/ (- (log x)) n) (/ (- (/ 1.0 x) (/ 0.5 (* x x))) n)))
double code(double x, double n) {
double tmp;
if (x <= 0.68) {
tmp = -log(x) / n;
} else {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.68d0) then
tmp = -log(x) / n
else
tmp = ((1.0d0 / x) - (0.5d0 / (x * x))) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.68) {
tmp = -Math.log(x) / n;
} else {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.68: tmp = -math.log(x) / n else: tmp = ((1.0 / x) - (0.5 / (x * x))) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.68) tmp = Float64(Float64(-log(x)) / n); else tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.68) tmp = -log(x) / n; else tmp = ((1.0 / x) - (0.5 / (x * x))) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.68], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.68:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\
\end{array}
\end{array}
if x < 0.680000000000000049Initial program 45.1%
Taylor expanded in n around inf 50.3%
log1p-def50.3%
Simplified50.3%
Taylor expanded in x around 0 48.3%
neg-mul-148.3%
Simplified48.3%
if 0.680000000000000049 < x Initial program 67.6%
Taylor expanded in n around inf 65.3%
log1p-def65.3%
Simplified65.3%
Taylor expanded in x around inf 70.6%
associate-*r/70.6%
metadata-eval70.6%
unpow270.6%
Simplified70.6%
Final simplification57.0%
(FPCore (x n) :precision binary64 (/ 1.0 (* n x)))
double code(double x, double n) {
return 1.0 / (n * x);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 1.0d0 / (n * x)
end function
public static double code(double x, double n) {
return 1.0 / (n * x);
}
def code(x, n): return 1.0 / (n * x)
function code(x, n) return Float64(1.0 / Float64(n * x)) end
function tmp = code(x, n) tmp = 1.0 / (n * x); end
code[x_, n_] := N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{n \cdot x}
\end{array}
Initial program 53.8%
Taylor expanded in n around inf 56.1%
log1p-def56.1%
Simplified56.1%
Taylor expanded in x around inf 39.3%
*-commutative39.3%
Simplified39.3%
Final simplification39.3%
(FPCore (x n) :precision binary64 (/ (/ 1.0 n) x))
double code(double x, double n) {
return (1.0 / n) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / n) / x
end function
public static double code(double x, double n) {
return (1.0 / n) / x;
}
def code(x, n): return (1.0 / n) / x
function code(x, n) return Float64(Float64(1.0 / n) / x) end
function tmp = code(x, n) tmp = (1.0 / n) / x; end
code[x_, n_] := N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n}}{x}
\end{array}
Initial program 53.8%
Taylor expanded in n around inf 56.1%
log1p-def56.1%
Simplified56.1%
Taylor expanded in x around inf 39.3%
*-commutative39.3%
Simplified39.3%
add-cbrt-cube41.9%
Applied egg-rr41.9%
associate-*l*41.9%
associate-*l/41.9%
*-lft-identity41.9%
Simplified41.9%
cbrt-prod40.0%
div-inv40.0%
cbrt-prod39.1%
associate-*l*39.1%
add-cube-cbrt39.3%
*-commutative39.3%
associate-/r*39.8%
Applied egg-rr39.8%
Final simplification39.8%
(FPCore (x n) :precision binary64 (/ (/ 1.0 x) n))
double code(double x, double n) {
return (1.0 / x) / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / x) / n
end function
public static double code(double x, double n) {
return (1.0 / x) / n;
}
def code(x, n): return (1.0 / x) / n
function code(x, n) return Float64(Float64(1.0 / x) / n) end
function tmp = code(x, n) tmp = (1.0 / x) / n; end
code[x_, n_] := N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{n}
\end{array}
Initial program 53.8%
Taylor expanded in n around inf 56.1%
log1p-def56.1%
Simplified56.1%
Taylor expanded in x around inf 39.8%
Final simplification39.8%
(FPCore (x n) :precision binary64 (/ x n))
double code(double x, double n) {
return x / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = x / n
end function
public static double code(double x, double n) {
return x / n;
}
def code(x, n): return x / n
function code(x, n) return Float64(x / n) end
function tmp = code(x, n) tmp = x / n; end
code[x_, n_] := N[(x / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{n}
\end{array}
Initial program 53.8%
Taylor expanded in n around inf 56.1%
log1p-def56.1%
Simplified56.1%
Taylor expanded in x around inf 39.8%
associate-/r*39.3%
expm1-log1p-u31.7%
expm1-udef24.7%
associate-/r*24.7%
add-exp-log24.7%
rec-exp24.7%
add-exp-log5.2%
add-sqr-sqrt5.2%
sqrt-unprod5.2%
add-exp-log5.2%
add-exp-log11.4%
sqr-neg11.4%
sqrt-unprod6.2%
add-sqr-sqrt8.9%
add-exp-log8.9%
Applied egg-rr8.9%
expm1-def4.3%
expm1-log1p5.0%
Simplified5.0%
Final simplification5.0%
herbie shell --seed 2023274
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))