
(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 17 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) -5e-43)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 3e-54)
(/ (log (+ 1.0 (/ 1.0 x))) n)
(if (<= (/ 1.0 n) 2e-17)
(/
(+
(/ 0.3333333333333333 (pow x 3.0))
(- (/ 1.0 x) (/ 0.5 (pow x 2.0))))
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) <= -5e-43) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 3e-54) {
tmp = log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = ((0.3333333333333333 / pow(x, 3.0)) + ((1.0 / x) - (0.5 / pow(x, 2.0)))) / 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) <= -5e-43) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 3e-54) {
tmp = Math.log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = ((0.3333333333333333 / Math.pow(x, 3.0)) + ((1.0 / x) - (0.5 / Math.pow(x, 2.0)))) / 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) <= -5e-43: tmp = t_0 / (n * x) elif (1.0 / n) <= 3e-54: tmp = math.log((1.0 + (1.0 / x))) / n elif (1.0 / n) <= 2e-17: tmp = ((0.3333333333333333 / math.pow(x, 3.0)) + ((1.0 / x) - (0.5 / math.pow(x, 2.0)))) / 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) <= -5e-43) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 3e-54) tmp = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n); elseif (Float64(1.0 / n) <= 2e-17) tmp = Float64(Float64(Float64(0.3333333333333333 / (x ^ 3.0)) + Float64(Float64(1.0 / x) - Float64(0.5 / (x ^ 2.0)))) / 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], -5e-43], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 3e-54], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-17], N[(N[(N[(0.3333333333333333 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $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 -5 \cdot 10^{-43}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 3 \cdot 10^{-54}:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-17}:\\
\;\;\;\;\frac{\frac{0.3333333333333333}{{x}^{3}} + \left(\frac{1}{x} - \frac{0.5}{{x}^{2}}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000019e-43Initial program 89.2%
Taylor expanded in x around inf 95.1%
log-rec95.1%
mul-1-neg95.1%
associate-*r/95.1%
associate-*r*95.1%
metadata-eval95.1%
*-commutative95.1%
associate-/l*95.1%
exp-to-pow95.1%
*-commutative95.1%
Simplified95.1%
if -5.00000000000000019e-43 < (/.f64 1 n) < 3.00000000000000009e-54Initial program 33.9%
Taylor expanded in n around inf 85.7%
+-rgt-identity85.7%
+-rgt-identity85.7%
log1p-define85.7%
Simplified85.7%
log1p-undefine85.7%
diff-log85.7%
Applied egg-rr85.7%
Taylor expanded in x around 0 85.7%
if 3.00000000000000009e-54 < (/.f64 1 n) < 2.00000000000000014e-17Initial program 16.6%
Taylor expanded in n around inf 46.3%
+-rgt-identity46.3%
+-rgt-identity46.3%
log1p-define46.3%
Simplified46.3%
Taylor expanded in x around inf 74.5%
associate--l+74.5%
associate-*r/74.5%
metadata-eval74.5%
associate-*r/74.5%
metadata-eval74.5%
Simplified74.5%
if 2.00000000000000014e-17 < (/.f64 1 n) Initial program 53.9%
Taylor expanded in n around 0 53.9%
log1p-define92.8%
*-rgt-identity92.8%
associate-/l*92.8%
exp-to-pow92.8%
Simplified92.8%
Final simplification88.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-43)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 3e-54)
(/ (log (+ 1.0 (/ 1.0 x))) n)
(if (<= (/ 1.0 n) 2e-17)
(/
(+
(/ 0.3333333333333333 (pow x 3.0))
(- (/ 1.0 x) (/ 0.5 (pow x 2.0))))
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) <= -5e-43) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 3e-54) {
tmp = log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = ((0.3333333333333333 / pow(x, 3.0)) + ((1.0 / x) - (0.5 / pow(x, 2.0)))) / 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) <= (-5d-43)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 3d-54) then
tmp = log((1.0d0 + (1.0d0 / x))) / n
else if ((1.0d0 / n) <= 2d-17) then
tmp = ((0.3333333333333333d0 / (x ** 3.0d0)) + ((1.0d0 / x) - (0.5d0 / (x ** 2.0d0)))) / 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) <= -5e-43) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 3e-54) {
tmp = Math.log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = ((0.3333333333333333 / Math.pow(x, 3.0)) + ((1.0 / x) - (0.5 / Math.pow(x, 2.0)))) / 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) <= -5e-43: tmp = t_0 / (n * x) elif (1.0 / n) <= 3e-54: tmp = math.log((1.0 + (1.0 / x))) / n elif (1.0 / n) <= 2e-17: tmp = ((0.3333333333333333 / math.pow(x, 3.0)) + ((1.0 / x) - (0.5 / math.pow(x, 2.0)))) / 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) <= -5e-43) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 3e-54) tmp = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n); elseif (Float64(1.0 / n) <= 2e-17) tmp = Float64(Float64(Float64(0.3333333333333333 / (x ^ 3.0)) + Float64(Float64(1.0 / x) - Float64(0.5 / (x ^ 2.0)))) / 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) <= -5e-43) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 3e-54) tmp = log((1.0 + (1.0 / x))) / n; elseif ((1.0 / n) <= 2e-17) tmp = ((0.3333333333333333 / (x ^ 3.0)) + ((1.0 / x) - (0.5 / (x ^ 2.0)))) / 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], -5e-43], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 3e-54], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-17], N[(N[(N[(0.3333333333333333 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $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 -5 \cdot 10^{-43}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 3 \cdot 10^{-54}:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-17}:\\
\;\;\;\;\frac{\frac{0.3333333333333333}{{x}^{3}} + \left(\frac{1}{x} - \frac{0.5}{{x}^{2}}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000019e-43Initial program 89.2%
Taylor expanded in x around inf 95.1%
log-rec95.1%
mul-1-neg95.1%
associate-*r/95.1%
associate-*r*95.1%
metadata-eval95.1%
*-commutative95.1%
associate-/l*95.1%
exp-to-pow95.1%
*-commutative95.1%
Simplified95.1%
if -5.00000000000000019e-43 < (/.f64 1 n) < 3.00000000000000009e-54Initial program 33.9%
Taylor expanded in n around inf 85.7%
+-rgt-identity85.7%
+-rgt-identity85.7%
log1p-define85.7%
Simplified85.7%
log1p-undefine85.7%
diff-log85.7%
Applied egg-rr85.7%
Taylor expanded in x around 0 85.7%
if 3.00000000000000009e-54 < (/.f64 1 n) < 2.00000000000000014e-17Initial program 16.6%
Taylor expanded in n around inf 46.3%
+-rgt-identity46.3%
+-rgt-identity46.3%
log1p-define46.3%
Simplified46.3%
Taylor expanded in x around inf 74.5%
associate--l+74.5%
associate-*r/74.5%
metadata-eval74.5%
associate-*r/74.5%
metadata-eval74.5%
Simplified74.5%
if 2.00000000000000014e-17 < (/.f64 1 n) Initial program 53.9%
Taylor expanded in n around 0 53.9%
log1p-define92.8%
*-rgt-identity92.8%
associate-/l*92.8%
exp-to-pow92.8%
Simplified92.8%
Taylor expanded in x around 0 92.8%
Final simplification88.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-43)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 3e-54)
(/ (log (+ 1.0 (/ 1.0 x))) n)
(if (<= (/ 1.0 n) 2e-17)
(/ (- (/ 1.0 x) (/ 0.5 (pow x 2.0))) n)
(if (<= (/ 1.0 n) 5e+156)
(- (+ 1.0 (/ x n)) t_0)
(sqrt (pow (* n x) -2.0))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-43) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 3e-54) {
tmp = log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = ((1.0 / x) - (0.5 / pow(x, 2.0))) / n;
} else if ((1.0 / n) <= 5e+156) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = sqrt(pow((n * x), -2.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) <= (-5d-43)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 3d-54) then
tmp = log((1.0d0 + (1.0d0 / x))) / n
else if ((1.0d0 / n) <= 2d-17) then
tmp = ((1.0d0 / x) - (0.5d0 / (x ** 2.0d0))) / n
else if ((1.0d0 / n) <= 5d+156) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = sqrt(((n * x) ** (-2.0d0)))
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) <= -5e-43) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 3e-54) {
tmp = Math.log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = ((1.0 / x) - (0.5 / Math.pow(x, 2.0))) / n;
} else if ((1.0 / n) <= 5e+156) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = Math.sqrt(Math.pow((n * x), -2.0));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-43: tmp = t_0 / (n * x) elif (1.0 / n) <= 3e-54: tmp = math.log((1.0 + (1.0 / x))) / n elif (1.0 / n) <= 2e-17: tmp = ((1.0 / x) - (0.5 / math.pow(x, 2.0))) / n elif (1.0 / n) <= 5e+156: tmp = (1.0 + (x / n)) - t_0 else: tmp = math.sqrt(math.pow((n * x), -2.0)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-43) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 3e-54) tmp = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n); elseif (Float64(1.0 / n) <= 2e-17) tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / (x ^ 2.0))) / n); elseif (Float64(1.0 / n) <= 5e+156) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = sqrt((Float64(n * x) ^ -2.0)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -5e-43) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 3e-54) tmp = log((1.0 + (1.0 / x))) / n; elseif ((1.0 / n) <= 2e-17) tmp = ((1.0 / x) - (0.5 / (x ^ 2.0))) / n; elseif ((1.0 / n) <= 5e+156) tmp = (1.0 + (x / n)) - t_0; else tmp = sqrt(((n * x) ^ -2.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], -5e-43], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 3e-54], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-17], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+156], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[Sqrt[N[Power[N[(n * x), $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-43}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 3 \cdot 10^{-54}:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-17}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{{x}^{2}}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+156}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{\left(n \cdot x\right)}^{-2}}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000019e-43Initial program 89.2%
Taylor expanded in x around inf 95.1%
log-rec95.1%
mul-1-neg95.1%
associate-*r/95.1%
associate-*r*95.1%
metadata-eval95.1%
*-commutative95.1%
associate-/l*95.1%
exp-to-pow95.1%
*-commutative95.1%
Simplified95.1%
if -5.00000000000000019e-43 < (/.f64 1 n) < 3.00000000000000009e-54Initial program 33.9%
Taylor expanded in n around inf 85.7%
+-rgt-identity85.7%
+-rgt-identity85.7%
log1p-define85.7%
Simplified85.7%
log1p-undefine85.7%
diff-log85.7%
Applied egg-rr85.7%
Taylor expanded in x around 0 85.7%
if 3.00000000000000009e-54 < (/.f64 1 n) < 2.00000000000000014e-17Initial program 16.6%
Taylor expanded in n around inf 46.3%
+-rgt-identity46.3%
+-rgt-identity46.3%
log1p-define46.3%
Simplified46.3%
Taylor expanded in x around inf 73.5%
associate-*r/73.5%
metadata-eval73.5%
Simplified73.5%
if 2.00000000000000014e-17 < (/.f64 1 n) < 4.99999999999999992e156Initial program 72.0%
Taylor expanded in x around 0 72.1%
if 4.99999999999999992e156 < (/.f64 1 n) Initial program 17.8%
Taylor expanded in n around inf 6.8%
+-rgt-identity6.8%
+-rgt-identity6.8%
log1p-define6.8%
Simplified6.8%
Taylor expanded in x around inf 53.7%
*-commutative53.7%
Simplified53.7%
add-sqr-sqrt53.7%
sqrt-unprod86.2%
inv-pow86.2%
inv-pow86.2%
pow-prod-up86.2%
metadata-eval86.2%
Applied egg-rr86.2%
Final simplification86.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-43)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 3e-54)
(/ (log (+ 1.0 (/ 1.0 x))) n)
(if (<= (/ 1.0 n) 2e-17)
(/ (- (/ 1.0 x) (/ 0.5 (pow x 2.0))) 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) <= -5e-43) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 3e-54) {
tmp = log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = ((1.0 / x) - (0.5 / pow(x, 2.0))) / 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) <= (-5d-43)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 3d-54) then
tmp = log((1.0d0 + (1.0d0 / x))) / n
else if ((1.0d0 / n) <= 2d-17) then
tmp = ((1.0d0 / x) - (0.5d0 / (x ** 2.0d0))) / 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) <= -5e-43) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 3e-54) {
tmp = Math.log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = ((1.0 / x) - (0.5 / Math.pow(x, 2.0))) / 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) <= -5e-43: tmp = t_0 / (n * x) elif (1.0 / n) <= 3e-54: tmp = math.log((1.0 + (1.0 / x))) / n elif (1.0 / n) <= 2e-17: tmp = ((1.0 / x) - (0.5 / math.pow(x, 2.0))) / 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) <= -5e-43) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 3e-54) tmp = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n); elseif (Float64(1.0 / n) <= 2e-17) tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / (x ^ 2.0))) / 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) <= -5e-43) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 3e-54) tmp = log((1.0 + (1.0 / x))) / n; elseif ((1.0 / n) <= 2e-17) tmp = ((1.0 / x) - (0.5 / (x ^ 2.0))) / 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], -5e-43], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 3e-54], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-17], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[Power[x, 2.0], $MachinePrecision]), $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 -5 \cdot 10^{-43}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 3 \cdot 10^{-54}:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-17}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{{x}^{2}}}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000019e-43Initial program 89.2%
Taylor expanded in x around inf 95.1%
log-rec95.1%
mul-1-neg95.1%
associate-*r/95.1%
associate-*r*95.1%
metadata-eval95.1%
*-commutative95.1%
associate-/l*95.1%
exp-to-pow95.1%
*-commutative95.1%
Simplified95.1%
if -5.00000000000000019e-43 < (/.f64 1 n) < 3.00000000000000009e-54Initial program 33.9%
Taylor expanded in n around inf 85.7%
+-rgt-identity85.7%
+-rgt-identity85.7%
log1p-define85.7%
Simplified85.7%
log1p-undefine85.7%
diff-log85.7%
Applied egg-rr85.7%
Taylor expanded in x around 0 85.7%
if 3.00000000000000009e-54 < (/.f64 1 n) < 2.00000000000000014e-17Initial program 16.6%
Taylor expanded in n around inf 46.3%
+-rgt-identity46.3%
+-rgt-identity46.3%
log1p-define46.3%
Simplified46.3%
Taylor expanded in x around inf 73.5%
associate-*r/73.5%
metadata-eval73.5%
Simplified73.5%
if 2.00000000000000014e-17 < (/.f64 1 n) Initial program 53.9%
Taylor expanded in n around 0 53.9%
log1p-define92.8%
*-rgt-identity92.8%
associate-/l*92.8%
exp-to-pow92.8%
Simplified92.8%
Taylor expanded in x around 0 92.8%
Final simplification88.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-43)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 3e-54)
(/ (log (+ 1.0 (/ 1.0 x))) n)
(if (<= (/ 1.0 n) 2e-17)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 5e-16)
(/ (log x) (- n))
(if (<= (/ 1.0 n) 5e+156)
(- (+ 1.0 (/ x n)) t_0)
(/ 1.0 (* n x)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-43) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 3e-54) {
tmp = log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 5e-16) {
tmp = log(x) / -n;
} else if ((1.0 / n) <= 5e+156) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.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 ((1.0d0 / n) <= (-5d-43)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 3d-54) then
tmp = log((1.0d0 + (1.0d0 / x))) / n
else if ((1.0d0 / n) <= 2d-17) then
tmp = (1.0d0 / x) / n
else if ((1.0d0 / n) <= 5d-16) then
tmp = log(x) / -n
else if ((1.0d0 / n) <= 5d+156) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = 1.0d0 / (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 ((1.0 / n) <= -5e-43) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 3e-54) {
tmp = Math.log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 5e-16) {
tmp = Math.log(x) / -n;
} else if ((1.0 / n) <= 5e+156) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-43: tmp = t_0 / (n * x) elif (1.0 / n) <= 3e-54: tmp = math.log((1.0 + (1.0 / x))) / n elif (1.0 / n) <= 2e-17: tmp = (1.0 / x) / n elif (1.0 / n) <= 5e-16: tmp = math.log(x) / -n elif (1.0 / n) <= 5e+156: tmp = (1.0 + (x / n)) - t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-43) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 3e-54) tmp = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n); elseif (Float64(1.0 / n) <= 2e-17) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 5e-16) tmp = Float64(log(x) / Float64(-n)); elseif (Float64(1.0 / n) <= 5e+156) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -5e-43) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 3e-54) tmp = log((1.0 + (1.0 / x))) / n; elseif ((1.0 / n) <= 2e-17) tmp = (1.0 / x) / n; elseif ((1.0 / n) <= 5e-16) tmp = log(x) / -n; elseif ((1.0 / n) <= 5e+156) tmp = (1.0 + (x / n)) - t_0; else tmp = 1.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[N[(1.0 / n), $MachinePrecision], -5e-43], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 3e-54], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $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], 5e-16], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+156], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-43}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 3 \cdot 10^{-54}:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-17}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-16}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+156}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000019e-43Initial program 89.2%
Taylor expanded in x around inf 95.1%
log-rec95.1%
mul-1-neg95.1%
associate-*r/95.1%
associate-*r*95.1%
metadata-eval95.1%
*-commutative95.1%
associate-/l*95.1%
exp-to-pow95.1%
*-commutative95.1%
Simplified95.1%
if -5.00000000000000019e-43 < (/.f64 1 n) < 3.00000000000000009e-54Initial program 33.9%
Taylor expanded in n around inf 85.7%
+-rgt-identity85.7%
+-rgt-identity85.7%
log1p-define85.7%
Simplified85.7%
log1p-undefine85.7%
diff-log85.7%
Applied egg-rr85.7%
Taylor expanded in x around 0 85.7%
if 3.00000000000000009e-54 < (/.f64 1 n) < 2.00000000000000014e-17Initial program 16.6%
Taylor expanded in n around inf 46.3%
+-rgt-identity46.3%
+-rgt-identity46.3%
log1p-define46.3%
Simplified46.3%
Taylor expanded in x around inf 71.7%
if 2.00000000000000014e-17 < (/.f64 1 n) < 5.0000000000000004e-16Initial program 36.8%
Taylor expanded in n around inf 85.4%
+-rgt-identity85.4%
+-rgt-identity85.4%
log1p-define85.4%
Simplified85.4%
Taylor expanded in x around 0 85.4%
neg-mul-185.4%
Simplified85.4%
if 5.0000000000000004e-16 < (/.f64 1 n) < 4.99999999999999992e156Initial program 73.3%
Taylor expanded in x around 0 73.4%
if 4.99999999999999992e156 < (/.f64 1 n) Initial program 17.8%
Taylor expanded in n around inf 6.8%
+-rgt-identity6.8%
+-rgt-identity6.8%
log1p-define6.8%
Simplified6.8%
Taylor expanded in x around inf 53.7%
*-commutative53.7%
Simplified53.7%
Final simplification84.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-43)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 3e-54)
(/ (log (+ 1.0 (/ 1.0 x))) n)
(if (<= (/ 1.0 n) 2e-17)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 5e-16)
(/ (log x) (- n))
(if (<= (/ 1.0 n) 5e+156)
(- (+ 1.0 (/ x n)) t_0)
(/ (log1p (+ (/ x (+ 1.0 x)) -1.0)) (- n)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-43) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 3e-54) {
tmp = log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 5e-16) {
tmp = log(x) / -n;
} else if ((1.0 / n) <= 5e+156) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = log1p(((x / (1.0 + x)) + -1.0)) / -n;
}
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) <= -5e-43) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 3e-54) {
tmp = Math.log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 5e-16) {
tmp = Math.log(x) / -n;
} else if ((1.0 / n) <= 5e+156) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = Math.log1p(((x / (1.0 + x)) + -1.0)) / -n;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-43: tmp = t_0 / (n * x) elif (1.0 / n) <= 3e-54: tmp = math.log((1.0 + (1.0 / x))) / n elif (1.0 / n) <= 2e-17: tmp = (1.0 / x) / n elif (1.0 / n) <= 5e-16: tmp = math.log(x) / -n elif (1.0 / n) <= 5e+156: tmp = (1.0 + (x / n)) - t_0 else: tmp = math.log1p(((x / (1.0 + x)) + -1.0)) / -n return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-43) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 3e-54) tmp = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n); elseif (Float64(1.0 / n) <= 2e-17) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 5e-16) tmp = Float64(log(x) / Float64(-n)); elseif (Float64(1.0 / n) <= 5e+156) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(log1p(Float64(Float64(x / Float64(1.0 + x)) + -1.0)) / Float64(-n)); 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], -5e-43], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 3e-54], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $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], 5e-16], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+156], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[Log[1 + N[(N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-43}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 3 \cdot 10^{-54}:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-17}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-16}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+156}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(\frac{x}{1 + x} + -1\right)}{-n}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000019e-43Initial program 89.2%
Taylor expanded in x around inf 95.1%
log-rec95.1%
mul-1-neg95.1%
associate-*r/95.1%
associate-*r*95.1%
metadata-eval95.1%
*-commutative95.1%
associate-/l*95.1%
exp-to-pow95.1%
*-commutative95.1%
Simplified95.1%
if -5.00000000000000019e-43 < (/.f64 1 n) < 3.00000000000000009e-54Initial program 33.9%
Taylor expanded in n around inf 85.7%
+-rgt-identity85.7%
+-rgt-identity85.7%
log1p-define85.7%
Simplified85.7%
log1p-undefine85.7%
diff-log85.7%
Applied egg-rr85.7%
Taylor expanded in x around 0 85.7%
if 3.00000000000000009e-54 < (/.f64 1 n) < 2.00000000000000014e-17Initial program 16.6%
Taylor expanded in n around inf 46.3%
+-rgt-identity46.3%
+-rgt-identity46.3%
log1p-define46.3%
Simplified46.3%
Taylor expanded in x around inf 71.7%
if 2.00000000000000014e-17 < (/.f64 1 n) < 5.0000000000000004e-16Initial program 36.8%
Taylor expanded in n around inf 85.4%
+-rgt-identity85.4%
+-rgt-identity85.4%
log1p-define85.4%
Simplified85.4%
Taylor expanded in x around 0 85.4%
neg-mul-185.4%
Simplified85.4%
if 5.0000000000000004e-16 < (/.f64 1 n) < 4.99999999999999992e156Initial program 73.3%
Taylor expanded in x around 0 73.4%
if 4.99999999999999992e156 < (/.f64 1 n) Initial program 17.8%
Taylor expanded in n around inf 6.8%
+-rgt-identity6.8%
+-rgt-identity6.8%
log1p-define6.8%
Simplified6.8%
log1p-undefine6.8%
diff-log6.8%
Applied egg-rr6.8%
clear-num6.8%
log-rec6.8%
Applied egg-rr6.8%
log1p-expm1-u79.6%
expm1-undefine79.6%
add-exp-log79.6%
+-commutative79.6%
Applied egg-rr79.6%
Final simplification85.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) -5e+88)
t_0
(if (<= (/ 1.0 n) 3e-54)
(/ (log (+ 1.0 (/ 1.0 x))) n)
(if (<= (/ 1.0 n) 2e-17)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 5e-16)
(/ (log x) (- n))
(if (<= (/ 1.0 n) 5e+156) t_0 (/ 1.0 (* n x)))))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e+88) {
tmp = t_0;
} else if ((1.0 / n) <= 3e-54) {
tmp = log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 5e-16) {
tmp = log(x) / -n;
} else if ((1.0 / n) <= 5e+156) {
tmp = t_0;
} else {
tmp = 1.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 = 1.0d0 - (x ** (1.0d0 / n))
if ((1.0d0 / n) <= (-5d+88)) then
tmp = t_0
else if ((1.0d0 / n) <= 3d-54) then
tmp = log((1.0d0 + (1.0d0 / x))) / n
else if ((1.0d0 / n) <= 2d-17) then
tmp = (1.0d0 / x) / n
else if ((1.0d0 / n) <= 5d-16) then
tmp = log(x) / -n
else if ((1.0d0 / n) <= 5d+156) then
tmp = t_0
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e+88) {
tmp = t_0;
} else if ((1.0 / n) <= 3e-54) {
tmp = Math.log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 5e-16) {
tmp = Math.log(x) / -n;
} else if ((1.0 / n) <= 5e+156) {
tmp = t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e+88: tmp = t_0 elif (1.0 / n) <= 3e-54: tmp = math.log((1.0 + (1.0 / x))) / n elif (1.0 / n) <= 2e-17: tmp = (1.0 / x) / n elif (1.0 / n) <= 5e-16: tmp = math.log(x) / -n elif (1.0 / n) <= 5e+156: tmp = t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (Float64(1.0 / n) <= -5e+88) tmp = t_0; elseif (Float64(1.0 / n) <= 3e-54) tmp = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n); elseif (Float64(1.0 / n) <= 2e-17) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 5e-16) tmp = Float64(log(x) / Float64(-n)); elseif (Float64(1.0 / n) <= 5e+156) tmp = t_0; else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if ((1.0 / n) <= -5e+88) tmp = t_0; elseif ((1.0 / n) <= 3e-54) tmp = log((1.0 + (1.0 / x))) / n; elseif ((1.0 / n) <= 2e-17) tmp = (1.0 / x) / n; elseif ((1.0 / n) <= 5e-16) tmp = log(x) / -n; elseif ((1.0 / n) <= 5e+156) tmp = t_0; else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e+88], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 3e-54], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $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], 5e-16], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+156], t$95$0, N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{+88}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 3 \cdot 10^{-54}:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-17}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-16}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+156}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.99999999999999997e88 or 5.0000000000000004e-16 < (/.f64 1 n) < 4.99999999999999992e156Initial program 90.3%
Taylor expanded in x around 0 64.1%
*-rgt-identity64.1%
associate-/l*64.1%
exp-to-pow64.1%
Simplified64.1%
if -4.99999999999999997e88 < (/.f64 1 n) < 3.00000000000000009e-54Initial program 40.5%
Taylor expanded in n around inf 81.0%
+-rgt-identity81.0%
+-rgt-identity81.0%
log1p-define81.0%
Simplified81.0%
log1p-undefine81.0%
diff-log81.0%
Applied egg-rr81.0%
Taylor expanded in x around 0 81.0%
if 3.00000000000000009e-54 < (/.f64 1 n) < 2.00000000000000014e-17Initial program 16.6%
Taylor expanded in n around inf 46.3%
+-rgt-identity46.3%
+-rgt-identity46.3%
log1p-define46.3%
Simplified46.3%
Taylor expanded in x around inf 71.7%
if 2.00000000000000014e-17 < (/.f64 1 n) < 5.0000000000000004e-16Initial program 36.8%
Taylor expanded in n around inf 85.4%
+-rgt-identity85.4%
+-rgt-identity85.4%
log1p-define85.4%
Simplified85.4%
Taylor expanded in x around 0 85.4%
neg-mul-185.4%
Simplified85.4%
if 4.99999999999999992e156 < (/.f64 1 n) Initial program 17.8%
Taylor expanded in n around inf 6.8%
+-rgt-identity6.8%
+-rgt-identity6.8%
log1p-define6.8%
Simplified6.8%
Taylor expanded in x around inf 53.7%
*-commutative53.7%
Simplified53.7%
Final simplification74.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-43)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 3e-54)
(/ (log (+ 1.0 (/ 1.0 x))) n)
(if (<= (/ 1.0 n) 2e-17)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 5e-16)
(/ (log x) (- n))
(if (<= (/ 1.0 n) 5e+156) (- 1.0 t_0) (/ 1.0 (* n x)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-43) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 3e-54) {
tmp = log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 5e-16) {
tmp = log(x) / -n;
} else if ((1.0 / n) <= 5e+156) {
tmp = 1.0 - t_0;
} else {
tmp = 1.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 ((1.0d0 / n) <= (-5d-43)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 3d-54) then
tmp = log((1.0d0 + (1.0d0 / x))) / n
else if ((1.0d0 / n) <= 2d-17) then
tmp = (1.0d0 / x) / n
else if ((1.0d0 / n) <= 5d-16) then
tmp = log(x) / -n
else if ((1.0d0 / n) <= 5d+156) then
tmp = 1.0d0 - t_0
else
tmp = 1.0d0 / (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 ((1.0 / n) <= -5e-43) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 3e-54) {
tmp = Math.log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 5e-16) {
tmp = Math.log(x) / -n;
} else if ((1.0 / n) <= 5e+156) {
tmp = 1.0 - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-43: tmp = t_0 / (n * x) elif (1.0 / n) <= 3e-54: tmp = math.log((1.0 + (1.0 / x))) / n elif (1.0 / n) <= 2e-17: tmp = (1.0 / x) / n elif (1.0 / n) <= 5e-16: tmp = math.log(x) / -n elif (1.0 / n) <= 5e+156: tmp = 1.0 - t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-43) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 3e-54) tmp = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n); elseif (Float64(1.0 / n) <= 2e-17) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 5e-16) tmp = Float64(log(x) / Float64(-n)); elseif (Float64(1.0 / n) <= 5e+156) tmp = Float64(1.0 - t_0); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -5e-43) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 3e-54) tmp = log((1.0 + (1.0 / x))) / n; elseif ((1.0 / n) <= 2e-17) tmp = (1.0 / x) / n; elseif ((1.0 / n) <= 5e-16) tmp = log(x) / -n; elseif ((1.0 / n) <= 5e+156) tmp = 1.0 - t_0; else tmp = 1.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[N[(1.0 / n), $MachinePrecision], -5e-43], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 3e-54], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $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], 5e-16], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+156], N[(1.0 - t$95$0), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-43}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 3 \cdot 10^{-54}:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-17}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-16}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+156}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000019e-43Initial program 89.2%
Taylor expanded in x around inf 95.1%
log-rec95.1%
mul-1-neg95.1%
associate-*r/95.1%
associate-*r*95.1%
metadata-eval95.1%
*-commutative95.1%
associate-/l*95.1%
exp-to-pow95.1%
*-commutative95.1%
Simplified95.1%
if -5.00000000000000019e-43 < (/.f64 1 n) < 3.00000000000000009e-54Initial program 33.9%
Taylor expanded in n around inf 85.7%
+-rgt-identity85.7%
+-rgt-identity85.7%
log1p-define85.7%
Simplified85.7%
log1p-undefine85.7%
diff-log85.7%
Applied egg-rr85.7%
Taylor expanded in x around 0 85.7%
if 3.00000000000000009e-54 < (/.f64 1 n) < 2.00000000000000014e-17Initial program 16.6%
Taylor expanded in n around inf 46.3%
+-rgt-identity46.3%
+-rgt-identity46.3%
log1p-define46.3%
Simplified46.3%
Taylor expanded in x around inf 71.7%
if 2.00000000000000014e-17 < (/.f64 1 n) < 5.0000000000000004e-16Initial program 36.8%
Taylor expanded in n around inf 85.4%
+-rgt-identity85.4%
+-rgt-identity85.4%
log1p-define85.4%
Simplified85.4%
Taylor expanded in x around 0 85.4%
neg-mul-185.4%
Simplified85.4%
if 5.0000000000000004e-16 < (/.f64 1 n) < 4.99999999999999992e156Initial program 73.3%
Taylor expanded in x around 0 73.3%
*-rgt-identity73.3%
associate-/l*73.3%
exp-to-pow73.3%
Simplified73.3%
if 4.99999999999999992e156 < (/.f64 1 n) Initial program 17.8%
Taylor expanded in n around inf 6.8%
+-rgt-identity6.8%
+-rgt-identity6.8%
log1p-define6.8%
Simplified6.8%
Taylor expanded in x around inf 53.7%
*-commutative53.7%
Simplified53.7%
Final simplification84.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-43)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 3e-54)
(/ (log (+ 1.0 (/ 1.0 x))) n)
(if (<= (/ 1.0 n) 2e-17)
(/ (- (/ 1.0 x) (/ 0.5 (pow x 2.0))) n)
(if (<= (/ 1.0 n) 5e+156)
(- (+ 1.0 (/ x n)) t_0)
(/ (log1p (+ (/ x (+ 1.0 x)) -1.0)) (- n))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-43) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 3e-54) {
tmp = log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = ((1.0 / x) - (0.5 / pow(x, 2.0))) / n;
} else if ((1.0 / n) <= 5e+156) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = log1p(((x / (1.0 + x)) + -1.0)) / -n;
}
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) <= -5e-43) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 3e-54) {
tmp = Math.log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e-17) {
tmp = ((1.0 / x) - (0.5 / Math.pow(x, 2.0))) / n;
} else if ((1.0 / n) <= 5e+156) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = Math.log1p(((x / (1.0 + x)) + -1.0)) / -n;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-43: tmp = t_0 / (n * x) elif (1.0 / n) <= 3e-54: tmp = math.log((1.0 + (1.0 / x))) / n elif (1.0 / n) <= 2e-17: tmp = ((1.0 / x) - (0.5 / math.pow(x, 2.0))) / n elif (1.0 / n) <= 5e+156: tmp = (1.0 + (x / n)) - t_0 else: tmp = math.log1p(((x / (1.0 + x)) + -1.0)) / -n return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-43) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 3e-54) tmp = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n); elseif (Float64(1.0 / n) <= 2e-17) tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / (x ^ 2.0))) / n); elseif (Float64(1.0 / n) <= 5e+156) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(log1p(Float64(Float64(x / Float64(1.0 + x)) + -1.0)) / Float64(-n)); 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], -5e-43], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 3e-54], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-17], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+156], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[Log[1 + N[(N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-43}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 3 \cdot 10^{-54}:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-17}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{{x}^{2}}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+156}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(\frac{x}{1 + x} + -1\right)}{-n}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000019e-43Initial program 89.2%
Taylor expanded in x around inf 95.1%
log-rec95.1%
mul-1-neg95.1%
associate-*r/95.1%
associate-*r*95.1%
metadata-eval95.1%
*-commutative95.1%
associate-/l*95.1%
exp-to-pow95.1%
*-commutative95.1%
Simplified95.1%
if -5.00000000000000019e-43 < (/.f64 1 n) < 3.00000000000000009e-54Initial program 33.9%
Taylor expanded in n around inf 85.7%
+-rgt-identity85.7%
+-rgt-identity85.7%
log1p-define85.7%
Simplified85.7%
log1p-undefine85.7%
diff-log85.7%
Applied egg-rr85.7%
Taylor expanded in x around 0 85.7%
if 3.00000000000000009e-54 < (/.f64 1 n) < 2.00000000000000014e-17Initial program 16.6%
Taylor expanded in n around inf 46.3%
+-rgt-identity46.3%
+-rgt-identity46.3%
log1p-define46.3%
Simplified46.3%
Taylor expanded in x around inf 73.5%
associate-*r/73.5%
metadata-eval73.5%
Simplified73.5%
if 2.00000000000000014e-17 < (/.f64 1 n) < 4.99999999999999992e156Initial program 72.0%
Taylor expanded in x around 0 72.1%
if 4.99999999999999992e156 < (/.f64 1 n) Initial program 17.8%
Taylor expanded in n around inf 6.8%
+-rgt-identity6.8%
+-rgt-identity6.8%
log1p-define6.8%
Simplified6.8%
log1p-undefine6.8%
diff-log6.8%
Applied egg-rr6.8%
clear-num6.8%
log-rec6.8%
Applied egg-rr6.8%
log1p-expm1-u79.6%
expm1-undefine79.6%
add-exp-log79.6%
+-commutative79.6%
Applied egg-rr79.6%
Final simplification85.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) (- n))) (t_1 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= x 2.2e-105)
t_0
(if (<= x 8e-77)
t_1
(if (<= x 2.8e-46)
t_0
(if (<= x 3.05e-37)
t_1
(if (<= x 1.0) (- (/ x n) (/ (log x) n)) (/ (/ 1.0 x) n))))))))
double code(double x, double n) {
double t_0 = log(x) / -n;
double t_1 = 1.0 - pow(x, (1.0 / n));
double tmp;
if (x <= 2.2e-105) {
tmp = t_0;
} else if (x <= 8e-77) {
tmp = t_1;
} else if (x <= 2.8e-46) {
tmp = t_0;
} else if (x <= 3.05e-37) {
tmp = t_1;
} else if (x <= 1.0) {
tmp = (x / n) - (log(x) / n);
} else {
tmp = (1.0 / x) / 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 = log(x) / -n
t_1 = 1.0d0 - (x ** (1.0d0 / n))
if (x <= 2.2d-105) then
tmp = t_0
else if (x <= 8d-77) then
tmp = t_1
else if (x <= 2.8d-46) then
tmp = t_0
else if (x <= 3.05d-37) then
tmp = t_1
else if (x <= 1.0d0) then
tmp = (x / n) - (log(x) / n)
else
tmp = (1.0d0 / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(x) / -n;
double t_1 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if (x <= 2.2e-105) {
tmp = t_0;
} else if (x <= 8e-77) {
tmp = t_1;
} else if (x <= 2.8e-46) {
tmp = t_0;
} else if (x <= 3.05e-37) {
tmp = t_1;
} else if (x <= 1.0) {
tmp = (x / n) - (Math.log(x) / n);
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): t_0 = math.log(x) / -n t_1 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if x <= 2.2e-105: tmp = t_0 elif x <= 8e-77: tmp = t_1 elif x <= 2.8e-46: tmp = t_0 elif x <= 3.05e-37: tmp = t_1 elif x <= 1.0: tmp = (x / n) - (math.log(x) / n) else: tmp = (1.0 / x) / n return tmp
function code(x, n) t_0 = Float64(log(x) / Float64(-n)) t_1 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (x <= 2.2e-105) tmp = t_0; elseif (x <= 8e-77) tmp = t_1; elseif (x <= 2.8e-46) tmp = t_0; elseif (x <= 3.05e-37) tmp = t_1; elseif (x <= 1.0) tmp = Float64(Float64(x / n) - Float64(log(x) / n)); else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = log(x) / -n; t_1 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if (x <= 2.2e-105) tmp = t_0; elseif (x <= 8e-77) tmp = t_1; elseif (x <= 2.8e-46) tmp = t_0; elseif (x <= 3.05e-37) tmp = t_1; elseif (x <= 1.0) tmp = (x / n) - (log(x) / n); else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.2e-105], t$95$0, If[LessEqual[x, 8e-77], t$95$1, If[LessEqual[x, 2.8e-46], t$95$0, If[LessEqual[x, 3.05e-37], t$95$1, If[LessEqual[x, 1.0], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
t_1 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 2.2 \cdot 10^{-105}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-77}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-46}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.05 \cdot 10^{-37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if x < 2.20000000000000004e-105 or 7.9999999999999994e-77 < x < 2.7999999999999998e-46Initial program 37.1%
Taylor expanded in n around inf 60.9%
+-rgt-identity60.9%
+-rgt-identity60.9%
log1p-define60.9%
Simplified60.9%
Taylor expanded in x around 0 60.9%
neg-mul-160.9%
Simplified60.9%
if 2.20000000000000004e-105 < x < 7.9999999999999994e-77 or 2.7999999999999998e-46 < x < 3.0500000000000002e-37Initial program 72.5%
Taylor expanded in x around 0 72.5%
*-rgt-identity72.5%
associate-/l*72.5%
exp-to-pow72.5%
Simplified72.5%
if 3.0500000000000002e-37 < x < 1Initial program 22.2%
Taylor expanded in n around inf 64.1%
+-rgt-identity64.1%
+-rgt-identity64.1%
log1p-define64.1%
Simplified64.1%
Taylor expanded in x around 0 62.4%
neg-mul-162.4%
+-commutative62.4%
unsub-neg62.4%
Simplified62.4%
if 1 < x Initial program 67.6%
Taylor expanded in n around inf 66.3%
+-rgt-identity66.3%
+-rgt-identity66.3%
log1p-define66.3%
Simplified66.3%
Taylor expanded in x around inf 68.0%
Final simplification64.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) (- n))) (t_1 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= x 3.1e-104)
t_0
(if (<= x 2.5e-76)
t_1
(if (<= x 2.75e-46)
t_0
(if (<= x 3e-37)
t_1
(if (<= x 1.0) (/ (- x (log x)) n) (/ (/ 1.0 x) n))))))))
double code(double x, double n) {
double t_0 = log(x) / -n;
double t_1 = 1.0 - pow(x, (1.0 / n));
double tmp;
if (x <= 3.1e-104) {
tmp = t_0;
} else if (x <= 2.5e-76) {
tmp = t_1;
} else if (x <= 2.75e-46) {
tmp = t_0;
} else if (x <= 3e-37) {
tmp = t_1;
} else if (x <= 1.0) {
tmp = (x - log(x)) / n;
} else {
tmp = (1.0 / x) / 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 = log(x) / -n
t_1 = 1.0d0 - (x ** (1.0d0 / n))
if (x <= 3.1d-104) then
tmp = t_0
else if (x <= 2.5d-76) then
tmp = t_1
else if (x <= 2.75d-46) then
tmp = t_0
else if (x <= 3d-37) then
tmp = t_1
else if (x <= 1.0d0) then
tmp = (x - log(x)) / n
else
tmp = (1.0d0 / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(x) / -n;
double t_1 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if (x <= 3.1e-104) {
tmp = t_0;
} else if (x <= 2.5e-76) {
tmp = t_1;
} else if (x <= 2.75e-46) {
tmp = t_0;
} else if (x <= 3e-37) {
tmp = t_1;
} else if (x <= 1.0) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): t_0 = math.log(x) / -n t_1 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if x <= 3.1e-104: tmp = t_0 elif x <= 2.5e-76: tmp = t_1 elif x <= 2.75e-46: tmp = t_0 elif x <= 3e-37: tmp = t_1 elif x <= 1.0: tmp = (x - math.log(x)) / n else: tmp = (1.0 / x) / n return tmp
function code(x, n) t_0 = Float64(log(x) / Float64(-n)) t_1 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (x <= 3.1e-104) tmp = t_0; elseif (x <= 2.5e-76) tmp = t_1; elseif (x <= 2.75e-46) tmp = t_0; elseif (x <= 3e-37) tmp = t_1; elseif (x <= 1.0) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = log(x) / -n; t_1 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if (x <= 3.1e-104) tmp = t_0; elseif (x <= 2.5e-76) tmp = t_1; elseif (x <= 2.75e-46) tmp = t_0; elseif (x <= 3e-37) tmp = t_1; elseif (x <= 1.0) tmp = (x - log(x)) / n; else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 3.1e-104], t$95$0, If[LessEqual[x, 2.5e-76], t$95$1, If[LessEqual[x, 2.75e-46], t$95$0, If[LessEqual[x, 3e-37], t$95$1, If[LessEqual[x, 1.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
t_1 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 3.1 \cdot 10^{-104}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-76}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.75 \cdot 10^{-46}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if x < 3.09999999999999976e-104 or 2.4999999999999999e-76 < x < 2.74999999999999992e-46Initial program 37.1%
Taylor expanded in n around inf 60.9%
+-rgt-identity60.9%
+-rgt-identity60.9%
log1p-define60.9%
Simplified60.9%
Taylor expanded in x around 0 60.9%
neg-mul-160.9%
Simplified60.9%
if 3.09999999999999976e-104 < x < 2.4999999999999999e-76 or 2.74999999999999992e-46 < x < 3e-37Initial program 72.5%
Taylor expanded in x around 0 72.5%
*-rgt-identity72.5%
associate-/l*72.5%
exp-to-pow72.5%
Simplified72.5%
if 3e-37 < x < 1Initial program 22.2%
Taylor expanded in n around inf 64.1%
+-rgt-identity64.1%
+-rgt-identity64.1%
log1p-define64.1%
Simplified64.1%
Taylor expanded in x around 0 62.3%
neg-mul-162.3%
unsub-neg62.3%
Simplified62.3%
if 1 < x Initial program 67.6%
Taylor expanded in n around inf 66.3%
+-rgt-identity66.3%
+-rgt-identity66.3%
log1p-define66.3%
Simplified66.3%
Taylor expanded in x around inf 68.0%
Final simplification64.9%
(FPCore (x n) :precision binary64 (if (<= x 1.0) (/ (- x (log x)) n) (/ (/ 1.0 x) n)))
double code(double x, double n) {
double tmp;
if (x <= 1.0) {
tmp = (x - log(x)) / n;
} else {
tmp = (1.0 / 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) / 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) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.0: tmp = (x - math.log(x)) / n else: tmp = (1.0 / 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(1.0 / 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) / 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[(1.0 / x), $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}}{n}\\
\end{array}
\end{array}
if x < 1Initial program 40.5%
Taylor expanded in n around inf 54.7%
+-rgt-identity54.7%
+-rgt-identity54.7%
log1p-define54.7%
Simplified54.7%
Taylor expanded in x around 0 54.6%
neg-mul-154.6%
unsub-neg54.6%
Simplified54.6%
if 1 < x Initial program 67.6%
Taylor expanded in n around inf 66.3%
+-rgt-identity66.3%
+-rgt-identity66.3%
log1p-define66.3%
Simplified66.3%
Taylor expanded in x around inf 68.0%
Final simplification60.2%
(FPCore (x n) :precision binary64 (if (<= x 0.55) (/ (log x) (- n)) (/ (/ 1.0 x) n)))
double code(double x, double n) {
double tmp;
if (x <= 0.55) {
tmp = log(x) / -n;
} else {
tmp = (1.0 / 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.55d0) then
tmp = log(x) / -n
else
tmp = (1.0d0 / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.55) {
tmp = Math.log(x) / -n;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.55: tmp = math.log(x) / -n else: tmp = (1.0 / x) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.55) tmp = Float64(log(x) / Float64(-n)); else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.55) tmp = log(x) / -n; else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.55], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.55:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if x < 0.55000000000000004Initial program 40.5%
Taylor expanded in n around inf 54.7%
+-rgt-identity54.7%
+-rgt-identity54.7%
log1p-define54.7%
Simplified54.7%
Taylor expanded in x around 0 54.0%
neg-mul-154.0%
Simplified54.0%
if 0.55000000000000004 < x Initial program 67.6%
Taylor expanded in n around inf 66.3%
+-rgt-identity66.3%
+-rgt-identity66.3%
log1p-define66.3%
Simplified66.3%
Taylor expanded in x around inf 68.0%
Final simplification59.9%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -200000.0) (/ 0.0 n) (/ (/ 1.0 x) n)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -200000.0) {
tmp = 0.0 / n;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((1.0d0 / n) <= (-200000.0d0)) then
tmp = 0.0d0 / n
else
tmp = (1.0d0 / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -200000.0) {
tmp = 0.0 / n;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -200000.0: tmp = 0.0 / n else: tmp = (1.0 / x) / n return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -200000.0) tmp = Float64(0.0 / n); else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -200000.0) tmp = 0.0 / n; else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -200000.0], N[(0.0 / n), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -200000:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e5Initial program 100.0%
Taylor expanded in n around inf 49.7%
+-rgt-identity49.7%
+-rgt-identity49.7%
log1p-define49.7%
Simplified49.7%
log1p-undefine49.7%
diff-log49.7%
Applied egg-rr49.7%
Taylor expanded in x around inf 50.8%
if -2e5 < (/.f64 1 n) Initial program 36.0%
Taylor expanded in n around inf 62.9%
+-rgt-identity62.9%
+-rgt-identity62.9%
log1p-define62.9%
Simplified62.9%
Taylor expanded in x around inf 44.2%
Final simplification45.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 52.0%
Taylor expanded in n around inf 59.6%
+-rgt-identity59.6%
+-rgt-identity59.6%
log1p-define59.6%
Simplified59.6%
Taylor expanded in x around inf 41.2%
*-commutative41.2%
Simplified41.2%
Final simplification41.2%
(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 52.0%
Taylor expanded in n around inf 59.6%
+-rgt-identity59.6%
+-rgt-identity59.6%
log1p-define59.6%
Simplified59.6%
Taylor expanded in x around inf 42.1%
Final simplification42.1%
(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 52.0%
Taylor expanded in x around 0 31.0%
Taylor expanded in x around inf 4.4%
Final simplification4.4%
herbie shell --seed 2024043
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))