
(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 21 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))))
(if (<= (/ 1.0 n) -1e-5)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 1e-133)
(/
(+
(log1p x)
(- (* 0.5 (/ (- (pow (log1p x) 2.0) (pow (log x) 2.0)) n)) (log x)))
n)
(if (<= (/ 1.0 n) 2e-7)
(/
(+
(/ t_0 n)
(*
t_0
(+
(/ (fma 0.5 (pow n -2.0) (/ -0.5 n)) x)
(/
(+
(/ 0.16666666666666666 (pow n 3.0))
(+ (/ 0.3333333333333333 n) (* (pow n -2.0) -0.5)))
(pow x 2.0)))))
x)
(pow (pow (- (exp (/ x n)) t_0) 3.0) 0.3333333333333333))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-133) {
tmp = (log1p(x) + ((0.5 * ((pow(log1p(x), 2.0) - pow(log(x), 2.0)) / n)) - log(x))) / n;
} else if ((1.0 / n) <= 2e-7) {
tmp = ((t_0 / n) + (t_0 * ((fma(0.5, pow(n, -2.0), (-0.5 / n)) / x) + (((0.16666666666666666 / pow(n, 3.0)) + ((0.3333333333333333 / n) + (pow(n, -2.0) * -0.5))) / pow(x, 2.0))))) / x;
} else {
tmp = pow(pow((exp((x / n)) - t_0), 3.0), 0.3333333333333333);
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-5) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-133) tmp = Float64(Float64(log1p(x) + Float64(Float64(0.5 * Float64(Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)) / n)) - log(x))) / n); elseif (Float64(1.0 / n) <= 2e-7) tmp = Float64(Float64(Float64(t_0 / n) + Float64(t_0 * Float64(Float64(fma(0.5, (n ^ -2.0), Float64(-0.5 / n)) / x) + Float64(Float64(Float64(0.16666666666666666 / (n ^ 3.0)) + Float64(Float64(0.3333333333333333 / n) + Float64((n ^ -2.0) * -0.5))) / (x ^ 2.0))))) / x); else tmp = (Float64(exp(Float64(x / n)) - t_0) ^ 3.0) ^ 0.3333333333333333; 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], -1e-5], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-133], N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(0.5 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-7], N[(N[(N[(t$95$0 / n), $MachinePrecision] + N[(t$95$0 * N[(N[(N[(0.5 * N[Power[n, -2.0], $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(N[(N[(0.16666666666666666 / N[Power[n, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.3333333333333333 / n), $MachinePrecision] + N[(N[Power[n, -2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[Power[N[Power[N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], 3.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-5}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-133}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n} - \log x\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{\frac{t\_0}{n} + t\_0 \cdot \left(\frac{\mathsf{fma}\left(0.5, {n}^{-2}, \frac{-0.5}{n}\right)}{x} + \frac{\frac{0.16666666666666666}{{n}^{3}} + \left(\frac{0.3333333333333333}{n} + {n}^{-2} \cdot -0.5\right)}{{x}^{2}}\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(e^{\frac{x}{n}} - t\_0\right)}^{3}\right)}^{0.3333333333333333}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000008e-5Initial program 96.1%
Taylor expanded in x around inf 99.9%
log-rec99.9%
mul-1-neg99.9%
neg-mul-199.9%
mul-1-neg99.9%
distribute-frac-neg99.9%
remove-double-neg99.9%
*-rgt-identity99.9%
associate-/l*99.9%
exp-to-pow99.9%
*-commutative99.9%
Simplified99.9%
if -1.00000000000000008e-5 < (/.f64 #s(literal 1 binary64) n) < 1.0000000000000001e-133Initial program 39.0%
Taylor expanded in n around inf 83.7%
associate--l+83.7%
log1p-define83.7%
+-commutative83.7%
associate--r+83.7%
distribute-lft-out--83.7%
div-sub83.7%
log1p-define83.7%
Simplified83.7%
if 1.0000000000000001e-133 < (/.f64 #s(literal 1 binary64) n) < 1.9999999999999999e-7Initial program 15.9%
Taylor expanded in x around inf 69.7%
Simplified69.7%
if 1.9999999999999999e-7 < (/.f64 #s(literal 1 binary64) n) Initial program 47.1%
add-cbrt-cube47.1%
pow347.1%
pow-to-exp47.1%
un-div-inv47.1%
+-commutative47.1%
log1p-define99.7%
Applied egg-rr99.7%
rem-cbrt-cube99.8%
*-un-lft-identity99.8%
exp-prod100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
add-cbrt-cube99.9%
pow1/399.8%
pow399.8%
pow-exp100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
Final simplification89.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-5)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-133)
(/
(+
(log1p x)
(- (* 0.5 (/ (- (pow (log1p x) 2.0) (pow (log x) 2.0)) n)) (log x)))
n)
(if (<= (/ 1.0 n) 2e-7)
(/ (/ (+ 1.0 (/ (log x) n)) x) n)
(pow (pow (- (exp (/ x n)) t_0) 3.0) 0.3333333333333333))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-133) {
tmp = (log1p(x) + ((0.5 * ((pow(log1p(x), 2.0) - pow(log(x), 2.0)) / n)) - log(x))) / n;
} else if ((1.0 / n) <= 2e-7) {
tmp = ((1.0 + (log(x) / n)) / x) / n;
} else {
tmp = pow(pow((exp((x / n)) - t_0), 3.0), 0.3333333333333333);
}
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) <= -1e-5) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-133) {
tmp = (Math.log1p(x) + ((0.5 * ((Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0)) / n)) - Math.log(x))) / n;
} else if ((1.0 / n) <= 2e-7) {
tmp = ((1.0 + (Math.log(x) / n)) / x) / n;
} else {
tmp = Math.pow(Math.pow((Math.exp((x / n)) - t_0), 3.0), 0.3333333333333333);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-5: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-133: tmp = (math.log1p(x) + ((0.5 * ((math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0)) / n)) - math.log(x))) / n elif (1.0 / n) <= 2e-7: tmp = ((1.0 + (math.log(x) / n)) / x) / n else: tmp = math.pow(math.pow((math.exp((x / n)) - t_0), 3.0), 0.3333333333333333) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-5) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-133) tmp = Float64(Float64(log1p(x) + Float64(Float64(0.5 * Float64(Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)) / n)) - log(x))) / n); elseif (Float64(1.0 / n) <= 2e-7) tmp = Float64(Float64(Float64(1.0 + Float64(log(x) / n)) / x) / n); else tmp = (Float64(exp(Float64(x / n)) - t_0) ^ 3.0) ^ 0.3333333333333333; 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], -1e-5], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-133], N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(0.5 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-7], N[(N[(N[(1.0 + N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], N[Power[N[Power[N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], 3.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-5}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-133}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n} - \log x\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{\frac{1 + \frac{\log x}{n}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(e^{\frac{x}{n}} - t\_0\right)}^{3}\right)}^{0.3333333333333333}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000008e-5Initial program 96.1%
Taylor expanded in x around inf 99.9%
log-rec99.9%
mul-1-neg99.9%
neg-mul-199.9%
mul-1-neg99.9%
distribute-frac-neg99.9%
remove-double-neg99.9%
*-rgt-identity99.9%
associate-/l*99.9%
exp-to-pow99.9%
*-commutative99.9%
Simplified99.9%
if -1.00000000000000008e-5 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-133Initial program 38.7%
Taylor expanded in n around inf 83.7%
associate--l+83.7%
log1p-define83.7%
+-commutative83.7%
associate--r+83.7%
distribute-lft-out--83.7%
div-sub83.7%
log1p-define83.7%
Simplified83.7%
if 2.0000000000000001e-133 < (/.f64 #s(literal 1 binary64) n) < 1.9999999999999999e-7Initial program 16.3%
Taylor expanded in n around inf 44.9%
associate--l+44.9%
log1p-define44.9%
+-commutative44.9%
associate--r+44.9%
distribute-lft-out--44.9%
div-sub44.9%
log1p-define44.9%
Simplified44.9%
Taylor expanded in x around inf 68.2%
+-commutative68.2%
mul-1-neg68.2%
log-rec68.2%
distribute-neg-frac68.2%
remove-double-neg68.2%
Simplified68.2%
if 1.9999999999999999e-7 < (/.f64 #s(literal 1 binary64) n) Initial program 47.1%
add-cbrt-cube47.1%
pow347.1%
pow-to-exp47.1%
un-div-inv47.1%
+-commutative47.1%
log1p-define99.7%
Applied egg-rr99.7%
rem-cbrt-cube99.8%
*-un-lft-identity99.8%
exp-prod100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
add-cbrt-cube99.9%
pow1/399.8%
pow399.8%
pow-exp100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
Final simplification89.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n)))
(t_1 (- (pow (+ 1.0 x) (/ 1.0 n)) t_0))
(t_2 (/ (+ -0.3333333333333333 (/ 0.25 x)) x)))
(if (<= t_1 (- INFINITY))
(- 1.0 t_0)
(if (<= t_1 5e-10)
(/ (log (/ (+ 1.0 x) x)) n)
(/
1.0
(/
x
(/ (+ n (/ x (/ (- 0.5 t_2) n))) (/ (* n x) (/ (+ -0.5 t_2) n)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = pow((1.0 + x), (1.0 / n)) - t_0;
double t_2 = (-0.3333333333333333 + (0.25 / x)) / x;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = 1.0 - t_0;
} else if (t_1 <= 5e-10) {
tmp = log(((1.0 + x) / x)) / n;
} else {
tmp = 1.0 / (x / ((n + (x / ((0.5 - t_2) / n))) / ((n * x) / ((-0.5 + t_2) / n))));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.pow((1.0 + x), (1.0 / n)) - t_0;
double t_2 = (-0.3333333333333333 + (0.25 / x)) / x;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = 1.0 - t_0;
} else if (t_1 <= 5e-10) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else {
tmp = 1.0 / (x / ((n + (x / ((0.5 - t_2) / n))) / ((n * x) / ((-0.5 + t_2) / n))));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.pow((1.0 + x), (1.0 / n)) - t_0 t_2 = (-0.3333333333333333 + (0.25 / x)) / x tmp = 0 if t_1 <= -math.inf: tmp = 1.0 - t_0 elif t_1 <= 5e-10: tmp = math.log(((1.0 + x) / x)) / n else: tmp = 1.0 / (x / ((n + (x / ((0.5 - t_2) / n))) / ((n * x) / ((-0.5 + t_2) / n)))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64((Float64(1.0 + x) ^ Float64(1.0 / n)) - t_0) t_2 = Float64(Float64(-0.3333333333333333 + Float64(0.25 / x)) / x) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(1.0 - t_0); elseif (t_1 <= 5e-10) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); else tmp = Float64(1.0 / Float64(x / Float64(Float64(n + Float64(x / Float64(Float64(0.5 - t_2) / n))) / Float64(Float64(n * x) / Float64(Float64(-0.5 + t_2) / n))))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = ((1.0 + x) ^ (1.0 / n)) - t_0; t_2 = (-0.3333333333333333 + (0.25 / x)) / x; tmp = 0.0; if (t_1 <= -Inf) tmp = 1.0 - t_0; elseif (t_1 <= 5e-10) tmp = log(((1.0 + x) / x)) / n; else tmp = 1.0 / (x / ((n + (x / ((0.5 - t_2) / n))) / ((n * x) / ((-0.5 + t_2) / n)))); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(1.0 + x), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(-0.3333333333333333 + N[(0.25 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[t$95$1, 5e-10], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(1.0 / N[(x / N[(N[(n + N[(x / N[(N[(0.5 - t$95$2), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(n * x), $MachinePrecision] / N[(N[(-0.5 + t$95$2), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
t_2 := \frac{-0.3333333333333333 + \frac{0.25}{x}}{x}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;1 - t\_0\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-10}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x}{\frac{n + \frac{x}{\frac{0.5 - t\_2}{n}}}{\frac{n \cdot x}{\frac{-0.5 + t\_2}{n}}}}}\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -inf.0Initial program 100.0%
Taylor expanded in x around 0 100.0%
*-rgt-identity100.0%
associate-*l/100.0%
associate-/l*100.0%
exp-to-pow100.0%
Simplified100.0%
if -inf.0 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 5.00000000000000031e-10Initial program 47.0%
Taylor expanded in n around inf 79.7%
log1p-define79.7%
Simplified79.7%
log1p-undefine79.7%
diff-log79.1%
Applied egg-rr79.1%
+-commutative79.1%
Simplified79.1%
if 5.00000000000000031e-10 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) Initial program 47.1%
Taylor expanded in n around inf 5.9%
log1p-define5.9%
Simplified5.9%
Taylor expanded in x around -inf 0.3%
associate-*r/0.3%
Simplified0.3%
clear-num0.3%
inv-pow0.3%
Applied egg-rr50.7%
unpow-150.7%
sub-neg50.7%
*-lft-identity50.7%
*-lft-identity50.7%
associate-/l/50.7%
sub-neg50.7%
metadata-eval50.7%
distribute-neg-frac50.7%
metadata-eval50.7%
Simplified50.7%
clear-num50.7%
frac-add52.9%
*-un-lft-identity52.9%
associate-/r*52.9%
sub-div52.9%
associate-/r*52.9%
sub-div52.9%
Applied egg-rr52.9%
Simplified52.9%
Final simplification77.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-5)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-133)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 2e-7)
(/ (/ (+ 1.0 (/ (log x) n)) x) n)
(pow (pow (- (exp (/ x n)) t_0) 3.0) 0.3333333333333333))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-133) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e-7) {
tmp = ((1.0 + (log(x) / n)) / x) / n;
} else {
tmp = pow(pow((exp((x / n)) - t_0), 3.0), 0.3333333333333333);
}
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 ((1.0d0 / n) <= (-1d-5)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 2d-133) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 2d-7) then
tmp = ((1.0d0 + (log(x) / n)) / x) / n
else
tmp = ((exp((x / n)) - t_0) ** 3.0d0) ** 0.3333333333333333d0
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 ((1.0 / n) <= -1e-5) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-133) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e-7) {
tmp = ((1.0 + (Math.log(x) / n)) / x) / n;
} else {
tmp = Math.pow(Math.pow((Math.exp((x / n)) - t_0), 3.0), 0.3333333333333333);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-5: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-133: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 2e-7: tmp = ((1.0 + (math.log(x) / n)) / x) / n else: tmp = math.pow(math.pow((math.exp((x / n)) - t_0), 3.0), 0.3333333333333333) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-5) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-133) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 2e-7) tmp = Float64(Float64(Float64(1.0 + Float64(log(x) / n)) / x) / n); else tmp = (Float64(exp(Float64(x / n)) - t_0) ^ 3.0) ^ 0.3333333333333333; end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-5) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 2e-133) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 2e-7) tmp = ((1.0 + (log(x) / n)) / x) / n; else tmp = ((exp((x / n)) - t_0) ^ 3.0) ^ 0.3333333333333333; end tmp_2 = 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], -1e-5], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-133], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-7], N[(N[(N[(1.0 + N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], N[Power[N[Power[N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], 3.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-5}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-133}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{\frac{1 + \frac{\log x}{n}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(e^{\frac{x}{n}} - t\_0\right)}^{3}\right)}^{0.3333333333333333}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000008e-5Initial program 96.1%
Taylor expanded in x around inf 99.9%
log-rec99.9%
mul-1-neg99.9%
neg-mul-199.9%
mul-1-neg99.9%
distribute-frac-neg99.9%
remove-double-neg99.9%
*-rgt-identity99.9%
associate-/l*99.9%
exp-to-pow99.9%
*-commutative99.9%
Simplified99.9%
if -1.00000000000000008e-5 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-133Initial program 38.7%
Taylor expanded in n around inf 83.2%
log1p-define83.2%
Simplified83.2%
log1p-undefine83.2%
diff-log83.2%
Applied egg-rr83.2%
+-commutative83.2%
Simplified83.2%
if 2.0000000000000001e-133 < (/.f64 #s(literal 1 binary64) n) < 1.9999999999999999e-7Initial program 16.3%
Taylor expanded in n around inf 44.9%
associate--l+44.9%
log1p-define44.9%
+-commutative44.9%
associate--r+44.9%
distribute-lft-out--44.9%
div-sub44.9%
log1p-define44.9%
Simplified44.9%
Taylor expanded in x around inf 68.2%
+-commutative68.2%
mul-1-neg68.2%
log-rec68.2%
distribute-neg-frac68.2%
remove-double-neg68.2%
Simplified68.2%
if 1.9999999999999999e-7 < (/.f64 #s(literal 1 binary64) n) Initial program 47.1%
add-cbrt-cube47.1%
pow347.1%
pow-to-exp47.1%
un-div-inv47.1%
+-commutative47.1%
log1p-define99.7%
Applied egg-rr99.7%
rem-cbrt-cube99.8%
*-un-lft-identity99.8%
exp-prod100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
add-cbrt-cube99.9%
pow1/399.8%
pow399.8%
pow-exp100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
Final simplification89.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-5)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-133)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 2e-7)
(/ (/ (+ 1.0 (/ (log x) n)) x) n)
(- (pow E (/ x n)) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-133) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e-7) {
tmp = ((1.0 + (log(x) / n)) / x) / n;
} else {
tmp = pow(((double) M_E), (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) <= -1e-5) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-133) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e-7) {
tmp = ((1.0 + (Math.log(x) / n)) / x) / n;
} else {
tmp = Math.pow(Math.E, (x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-5: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-133: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 2e-7: tmp = ((1.0 + (math.log(x) / n)) / x) / n else: tmp = math.pow(math.e, (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) <= -1e-5) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-133) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 2e-7) tmp = Float64(Float64(Float64(1.0 + Float64(log(x) / n)) / x) / n); else tmp = Float64((exp(1) ^ Float64(x / n)) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-5) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 2e-133) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 2e-7) tmp = ((1.0 + (log(x) / n)) / x) / n; else tmp = (2.71828182845904523536 ^ (x / n)) - t_0; end tmp_2 = 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], -1e-5], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-133], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-7], N[(N[(N[(1.0 + N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], N[(N[Power[E, 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 -1 \cdot 10^{-5}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-133}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{\frac{1 + \frac{\log x}{n}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;{e}^{\left(\frac{x}{n}\right)} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000008e-5Initial program 96.1%
Taylor expanded in x around inf 99.9%
log-rec99.9%
mul-1-neg99.9%
neg-mul-199.9%
mul-1-neg99.9%
distribute-frac-neg99.9%
remove-double-neg99.9%
*-rgt-identity99.9%
associate-/l*99.9%
exp-to-pow99.9%
*-commutative99.9%
Simplified99.9%
if -1.00000000000000008e-5 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-133Initial program 38.7%
Taylor expanded in n around inf 83.2%
log1p-define83.2%
Simplified83.2%
log1p-undefine83.2%
diff-log83.2%
Applied egg-rr83.2%
+-commutative83.2%
Simplified83.2%
if 2.0000000000000001e-133 < (/.f64 #s(literal 1 binary64) n) < 1.9999999999999999e-7Initial program 16.3%
Taylor expanded in n around inf 44.9%
associate--l+44.9%
log1p-define44.9%
+-commutative44.9%
associate--r+44.9%
distribute-lft-out--44.9%
div-sub44.9%
log1p-define44.9%
Simplified44.9%
Taylor expanded in x around inf 68.2%
+-commutative68.2%
mul-1-neg68.2%
log-rec68.2%
distribute-neg-frac68.2%
remove-double-neg68.2%
Simplified68.2%
if 1.9999999999999999e-7 < (/.f64 #s(literal 1 binary64) n) Initial program 47.1%
add-cbrt-cube47.1%
pow347.1%
pow-to-exp47.1%
un-div-inv47.1%
+-commutative47.1%
log1p-define99.7%
Applied egg-rr99.7%
rem-cbrt-cube99.8%
*-un-lft-identity99.8%
exp-prod100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
*-un-lft-identity100.0%
exp-1-e100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
Simplified100.0%
Final simplification89.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-5)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-133)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 2e-7)
(/ (/ (+ 1.0 (/ (log x) n)) 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) <= -1e-5) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-133) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e-7) {
tmp = ((1.0 + (log(x) / n)) / x) / n;
} else {
tmp = exp((x / n)) - t_0;
}
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 ((1.0d0 / n) <= (-1d-5)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 2d-133) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 2d-7) then
tmp = ((1.0d0 + (log(x) / n)) / x) / n
else
tmp = exp((x / n)) - t_0
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 ((1.0 / n) <= -1e-5) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-133) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e-7) {
tmp = ((1.0 + (Math.log(x) / n)) / 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) <= -1e-5: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-133: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 2e-7: tmp = ((1.0 + (math.log(x) / n)) / 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) <= -1e-5) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-133) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 2e-7) tmp = Float64(Float64(Float64(1.0 + Float64(log(x) / n)) / x) / n); else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-5) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 2e-133) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 2e-7) tmp = ((1.0 + (log(x) / n)) / x) / n; else tmp = exp((x / n)) - t_0; end tmp_2 = 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], -1e-5], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-133], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-7], N[(N[(N[(1.0 + N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / x), $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 -1 \cdot 10^{-5}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-133}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{\frac{1 + \frac{\log x}{n}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000008e-5Initial program 96.1%
Taylor expanded in x around inf 99.9%
log-rec99.9%
mul-1-neg99.9%
neg-mul-199.9%
mul-1-neg99.9%
distribute-frac-neg99.9%
remove-double-neg99.9%
*-rgt-identity99.9%
associate-/l*99.9%
exp-to-pow99.9%
*-commutative99.9%
Simplified99.9%
if -1.00000000000000008e-5 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-133Initial program 38.7%
Taylor expanded in n around inf 83.2%
log1p-define83.2%
Simplified83.2%
log1p-undefine83.2%
diff-log83.2%
Applied egg-rr83.2%
+-commutative83.2%
Simplified83.2%
if 2.0000000000000001e-133 < (/.f64 #s(literal 1 binary64) n) < 1.9999999999999999e-7Initial program 16.3%
Taylor expanded in n around inf 44.9%
associate--l+44.9%
log1p-define44.9%
+-commutative44.9%
associate--r+44.9%
distribute-lft-out--44.9%
div-sub44.9%
log1p-define44.9%
Simplified44.9%
Taylor expanded in x around inf 68.2%
+-commutative68.2%
mul-1-neg68.2%
log-rec68.2%
distribute-neg-frac68.2%
remove-double-neg68.2%
Simplified68.2%
if 1.9999999999999999e-7 < (/.f64 #s(literal 1 binary64) n) Initial program 47.1%
add-cbrt-cube47.1%
pow347.1%
pow-to-exp47.1%
un-div-inv47.1%
+-commutative47.1%
log1p-define99.7%
Applied egg-rr99.7%
rem-cbrt-cube99.8%
*-un-lft-identity99.8%
exp-prod100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in x around inf 99.8%
Final simplification89.2%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -1e-5)
(/ (pow x (/ 1.0 n)) (* n x))
(if (<= (/ 1.0 n) 2e-133)
(/ (log (/ (+ 1.0 x) x)) n)
(/ (log1p (expm1 (/ 1.0 n))) x))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = pow(x, (1.0 / n)) / (n * x);
} else if ((1.0 / n) <= 2e-133) {
tmp = log(((1.0 + x) / x)) / n;
} else {
tmp = log1p(expm1((1.0 / n))) / x;
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = Math.pow(x, (1.0 / n)) / (n * x);
} else if ((1.0 / n) <= 2e-133) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else {
tmp = Math.log1p(Math.expm1((1.0 / n))) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1e-5: tmp = math.pow(x, (1.0 / n)) / (n * x) elif (1.0 / n) <= 2e-133: tmp = math.log(((1.0 + x) / x)) / n else: tmp = math.log1p(math.expm1((1.0 / n))) / x return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-5) tmp = Float64((x ^ Float64(1.0 / n)) / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-133) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); else tmp = Float64(log1p(expm1(Float64(1.0 / n))) / x); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-5], N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-133], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[Log[1 + N[(Exp[N[(1.0 / n), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-5}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-133}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{n}\right)\right)}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000008e-5Initial program 96.1%
Taylor expanded in x around inf 99.9%
log-rec99.9%
mul-1-neg99.9%
neg-mul-199.9%
mul-1-neg99.9%
distribute-frac-neg99.9%
remove-double-neg99.9%
*-rgt-identity99.9%
associate-/l*99.9%
exp-to-pow99.9%
*-commutative99.9%
Simplified99.9%
if -1.00000000000000008e-5 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-133Initial program 38.7%
Taylor expanded in n around inf 83.2%
log1p-define83.2%
Simplified83.2%
log1p-undefine83.2%
diff-log83.2%
Applied egg-rr83.2%
+-commutative83.2%
Simplified83.2%
if 2.0000000000000001e-133 < (/.f64 #s(literal 1 binary64) n) Initial program 35.8%
Taylor expanded in n around inf 19.8%
log1p-define19.8%
Simplified19.8%
Taylor expanded in x around -inf 24.2%
associate-*r/24.2%
Simplified24.2%
Taylor expanded in x around inf 44.4%
log1p-expm1-u60.8%
Applied egg-rr60.8%
Final simplification82.0%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -1e-5)
(/ (pow x (/ 1.0 n)) (* n x))
(if (<= (/ 1.0 n) 2e-133)
(/ (log (/ (+ 1.0 x) x)) n)
(log1p (expm1 (/ (/ 1.0 x) n))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = pow(x, (1.0 / n)) / (n * x);
} else if ((1.0 / n) <= 2e-133) {
tmp = log(((1.0 + x) / x)) / n;
} else {
tmp = log1p(expm1(((1.0 / x) / n)));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = Math.pow(x, (1.0 / n)) / (n * x);
} else if ((1.0 / n) <= 2e-133) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else {
tmp = Math.log1p(Math.expm1(((1.0 / x) / n)));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1e-5: tmp = math.pow(x, (1.0 / n)) / (n * x) elif (1.0 / n) <= 2e-133: tmp = math.log(((1.0 + x) / x)) / n else: tmp = math.log1p(math.expm1(((1.0 / x) / n))) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-5) tmp = Float64((x ^ Float64(1.0 / n)) / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-133) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); else tmp = log1p(expm1(Float64(Float64(1.0 / x) / n))); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-5], N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-133], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[Log[1 + N[(Exp[N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-5}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-133}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{x}}{n}\right)\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000008e-5Initial program 96.1%
Taylor expanded in x around inf 99.9%
log-rec99.9%
mul-1-neg99.9%
neg-mul-199.9%
mul-1-neg99.9%
distribute-frac-neg99.9%
remove-double-neg99.9%
*-rgt-identity99.9%
associate-/l*99.9%
exp-to-pow99.9%
*-commutative99.9%
Simplified99.9%
if -1.00000000000000008e-5 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-133Initial program 38.7%
Taylor expanded in n around inf 83.2%
log1p-define83.2%
Simplified83.2%
log1p-undefine83.2%
diff-log83.2%
Applied egg-rr83.2%
+-commutative83.2%
Simplified83.2%
if 2.0000000000000001e-133 < (/.f64 #s(literal 1 binary64) n) Initial program 35.8%
Taylor expanded in n around inf 19.8%
log1p-define19.8%
Simplified19.8%
Taylor expanded in x around inf 43.6%
*-commutative43.6%
Simplified43.6%
log1p-expm1-u59.7%
associate-/r*60.5%
Applied egg-rr60.5%
Final simplification81.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (+ -0.3333333333333333 (/ 0.25 x)) x)))
(if (<= (/ 1.0 n) -200000000.0)
(/ (/ 0.25 n) (pow x 4.0))
(if (<= (/ 1.0 n) 5e-264)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 5e-180)
(* (log x) (/ -1.0 n))
(if (<= (/ 1.0 n) 2e-17)
(/ (/ (+ 1.0 (/ (- (* 0.3333333333333333 (/ 1.0 x)) 0.5) x)) x) n)
(if (<= (/ 1.0 n) 8e+142)
(- 1.0 (pow x (/ 1.0 n)))
(/
1.0
(/
x
(/
(+ n (/ x (/ (- 0.5 t_0) n)))
(/ (* n x) (/ (+ -0.5 t_0) n))))))))))))
double code(double x, double n) {
double t_0 = (-0.3333333333333333 + (0.25 / x)) / x;
double tmp;
if ((1.0 / n) <= -200000000.0) {
tmp = (0.25 / n) / pow(x, 4.0);
} else if ((1.0 / n) <= 5e-264) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 5e-180) {
tmp = log(x) * (-1.0 / n);
} else if ((1.0 / n) <= 2e-17) {
tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
} else if ((1.0 / n) <= 8e+142) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = 1.0 / (x / ((n + (x / ((0.5 - t_0) / n))) / ((n * x) / ((-0.5 + t_0) / n))));
}
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 = ((-0.3333333333333333d0) + (0.25d0 / x)) / x
if ((1.0d0 / n) <= (-200000000.0d0)) then
tmp = (0.25d0 / n) / (x ** 4.0d0)
else if ((1.0d0 / n) <= 5d-264) then
tmp = (1.0d0 / x) / n
else if ((1.0d0 / n) <= 5d-180) then
tmp = log(x) * ((-1.0d0) / n)
else if ((1.0d0 / n) <= 2d-17) then
tmp = ((1.0d0 + (((0.3333333333333333d0 * (1.0d0 / x)) - 0.5d0) / x)) / x) / n
else if ((1.0d0 / n) <= 8d+142) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = 1.0d0 / (x / ((n + (x / ((0.5d0 - t_0) / n))) / ((n * x) / (((-0.5d0) + t_0) / n))))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = (-0.3333333333333333 + (0.25 / x)) / x;
double tmp;
if ((1.0 / n) <= -200000000.0) {
tmp = (0.25 / n) / Math.pow(x, 4.0);
} else if ((1.0 / n) <= 5e-264) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 5e-180) {
tmp = Math.log(x) * (-1.0 / n);
} else if ((1.0 / n) <= 2e-17) {
tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
} else if ((1.0 / n) <= 8e+142) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = 1.0 / (x / ((n + (x / ((0.5 - t_0) / n))) / ((n * x) / ((-0.5 + t_0) / n))));
}
return tmp;
}
def code(x, n): t_0 = (-0.3333333333333333 + (0.25 / x)) / x tmp = 0 if (1.0 / n) <= -200000000.0: tmp = (0.25 / n) / math.pow(x, 4.0) elif (1.0 / n) <= 5e-264: tmp = (1.0 / x) / n elif (1.0 / n) <= 5e-180: tmp = math.log(x) * (-1.0 / n) elif (1.0 / n) <= 2e-17: tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n elif (1.0 / n) <= 8e+142: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = 1.0 / (x / ((n + (x / ((0.5 - t_0) / n))) / ((n * x) / ((-0.5 + t_0) / n)))) return tmp
function code(x, n) t_0 = Float64(Float64(-0.3333333333333333 + Float64(0.25 / x)) / x) tmp = 0.0 if (Float64(1.0 / n) <= -200000000.0) tmp = Float64(Float64(0.25 / n) / (x ^ 4.0)); elseif (Float64(1.0 / n) <= 5e-264) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 5e-180) tmp = Float64(log(x) * Float64(-1.0 / n)); elseif (Float64(1.0 / n) <= 2e-17) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(0.3333333333333333 * Float64(1.0 / x)) - 0.5) / x)) / x) / n); elseif (Float64(1.0 / n) <= 8e+142) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(1.0 / Float64(x / Float64(Float64(n + Float64(x / Float64(Float64(0.5 - t_0) / n))) / Float64(Float64(n * x) / Float64(Float64(-0.5 + t_0) / n))))); end return tmp end
function tmp_2 = code(x, n) t_0 = (-0.3333333333333333 + (0.25 / x)) / x; tmp = 0.0; if ((1.0 / n) <= -200000000.0) tmp = (0.25 / n) / (x ^ 4.0); elseif ((1.0 / n) <= 5e-264) tmp = (1.0 / x) / n; elseif ((1.0 / n) <= 5e-180) tmp = log(x) * (-1.0 / n); elseif ((1.0 / n) <= 2e-17) tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n; elseif ((1.0 / n) <= 8e+142) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = 1.0 / (x / ((n + (x / ((0.5 - t_0) / n))) / ((n * x) / ((-0.5 + t_0) / n)))); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(-0.3333333333333333 + N[(0.25 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -200000000.0], N[(N[(0.25 / n), $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-264], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-180], N[(N[Log[x], $MachinePrecision] * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-17], N[(N[(N[(1.0 + N[(N[(N[(0.3333333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 8e+142], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(x / N[(N[(n + N[(x / N[(N[(0.5 - t$95$0), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(n * x), $MachinePrecision] / N[(N[(-0.5 + t$95$0), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-0.3333333333333333 + \frac{0.25}{x}}{x}\\
\mathbf{if}\;\frac{1}{n} \leq -200000000:\\
\;\;\;\;\frac{\frac{0.25}{n}}{{x}^{4}}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-264}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-180}:\\
\;\;\;\;\log x \cdot \frac{-1}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-17}:\\
\;\;\;\;\frac{\frac{1 + \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x}}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 8 \cdot 10^{+142}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x}{\frac{n + \frac{x}{\frac{0.5 - t\_0}{n}}}{\frac{n \cdot x}{\frac{-0.5 + t\_0}{n}}}}}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2e8Initial program 100.0%
Taylor expanded in n around inf 53.4%
log1p-define53.4%
Simplified53.4%
Taylor expanded in x around -inf 1.8%
associate-*r/1.8%
Simplified1.8%
clear-num1.8%
inv-pow1.8%
Applied egg-rr43.0%
unpow-143.0%
sub-neg43.0%
*-lft-identity43.0%
*-lft-identity43.0%
associate-/l/43.0%
sub-neg43.0%
metadata-eval43.0%
distribute-neg-frac43.0%
metadata-eval43.0%
Simplified43.0%
Taylor expanded in x around 0 82.1%
associate-/r*82.1%
Simplified82.1%
if -2e8 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000001e-264Initial program 37.6%
Taylor expanded in n around inf 73.6%
log1p-define73.6%
Simplified73.6%
Taylor expanded in x around inf 58.8%
if 5.0000000000000001e-264 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000001e-180Initial program 35.0%
Taylor expanded in n around inf 99.5%
log1p-define99.5%
Simplified99.5%
div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 70.9%
neg-mul-170.9%
Simplified70.9%
if 5.0000000000000001e-180 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000014e-17Initial program 25.9%
Taylor expanded in n around inf 61.5%
log1p-define61.5%
Simplified61.5%
Taylor expanded in x around -inf 65.6%
if 2.00000000000000014e-17 < (/.f64 #s(literal 1 binary64) n) < 8.00000000000000041e142Initial program 75.2%
Taylor expanded in x around 0 68.9%
*-rgt-identity68.9%
associate-*l/68.9%
associate-/l*68.9%
exp-to-pow68.9%
Simplified68.9%
if 8.00000000000000041e142 < (/.f64 #s(literal 1 binary64) n) Initial program 29.1%
Taylor expanded in n around inf 5.9%
log1p-define5.9%
Simplified5.9%
Taylor expanded in x around -inf 0.2%
associate-*r/0.2%
Simplified0.2%
clear-num0.2%
inv-pow0.2%
Applied egg-rr69.0%
unpow-169.0%
sub-neg69.0%
*-lft-identity69.0%
*-lft-identity69.0%
associate-/l/69.0%
sub-neg69.0%
metadata-eval69.0%
distribute-neg-frac69.0%
metadata-eval69.0%
Simplified69.0%
clear-num69.0%
frac-add72.3%
*-un-lft-identity72.3%
associate-/r*72.3%
sub-div72.3%
associate-/r*72.3%
sub-div72.3%
Applied egg-rr72.3%
Simplified72.3%
Final simplification69.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (+ -0.3333333333333333 (/ 0.25 x)) x)))
(if (<= (/ 1.0 n) -1e-5)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-133)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 2e-7)
(/ (/ (+ 1.0 (/ (log x) n)) x) n)
(if (<= (/ 1.0 n) 8e+142)
(- (+ 1.0 (/ x n)) t_0)
(/
1.0
(/
x
(/
(+ n (/ x (/ (- 0.5 t_1) n)))
(/ (* n x) (/ (+ -0.5 t_1) n)))))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = (-0.3333333333333333 + (0.25 / x)) / x;
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-133) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e-7) {
tmp = ((1.0 + (log(x) / n)) / x) / n;
} else if ((1.0 / n) <= 8e+142) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (x / ((n + (x / ((0.5 - t_1) / n))) / ((n * x) / ((-0.5 + t_1) / n))));
}
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 = x ** (1.0d0 / n)
t_1 = ((-0.3333333333333333d0) + (0.25d0 / x)) / x
if ((1.0d0 / n) <= (-1d-5)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 2d-133) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 2d-7) then
tmp = ((1.0d0 + (log(x) / n)) / x) / n
else if ((1.0d0 / n) <= 8d+142) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = 1.0d0 / (x / ((n + (x / ((0.5d0 - t_1) / n))) / ((n * x) / (((-0.5d0) + t_1) / n))))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = (-0.3333333333333333 + (0.25 / x)) / x;
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-133) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e-7) {
tmp = ((1.0 + (Math.log(x) / n)) / x) / n;
} else if ((1.0 / n) <= 8e+142) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (x / ((n + (x / ((0.5 - t_1) / n))) / ((n * x) / ((-0.5 + t_1) / n))));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = (-0.3333333333333333 + (0.25 / x)) / x tmp = 0 if (1.0 / n) <= -1e-5: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-133: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 2e-7: tmp = ((1.0 + (math.log(x) / n)) / x) / n elif (1.0 / n) <= 8e+142: tmp = (1.0 + (x / n)) - t_0 else: tmp = 1.0 / (x / ((n + (x / ((0.5 - t_1) / n))) / ((n * x) / ((-0.5 + t_1) / n)))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(-0.3333333333333333 + Float64(0.25 / x)) / x) tmp = 0.0 if (Float64(1.0 / n) <= -1e-5) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-133) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 2e-7) tmp = Float64(Float64(Float64(1.0 + Float64(log(x) / n)) / x) / n); elseif (Float64(1.0 / n) <= 8e+142) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(1.0 / Float64(x / Float64(Float64(n + Float64(x / Float64(Float64(0.5 - t_1) / n))) / Float64(Float64(n * x) / Float64(Float64(-0.5 + t_1) / n))))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = (-0.3333333333333333 + (0.25 / x)) / x; tmp = 0.0; if ((1.0 / n) <= -1e-5) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 2e-133) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 2e-7) tmp = ((1.0 + (log(x) / n)) / x) / n; elseif ((1.0 / n) <= 8e+142) tmp = (1.0 + (x / n)) - t_0; else tmp = 1.0 / (x / ((n + (x / ((0.5 - t_1) / n))) / ((n * x) / ((-0.5 + t_1) / n)))); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(-0.3333333333333333 + N[(0.25 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-5], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-133], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-7], N[(N[(N[(1.0 + N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 8e+142], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 / N[(x / N[(N[(n + N[(x / N[(N[(0.5 - t$95$1), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(n * x), $MachinePrecision] / N[(N[(-0.5 + t$95$1), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{-0.3333333333333333 + \frac{0.25}{x}}{x}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-5}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-133}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{\frac{1 + \frac{\log x}{n}}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 8 \cdot 10^{+142}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x}{\frac{n + \frac{x}{\frac{0.5 - t\_1}{n}}}{\frac{n \cdot x}{\frac{-0.5 + t\_1}{n}}}}}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000008e-5Initial program 96.1%
Taylor expanded in x around inf 99.9%
log-rec99.9%
mul-1-neg99.9%
neg-mul-199.9%
mul-1-neg99.9%
distribute-frac-neg99.9%
remove-double-neg99.9%
*-rgt-identity99.9%
associate-/l*99.9%
exp-to-pow99.9%
*-commutative99.9%
Simplified99.9%
if -1.00000000000000008e-5 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-133Initial program 38.7%
Taylor expanded in n around inf 83.2%
log1p-define83.2%
Simplified83.2%
log1p-undefine83.2%
diff-log83.2%
Applied egg-rr83.2%
+-commutative83.2%
Simplified83.2%
if 2.0000000000000001e-133 < (/.f64 #s(literal 1 binary64) n) < 1.9999999999999999e-7Initial program 16.3%
Taylor expanded in n around inf 44.9%
associate--l+44.9%
log1p-define44.9%
+-commutative44.9%
associate--r+44.9%
distribute-lft-out--44.9%
div-sub44.9%
log1p-define44.9%
Simplified44.9%
Taylor expanded in x around inf 68.2%
+-commutative68.2%
mul-1-neg68.2%
log-rec68.2%
distribute-neg-frac68.2%
remove-double-neg68.2%
Simplified68.2%
if 1.9999999999999999e-7 < (/.f64 #s(literal 1 binary64) n) < 8.00000000000000041e142Initial program 80.6%
Taylor expanded in x around 0 74.3%
if 8.00000000000000041e142 < (/.f64 #s(literal 1 binary64) n) Initial program 29.1%
Taylor expanded in n around inf 5.9%
log1p-define5.9%
Simplified5.9%
Taylor expanded in x around -inf 0.2%
associate-*r/0.2%
Simplified0.2%
clear-num0.2%
inv-pow0.2%
Applied egg-rr69.0%
unpow-169.0%
sub-neg69.0%
*-lft-identity69.0%
*-lft-identity69.0%
associate-/l/69.0%
sub-neg69.0%
metadata-eval69.0%
distribute-neg-frac69.0%
metadata-eval69.0%
Simplified69.0%
clear-num69.0%
frac-add72.3%
*-un-lft-identity72.3%
associate-/r*72.3%
sub-div72.3%
associate-/r*72.3%
sub-div72.3%
Applied egg-rr72.3%
Simplified72.3%
Final simplification84.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (+ -0.3333333333333333 (/ 0.25 x)) x)) (t_1 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-5)
(/ t_1 (* n x))
(if (<= (/ 1.0 n) 2e-133)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 2e-7)
(/ (/ (+ 1.0 (/ (log x) n)) x) n)
(if (<= (/ 1.0 n) 8e+142)
(- 1.0 t_1)
(/
1.0
(/
x
(/
(+ n (/ x (/ (- 0.5 t_0) n)))
(/ (* n x) (/ (+ -0.5 t_0) n)))))))))))
double code(double x, double n) {
double t_0 = (-0.3333333333333333 + (0.25 / x)) / x;
double t_1 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= 2e-133) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e-7) {
tmp = ((1.0 + (log(x) / n)) / x) / n;
} else if ((1.0 / n) <= 8e+142) {
tmp = 1.0 - t_1;
} else {
tmp = 1.0 / (x / ((n + (x / ((0.5 - t_0) / n))) / ((n * x) / ((-0.5 + t_0) / n))));
}
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 = ((-0.3333333333333333d0) + (0.25d0 / x)) / x
t_1 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1d-5)) then
tmp = t_1 / (n * x)
else if ((1.0d0 / n) <= 2d-133) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 2d-7) then
tmp = ((1.0d0 + (log(x) / n)) / x) / n
else if ((1.0d0 / n) <= 8d+142) then
tmp = 1.0d0 - t_1
else
tmp = 1.0d0 / (x / ((n + (x / ((0.5d0 - t_0) / n))) / ((n * x) / (((-0.5d0) + t_0) / n))))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = (-0.3333333333333333 + (0.25 / x)) / x;
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= 2e-133) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e-7) {
tmp = ((1.0 + (Math.log(x) / n)) / x) / n;
} else if ((1.0 / n) <= 8e+142) {
tmp = 1.0 - t_1;
} else {
tmp = 1.0 / (x / ((n + (x / ((0.5 - t_0) / n))) / ((n * x) / ((-0.5 + t_0) / n))));
}
return tmp;
}
def code(x, n): t_0 = (-0.3333333333333333 + (0.25 / x)) / x t_1 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-5: tmp = t_1 / (n * x) elif (1.0 / n) <= 2e-133: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 2e-7: tmp = ((1.0 + (math.log(x) / n)) / x) / n elif (1.0 / n) <= 8e+142: tmp = 1.0 - t_1 else: tmp = 1.0 / (x / ((n + (x / ((0.5 - t_0) / n))) / ((n * x) / ((-0.5 + t_0) / n)))) return tmp
function code(x, n) t_0 = Float64(Float64(-0.3333333333333333 + Float64(0.25 / x)) / x) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-5) tmp = Float64(t_1 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-133) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 2e-7) tmp = Float64(Float64(Float64(1.0 + Float64(log(x) / n)) / x) / n); elseif (Float64(1.0 / n) <= 8e+142) tmp = Float64(1.0 - t_1); else tmp = Float64(1.0 / Float64(x / Float64(Float64(n + Float64(x / Float64(Float64(0.5 - t_0) / n))) / Float64(Float64(n * x) / Float64(Float64(-0.5 + t_0) / n))))); end return tmp end
function tmp_2 = code(x, n) t_0 = (-0.3333333333333333 + (0.25 / x)) / x; t_1 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-5) tmp = t_1 / (n * x); elseif ((1.0 / n) <= 2e-133) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 2e-7) tmp = ((1.0 + (log(x) / n)) / x) / n; elseif ((1.0 / n) <= 8e+142) tmp = 1.0 - t_1; else tmp = 1.0 / (x / ((n + (x / ((0.5 - t_0) / n))) / ((n * x) / ((-0.5 + t_0) / n)))); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(-0.3333333333333333 + N[(0.25 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-5], N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-133], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-7], N[(N[(N[(1.0 + N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 8e+142], N[(1.0 - t$95$1), $MachinePrecision], N[(1.0 / N[(x / N[(N[(n + N[(x / N[(N[(0.5 - t$95$0), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(n * x), $MachinePrecision] / N[(N[(-0.5 + t$95$0), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-0.3333333333333333 + \frac{0.25}{x}}{x}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-5}:\\
\;\;\;\;\frac{t\_1}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-133}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{\frac{1 + \frac{\log x}{n}}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 8 \cdot 10^{+142}:\\
\;\;\;\;1 - t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x}{\frac{n + \frac{x}{\frac{0.5 - t\_0}{n}}}{\frac{n \cdot x}{\frac{-0.5 + t\_0}{n}}}}}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000008e-5Initial program 96.1%
Taylor expanded in x around inf 99.9%
log-rec99.9%
mul-1-neg99.9%
neg-mul-199.9%
mul-1-neg99.9%
distribute-frac-neg99.9%
remove-double-neg99.9%
*-rgt-identity99.9%
associate-/l*99.9%
exp-to-pow99.9%
*-commutative99.9%
Simplified99.9%
if -1.00000000000000008e-5 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-133Initial program 38.7%
Taylor expanded in n around inf 83.2%
log1p-define83.2%
Simplified83.2%
log1p-undefine83.2%
diff-log83.2%
Applied egg-rr83.2%
+-commutative83.2%
Simplified83.2%
if 2.0000000000000001e-133 < (/.f64 #s(literal 1 binary64) n) < 1.9999999999999999e-7Initial program 16.3%
Taylor expanded in n around inf 44.9%
associate--l+44.9%
log1p-define44.9%
+-commutative44.9%
associate--r+44.9%
distribute-lft-out--44.9%
div-sub44.9%
log1p-define44.9%
Simplified44.9%
Taylor expanded in x around inf 68.2%
+-commutative68.2%
mul-1-neg68.2%
log-rec68.2%
distribute-neg-frac68.2%
remove-double-neg68.2%
Simplified68.2%
if 1.9999999999999999e-7 < (/.f64 #s(literal 1 binary64) n) < 8.00000000000000041e142Initial program 80.6%
Taylor expanded in x around 0 74.2%
*-rgt-identity74.2%
associate-*l/74.2%
associate-/l*74.2%
exp-to-pow74.2%
Simplified74.2%
if 8.00000000000000041e142 < (/.f64 #s(literal 1 binary64) n) Initial program 29.1%
Taylor expanded in n around inf 5.9%
log1p-define5.9%
Simplified5.9%
Taylor expanded in x around -inf 0.2%
associate-*r/0.2%
Simplified0.2%
clear-num0.2%
inv-pow0.2%
Applied egg-rr69.0%
unpow-169.0%
sub-neg69.0%
*-lft-identity69.0%
*-lft-identity69.0%
associate-/l/69.0%
sub-neg69.0%
metadata-eval69.0%
distribute-neg-frac69.0%
metadata-eval69.0%
Simplified69.0%
clear-num69.0%
frac-add72.3%
*-un-lft-identity72.3%
associate-/r*72.3%
sub-div72.3%
associate-/r*72.3%
sub-div72.3%
Applied egg-rr72.3%
Simplified72.3%
Final simplification84.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (+ -0.3333333333333333 (/ 0.25 x)) x)) (t_1 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-5)
(/ t_1 (* n x))
(if (<= (/ 1.0 n) 2e-133)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 2e-17)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 8e+142)
(- 1.0 t_1)
(/
1.0
(/
x
(/
(+ n (/ x (/ (- 0.5 t_0) n)))
(/ (* n x) (/ (+ -0.5 t_0) n)))))))))))
double code(double x, double n) {
double t_0 = (-0.3333333333333333 + (0.25 / x)) / x;
double t_1 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= 2e-133) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 8e+142) {
tmp = 1.0 - t_1;
} else {
tmp = 1.0 / (x / ((n + (x / ((0.5 - t_0) / n))) / ((n * x) / ((-0.5 + t_0) / n))));
}
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 = ((-0.3333333333333333d0) + (0.25d0 / x)) / x
t_1 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1d-5)) then
tmp = t_1 / (n * x)
else if ((1.0d0 / n) <= 2d-133) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 2d-17) then
tmp = (1.0d0 / x) / n
else if ((1.0d0 / n) <= 8d+142) then
tmp = 1.0d0 - t_1
else
tmp = 1.0d0 / (x / ((n + (x / ((0.5d0 - t_0) / n))) / ((n * x) / (((-0.5d0) + t_0) / n))))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = (-0.3333333333333333 + (0.25 / x)) / x;
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= 2e-133) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 8e+142) {
tmp = 1.0 - t_1;
} else {
tmp = 1.0 / (x / ((n + (x / ((0.5 - t_0) / n))) / ((n * x) / ((-0.5 + t_0) / n))));
}
return tmp;
}
def code(x, n): t_0 = (-0.3333333333333333 + (0.25 / x)) / x t_1 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-5: tmp = t_1 / (n * x) elif (1.0 / n) <= 2e-133: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 2e-17: tmp = (1.0 / x) / n elif (1.0 / n) <= 8e+142: tmp = 1.0 - t_1 else: tmp = 1.0 / (x / ((n + (x / ((0.5 - t_0) / n))) / ((n * x) / ((-0.5 + t_0) / n)))) return tmp
function code(x, n) t_0 = Float64(Float64(-0.3333333333333333 + Float64(0.25 / x)) / x) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-5) tmp = Float64(t_1 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-133) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 2e-17) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 8e+142) tmp = Float64(1.0 - t_1); else tmp = Float64(1.0 / Float64(x / Float64(Float64(n + Float64(x / Float64(Float64(0.5 - t_0) / n))) / Float64(Float64(n * x) / Float64(Float64(-0.5 + t_0) / n))))); end return tmp end
function tmp_2 = code(x, n) t_0 = (-0.3333333333333333 + (0.25 / x)) / x; t_1 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-5) tmp = t_1 / (n * x); elseif ((1.0 / n) <= 2e-133) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 2e-17) tmp = (1.0 / x) / n; elseif ((1.0 / n) <= 8e+142) tmp = 1.0 - t_1; else tmp = 1.0 / (x / ((n + (x / ((0.5 - t_0) / n))) / ((n * x) / ((-0.5 + t_0) / n)))); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(-0.3333333333333333 + N[(0.25 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-5], N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-133], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-17], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 8e+142], N[(1.0 - t$95$1), $MachinePrecision], N[(1.0 / N[(x / N[(N[(n + N[(x / N[(N[(0.5 - t$95$0), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(n * x), $MachinePrecision] / N[(N[(-0.5 + t$95$0), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-0.3333333333333333 + \frac{0.25}{x}}{x}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-5}:\\
\;\;\;\;\frac{t\_1}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-133}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-17}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 8 \cdot 10^{+142}:\\
\;\;\;\;1 - t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x}{\frac{n + \frac{x}{\frac{0.5 - t\_0}{n}}}{\frac{n \cdot x}{\frac{-0.5 + t\_0}{n}}}}}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000008e-5Initial program 96.1%
Taylor expanded in x around inf 99.9%
log-rec99.9%
mul-1-neg99.9%
neg-mul-199.9%
mul-1-neg99.9%
distribute-frac-neg99.9%
remove-double-neg99.9%
*-rgt-identity99.9%
associate-/l*99.9%
exp-to-pow99.9%
*-commutative99.9%
Simplified99.9%
if -1.00000000000000008e-5 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-133Initial program 38.7%
Taylor expanded in n around inf 83.2%
log1p-define83.2%
Simplified83.2%
log1p-undefine83.2%
diff-log83.2%
Applied egg-rr83.2%
+-commutative83.2%
Simplified83.2%
if 2.0000000000000001e-133 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000014e-17Initial program 14.7%
Taylor expanded in n around inf 43.9%
log1p-define43.9%
Simplified43.9%
Taylor expanded in x around inf 70.8%
if 2.00000000000000014e-17 < (/.f64 #s(literal 1 binary64) n) < 8.00000000000000041e142Initial program 75.2%
Taylor expanded in x around 0 68.9%
*-rgt-identity68.9%
associate-*l/68.9%
associate-/l*68.9%
exp-to-pow68.9%
Simplified68.9%
if 8.00000000000000041e142 < (/.f64 #s(literal 1 binary64) n) Initial program 29.1%
Taylor expanded in n around inf 5.9%
log1p-define5.9%
Simplified5.9%
Taylor expanded in x around -inf 0.2%
associate-*r/0.2%
Simplified0.2%
clear-num0.2%
inv-pow0.2%
Applied egg-rr69.0%
unpow-169.0%
sub-neg69.0%
*-lft-identity69.0%
*-lft-identity69.0%
associate-/l/69.0%
sub-neg69.0%
metadata-eval69.0%
distribute-neg-frac69.0%
metadata-eval69.0%
Simplified69.0%
clear-num69.0%
frac-add72.3%
*-un-lft-identity72.3%
associate-/r*72.3%
sub-div72.3%
associate-/r*72.3%
sub-div72.3%
Applied egg-rr72.3%
Simplified72.3%
Final simplification84.7%
(FPCore (x n)
:precision binary64
(if (<= x 3.5e-88)
(/ (log x) (- n))
(if (<= x 7.8e+119)
(*
(/ 1.0 x)
(-
(/ 1.0 n)
(/ (/ (- 0.5 (/ (+ -0.3333333333333333 (/ 0.25 x)) x)) n) x)))
(/ -0.25 (* n (pow x 4.0))))))
double code(double x, double n) {
double tmp;
if (x <= 3.5e-88) {
tmp = log(x) / -n;
} else if (x <= 7.8e+119) {
tmp = (1.0 / x) * ((1.0 / n) - (((0.5 - ((-0.3333333333333333 + (0.25 / x)) / x)) / n) / x));
} else {
tmp = -0.25 / (n * pow(x, 4.0));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 3.5d-88) then
tmp = log(x) / -n
else if (x <= 7.8d+119) then
tmp = (1.0d0 / x) * ((1.0d0 / n) - (((0.5d0 - (((-0.3333333333333333d0) + (0.25d0 / x)) / x)) / n) / x))
else
tmp = (-0.25d0) / (n * (x ** 4.0d0))
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 3.5e-88) {
tmp = Math.log(x) / -n;
} else if (x <= 7.8e+119) {
tmp = (1.0 / x) * ((1.0 / n) - (((0.5 - ((-0.3333333333333333 + (0.25 / x)) / x)) / n) / x));
} else {
tmp = -0.25 / (n * Math.pow(x, 4.0));
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 3.5e-88: tmp = math.log(x) / -n elif x <= 7.8e+119: tmp = (1.0 / x) * ((1.0 / n) - (((0.5 - ((-0.3333333333333333 + (0.25 / x)) / x)) / n) / x)) else: tmp = -0.25 / (n * math.pow(x, 4.0)) return tmp
function code(x, n) tmp = 0.0 if (x <= 3.5e-88) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 7.8e+119) tmp = Float64(Float64(1.0 / x) * Float64(Float64(1.0 / n) - Float64(Float64(Float64(0.5 - Float64(Float64(-0.3333333333333333 + Float64(0.25 / x)) / x)) / n) / x))); else tmp = Float64(-0.25 / Float64(n * (x ^ 4.0))); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 3.5e-88) tmp = log(x) / -n; elseif (x <= 7.8e+119) tmp = (1.0 / x) * ((1.0 / n) - (((0.5 - ((-0.3333333333333333 + (0.25 / x)) / x)) / n) / x)); else tmp = -0.25 / (n * (x ^ 4.0)); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 3.5e-88], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 7.8e+119], N[(N[(1.0 / x), $MachinePrecision] * N[(N[(1.0 / n), $MachinePrecision] - N[(N[(N[(0.5 - N[(N[(-0.3333333333333333 + N[(0.25 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.25 / N[(n * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.5 \cdot 10^{-88}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 7.8 \cdot 10^{+119}:\\
\;\;\;\;\frac{1}{x} \cdot \left(\frac{1}{n} - \frac{\frac{0.5 - \frac{-0.3333333333333333 + \frac{0.25}{x}}{x}}{n}}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.25}{n \cdot {x}^{4}}\\
\end{array}
\end{array}
if x < 3.5000000000000001e-88Initial program 42.2%
Taylor expanded in n around inf 51.5%
log1p-define51.5%
Simplified51.5%
Taylor expanded in x around 0 51.5%
neg-mul-151.5%
Simplified51.5%
if 3.5000000000000001e-88 < x < 7.7999999999999997e119Initial program 43.8%
Taylor expanded in n around inf 42.8%
log1p-define42.8%
Simplified42.8%
Taylor expanded in x around -inf 35.7%
associate-*r/35.7%
Simplified35.7%
clear-num34.7%
inv-pow34.7%
Applied egg-rr29.9%
unpow-129.9%
sub-neg29.9%
*-lft-identity29.9%
*-lft-identity29.9%
associate-/l/29.9%
sub-neg29.9%
metadata-eval29.9%
distribute-neg-frac29.9%
metadata-eval29.9%
Simplified29.9%
associate-/r/29.8%
+-commutative29.8%
add-sqr-sqrt12.4%
sqrt-unprod36.4%
frac-times36.3%
metadata-eval36.3%
metadata-eval36.3%
frac-times36.4%
sqrt-unprod31.9%
add-sqr-sqrt56.3%
associate-/r*56.3%
sub-div56.3%
Applied egg-rr56.3%
if 7.7999999999999997e119 < x Initial program 81.0%
Taylor expanded in n around inf 81.0%
log1p-define81.0%
Simplified81.0%
Taylor expanded in x around -inf 67.1%
associate-*r/67.1%
Simplified67.1%
Taylor expanded in x around 0 81.0%
Final simplification61.6%
(FPCore (x n)
:precision binary64
(if (<= x 3.95e-88)
(/ (log x) (- n))
(*
(/ 1.0 x)
(-
(/ 1.0 n)
(/ (/ (- 0.5 (/ (+ -0.3333333333333333 (/ 0.25 x)) x)) n) x)))))
double code(double x, double n) {
double tmp;
if (x <= 3.95e-88) {
tmp = log(x) / -n;
} else {
tmp = (1.0 / x) * ((1.0 / n) - (((0.5 - ((-0.3333333333333333 + (0.25 / x)) / x)) / n) / x));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 3.95d-88) then
tmp = log(x) / -n
else
tmp = (1.0d0 / x) * ((1.0d0 / n) - (((0.5d0 - (((-0.3333333333333333d0) + (0.25d0 / x)) / x)) / n) / x))
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 3.95e-88) {
tmp = Math.log(x) / -n;
} else {
tmp = (1.0 / x) * ((1.0 / n) - (((0.5 - ((-0.3333333333333333 + (0.25 / x)) / x)) / n) / x));
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 3.95e-88: tmp = math.log(x) / -n else: tmp = (1.0 / x) * ((1.0 / n) - (((0.5 - ((-0.3333333333333333 + (0.25 / x)) / x)) / n) / x)) return tmp
function code(x, n) tmp = 0.0 if (x <= 3.95e-88) tmp = Float64(log(x) / Float64(-n)); else tmp = Float64(Float64(1.0 / x) * Float64(Float64(1.0 / n) - Float64(Float64(Float64(0.5 - Float64(Float64(-0.3333333333333333 + Float64(0.25 / x)) / x)) / n) / x))); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 3.95e-88) tmp = log(x) / -n; else tmp = (1.0 / x) * ((1.0 / n) - (((0.5 - ((-0.3333333333333333 + (0.25 / x)) / x)) / n) / x)); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 3.95e-88], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] * N[(N[(1.0 / n), $MachinePrecision] - N[(N[(N[(0.5 - N[(N[(-0.3333333333333333 + N[(0.25 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.95 \cdot 10^{-88}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x} \cdot \left(\frac{1}{n} - \frac{\frac{0.5 - \frac{-0.3333333333333333 + \frac{0.25}{x}}{x}}{n}}{x}\right)\\
\end{array}
\end{array}
if x < 3.94999999999999983e-88Initial program 42.2%
Taylor expanded in n around inf 51.5%
log1p-define51.5%
Simplified51.5%
Taylor expanded in x around 0 51.5%
neg-mul-151.5%
Simplified51.5%
if 3.94999999999999983e-88 < x Initial program 61.8%
Taylor expanded in n around inf 61.3%
log1p-define61.3%
Simplified61.3%
Taylor expanded in x around -inf 50.9%
associate-*r/50.9%
Simplified50.9%
clear-num48.9%
inv-pow48.9%
Applied egg-rr40.2%
unpow-140.2%
sub-neg40.2%
*-lft-identity40.2%
*-lft-identity40.2%
associate-/l/40.2%
sub-neg40.2%
metadata-eval40.2%
distribute-neg-frac40.2%
metadata-eval40.2%
Simplified40.2%
associate-/r/40.1%
+-commutative40.1%
add-sqr-sqrt18.5%
sqrt-unprod45.9%
frac-times45.9%
metadata-eval45.9%
metadata-eval45.9%
frac-times45.9%
sqrt-unprod31.5%
add-sqr-sqrt61.5%
associate-/r*61.5%
sub-div61.5%
Applied egg-rr61.5%
Final simplification57.6%
(FPCore (x n) :precision binary64 (* (/ 1.0 x) (- (/ 1.0 n) (/ (/ (- 0.5 (/ (+ -0.3333333333333333 (/ 0.25 x)) x)) n) x))))
double code(double x, double n) {
return (1.0 / x) * ((1.0 / n) - (((0.5 - ((-0.3333333333333333 + (0.25 / x)) / x)) / n) / x));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / x) * ((1.0d0 / n) - (((0.5d0 - (((-0.3333333333333333d0) + (0.25d0 / x)) / x)) / n) / x))
end function
public static double code(double x, double n) {
return (1.0 / x) * ((1.0 / n) - (((0.5 - ((-0.3333333333333333 + (0.25 / x)) / x)) / n) / x));
}
def code(x, n): return (1.0 / x) * ((1.0 / n) - (((0.5 - ((-0.3333333333333333 + (0.25 / x)) / x)) / n) / x))
function code(x, n) return Float64(Float64(1.0 / x) * Float64(Float64(1.0 / n) - Float64(Float64(Float64(0.5 - Float64(Float64(-0.3333333333333333 + Float64(0.25 / x)) / x)) / n) / x))) end
function tmp = code(x, n) tmp = (1.0 / x) * ((1.0 / n) - (((0.5 - ((-0.3333333333333333 + (0.25 / x)) / x)) / n) / x)); end
code[x_, n_] := N[(N[(1.0 / x), $MachinePrecision] * N[(N[(1.0 / n), $MachinePrecision] - N[(N[(N[(0.5 - N[(N[(-0.3333333333333333 + N[(0.25 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x} \cdot \left(\frac{1}{n} - \frac{\frac{0.5 - \frac{-0.3333333333333333 + \frac{0.25}{x}}{x}}{n}}{x}\right)
\end{array}
Initial program 54.0%
Taylor expanded in n around inf 57.4%
log1p-define57.4%
Simplified57.4%
Taylor expanded in x around -inf 31.1%
associate-*r/31.1%
Simplified31.1%
clear-num29.9%
inv-pow29.9%
Applied egg-rr37.9%
unpow-137.9%
sub-neg37.9%
*-lft-identity37.9%
*-lft-identity37.9%
associate-/l/37.9%
sub-neg37.9%
metadata-eval37.9%
distribute-neg-frac37.9%
metadata-eval37.9%
Simplified37.9%
associate-/r/37.9%
+-commutative37.9%
add-sqr-sqrt20.0%
sqrt-unprod37.0%
frac-times37.0%
metadata-eval37.0%
metadata-eval37.0%
frac-times37.0%
sqrt-unprod23.8%
add-sqr-sqrt50.8%
associate-/r*50.8%
sub-div50.8%
Applied egg-rr50.8%
Final simplification50.8%
(FPCore (x n) :precision binary64 (/ (+ (/ 1.0 n) (/ (+ -0.5 (/ (+ -0.3333333333333333 (/ 0.25 x)) x)) (* n x))) x))
double code(double x, double n) {
return ((1.0 / n) + ((-0.5 + ((-0.3333333333333333 + (0.25 / x)) / x)) / (n * x))) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((1.0d0 / n) + (((-0.5d0) + (((-0.3333333333333333d0) + (0.25d0 / x)) / x)) / (n * x))) / x
end function
public static double code(double x, double n) {
return ((1.0 / n) + ((-0.5 + ((-0.3333333333333333 + (0.25 / x)) / x)) / (n * x))) / x;
}
def code(x, n): return ((1.0 / n) + ((-0.5 + ((-0.3333333333333333 + (0.25 / x)) / x)) / (n * x))) / x
function code(x, n) return Float64(Float64(Float64(1.0 / n) + Float64(Float64(-0.5 + Float64(Float64(-0.3333333333333333 + Float64(0.25 / x)) / x)) / Float64(n * x))) / x) end
function tmp = code(x, n) tmp = ((1.0 / n) + ((-0.5 + ((-0.3333333333333333 + (0.25 / x)) / x)) / (n * x))) / x; end
code[x_, n_] := N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(-0.5 + N[(N[(-0.3333333333333333 + N[(0.25 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n} + \frac{-0.5 + \frac{-0.3333333333333333 + \frac{0.25}{x}}{x}}{n \cdot x}}{x}
\end{array}
Initial program 54.0%
Taylor expanded in n around inf 57.4%
log1p-define57.4%
Simplified57.4%
Taylor expanded in x around -inf 31.1%
associate-*r/31.1%
Simplified31.1%
clear-num29.9%
inv-pow29.9%
Applied egg-rr37.9%
unpow-137.9%
sub-neg37.9%
*-lft-identity37.9%
*-lft-identity37.9%
associate-/l/37.9%
sub-neg37.9%
metadata-eval37.9%
distribute-neg-frac37.9%
metadata-eval37.9%
Simplified37.9%
*-un-lft-identity37.9%
associate-/r/37.9%
+-commutative37.9%
add-sqr-sqrt20.0%
sqrt-unprod37.0%
frac-times37.0%
metadata-eval37.0%
metadata-eval37.0%
frac-times37.0%
sqrt-unprod23.8%
add-sqr-sqrt50.8%
associate-/r*50.8%
sub-div50.8%
Applied egg-rr50.8%
*-lft-identity50.8%
associate-*l/50.8%
*-lft-identity50.8%
associate-/l/50.8%
sub-neg50.8%
metadata-eval50.8%
associate-*r/50.8%
+-commutative50.8%
associate-*r/50.8%
metadata-eval50.8%
metadata-eval50.8%
Simplified50.8%
Final simplification50.8%
(FPCore (x n) :precision binary64 (/ (- (/ 1.0 n) (/ (+ (/ 0.5 n) (/ -0.3333333333333333 (* n x))) x)) x))
double code(double x, double n) {
return ((1.0 / n) - (((0.5 / n) + (-0.3333333333333333 / (n * x))) / x)) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((1.0d0 / n) - (((0.5d0 / n) + ((-0.3333333333333333d0) / (n * x))) / x)) / x
end function
public static double code(double x, double n) {
return ((1.0 / n) - (((0.5 / n) + (-0.3333333333333333 / (n * x))) / x)) / x;
}
def code(x, n): return ((1.0 / n) - (((0.5 / n) + (-0.3333333333333333 / (n * x))) / x)) / x
function code(x, n) return Float64(Float64(Float64(1.0 / n) - Float64(Float64(Float64(0.5 / n) + Float64(-0.3333333333333333 / Float64(n * x))) / x)) / x) end
function tmp = code(x, n) tmp = ((1.0 / n) - (((0.5 / n) + (-0.3333333333333333 / (n * x))) / x)) / x; end
code[x_, n_] := N[(N[(N[(1.0 / n), $MachinePrecision] - N[(N[(N[(0.5 / n), $MachinePrecision] + N[(-0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n} - \frac{\frac{0.5}{n} + \frac{-0.3333333333333333}{n \cdot x}}{x}}{x}
\end{array}
Initial program 54.0%
Taylor expanded in n around inf 57.4%
log1p-define57.4%
Simplified57.4%
Taylor expanded in x around -inf 31.1%
associate-*r/31.1%
Simplified31.1%
Taylor expanded in x around -inf 50.3%
+-commutative50.3%
mul-1-neg50.3%
unsub-neg50.3%
sub-neg50.3%
associate-*r/50.3%
metadata-eval50.3%
associate-*r/50.3%
metadata-eval50.3%
*-commutative50.3%
distribute-neg-frac50.3%
metadata-eval50.3%
Simplified50.3%
Final simplification50.3%
(FPCore (x n) :precision binary64 (/ (/ (+ 1.0 (/ (- (* 0.3333333333333333 (/ 1.0 x)) 0.5) x)) x) n))
double code(double x, double n) {
return ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((1.0d0 + (((0.3333333333333333d0 * (1.0d0 / x)) - 0.5d0) / x)) / x) / n
end function
public static double code(double x, double n) {
return ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
}
def code(x, n): return ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n
function code(x, n) return Float64(Float64(Float64(1.0 + Float64(Float64(Float64(0.3333333333333333 * Float64(1.0 / x)) - 0.5) / x)) / x) / n) end
function tmp = code(x, n) tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n; end
code[x_, n_] := N[(N[(N[(1.0 + N[(N[(N[(0.3333333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1 + \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x}}{x}}{n}
\end{array}
Initial program 54.0%
Taylor expanded in n around inf 57.4%
log1p-define57.4%
Simplified57.4%
Taylor expanded in x around -inf 50.3%
Final simplification50.3%
(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 54.0%
Taylor expanded in n around inf 57.4%
log1p-define57.4%
Simplified57.4%
Taylor expanded in x around inf 42.9%
(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 54.0%
Taylor expanded in n around inf 57.4%
log1p-define57.4%
Simplified57.4%
Taylor expanded in x around -inf 31.1%
associate-*r/31.1%
Simplified31.1%
Taylor expanded in x around inf 42.9%
(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 54.0%
Taylor expanded in n around inf 57.4%
log1p-define57.4%
Simplified57.4%
Taylor expanded in x around inf 41.7%
*-commutative41.7%
Simplified41.7%
Final simplification41.7%
herbie shell --seed 2024191
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))