
(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 18 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 (/ -1.0 n))) n)))
(if (<= (/ 1.0 n) -5e-88)
t_0
(if (<= (/ 1.0 n) 5e-101)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 2e-33)
(/
(+
(/ 0.3333333333333333 (pow x 3.0))
(- (/ 1.0 x) (/ 0.5 (pow x 2.0))))
n)
(if (<= (/ 1.0 n) 1e-18)
(/ (- (* n x) (* n (log x))) (* n n))
(if (<= (/ 1.0 n) 200000.0)
t_0
(- (exp (/ (log1p x) n)) (pow x (/ 1.0 n))))))))))
double code(double x, double n) {
double t_0 = pow(x, (-1.0 - (-1.0 / n))) / n;
double tmp;
if ((1.0 / n) <= -5e-88) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-101) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 2e-33) {
tmp = ((0.3333333333333333 / pow(x, 3.0)) + ((1.0 / x) - (0.5 / pow(x, 2.0)))) / n;
} else if ((1.0 / n) <= 1e-18) {
tmp = ((n * x) - (n * log(x))) / (n * n);
} else if ((1.0 / n) <= 200000.0) {
tmp = t_0;
} else {
tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (-1.0 - (-1.0 / n))) / n;
double tmp;
if ((1.0 / n) <= -5e-88) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-101) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 2e-33) {
tmp = ((0.3333333333333333 / Math.pow(x, 3.0)) + ((1.0 / x) - (0.5 / Math.pow(x, 2.0)))) / n;
} else if ((1.0 / n) <= 1e-18) {
tmp = ((n * x) - (n * Math.log(x))) / (n * n);
} else if ((1.0 / n) <= 200000.0) {
tmp = t_0;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (-1.0 - (-1.0 / n))) / n tmp = 0 if (1.0 / n) <= -5e-88: tmp = t_0 elif (1.0 / n) <= 5e-101: tmp = math.log((x / (x + 1.0))) / -n elif (1.0 / n) <= 2e-33: tmp = ((0.3333333333333333 / math.pow(x, 3.0)) + ((1.0 / x) - (0.5 / math.pow(x, 2.0)))) / n elif (1.0 / n) <= 1e-18: tmp = ((n * x) - (n * math.log(x))) / (n * n) elif (1.0 / n) <= 200000.0: tmp = t_0 else: tmp = math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) t_0 = Float64((x ^ Float64(-1.0 - Float64(-1.0 / n))) / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-88) tmp = t_0; elseif (Float64(1.0 / n) <= 5e-101) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 2e-33) tmp = Float64(Float64(Float64(0.3333333333333333 / (x ^ 3.0)) + Float64(Float64(1.0 / x) - Float64(0.5 / (x ^ 2.0)))) / n); elseif (Float64(1.0 / n) <= 1e-18) tmp = Float64(Float64(Float64(n * x) - Float64(n * log(x))) / Float64(n * n)); elseif (Float64(1.0 / n) <= 200000.0) tmp = t_0; else tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Power[x, N[(-1.0 - N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-88], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-101], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-33], 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], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-18], N[(N[(N[(n * x), $MachinePrecision] - N[(n * N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 200000.0], t$95$0, N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{x}^{\left(-1 - \frac{-1}{n}\right)}}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-88}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-101}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-33}:\\
\;\;\;\;\frac{\frac{0.3333333333333333}{{x}^{3}} + \left(\frac{1}{x} - \frac{0.5}{{x}^{2}}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-18}:\\
\;\;\;\;\frac{n \cdot x - n \cdot \log x}{n \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 200000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000009e-88 or 1.0000000000000001e-18 < (/.f64 1 n) < 2e5Initial program 70.2%
Taylor expanded in x around inf 89.4%
log-rec89.4%
mul-1-neg89.4%
associate-*r/89.4%
associate-*r*89.4%
metadata-eval89.4%
*-commutative89.4%
associate-/l*89.5%
exp-to-pow89.5%
*-commutative89.5%
Simplified89.5%
add089.5%
associate-/r*90.5%
pow190.5%
pow-div90.1%
Applied egg-rr90.1%
add090.1%
sub-neg90.1%
metadata-eval90.1%
Simplified90.1%
if -5.00000000000000009e-88 < (/.f64 1 n) < 5.0000000000000001e-101Initial program 38.2%
Taylor expanded in n around inf 90.1%
log1p-define90.1%
Simplified90.1%
log1p-undefine90.1%
diff-log90.2%
Applied egg-rr90.2%
clear-num90.2%
log-rec90.3%
Applied egg-rr90.3%
if 5.0000000000000001e-101 < (/.f64 1 n) < 2.0000000000000001e-33Initial program 4.6%
Taylor expanded in n around inf 39.1%
log1p-define39.1%
Simplified39.1%
Taylor expanded in x around inf 71.4%
associate--l+71.4%
associate-*r/71.4%
metadata-eval71.4%
associate-*r/71.4%
metadata-eval71.4%
Simplified71.4%
if 2.0000000000000001e-33 < (/.f64 1 n) < 1.0000000000000001e-18Initial program 8.2%
Taylor expanded in n around inf 99.6%
log1p-define99.6%
Simplified99.6%
Taylor expanded in x around 0 99.6%
associate-*r/99.6%
log-pow99.6%
inv-pow99.6%
neg-log99.6%
frac-2neg99.6%
frac-add100.0%
Applied egg-rr100.0%
if 2e5 < (/.f64 1 n) Initial program 49.8%
Taylor expanded in n around 0 49.8%
log1p-define100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
Simplified100.0%
Final simplification90.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n)))
(t_1
(fma
t_0
(/ (+ (/ 0.5 (pow n 2.0)) (/ -0.5 n)) (pow x 2.0))
(/ (/ t_0 n) x))))
(if (<= n -3.2e+80)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= n -0.56)
t_1
(if (<= n 5.8e-6)
(- (exp (/ (log1p x) n)) t_0)
(if (<= n 8e+96) t_1 (/ 1.0 (/ n (- (log1p x) (log x))))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = fma(t_0, (((0.5 / pow(n, 2.0)) + (-0.5 / n)) / pow(x, 2.0)), ((t_0 / n) / x));
double tmp;
if (n <= -3.2e+80) {
tmp = log((x / (x + 1.0))) / -n;
} else if (n <= -0.56) {
tmp = t_1;
} else if (n <= 5.8e-6) {
tmp = exp((log1p(x) / n)) - t_0;
} else if (n <= 8e+96) {
tmp = t_1;
} else {
tmp = 1.0 / (n / (log1p(x) - log(x)));
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = fma(t_0, Float64(Float64(Float64(0.5 / (n ^ 2.0)) + Float64(-0.5 / n)) / (x ^ 2.0)), Float64(Float64(t_0 / n) / x)) tmp = 0.0 if (n <= -3.2e+80) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (n <= -0.56) tmp = t_1; elseif (n <= 5.8e-6) tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); elseif (n <= 8e+96) tmp = t_1; else tmp = Float64(1.0 / Float64(n / Float64(log1p(x) - log(x)))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[(N[(0.5 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -3.2e+80], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[n, -0.56], t$95$1, If[LessEqual[n, 5.8e-6], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[n, 8e+96], t$95$1, N[(1.0 / N[(n / N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \mathsf{fma}\left(t\_0, \frac{\frac{0.5}{{n}^{2}} + \frac{-0.5}{n}}{{x}^{2}}, \frac{\frac{t\_0}{n}}{x}\right)\\
\mathbf{if}\;n \leq -3.2 \cdot 10^{+80}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;n \leq -0.56:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;n \leq 5.8 \cdot 10^{-6}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\mathbf{elif}\;n \leq 8 \cdot 10^{+96}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{n}{\mathsf{log1p}\left(x\right) - \log x}}\\
\end{array}
\end{array}
if n < -3.1999999999999999e80Initial program 32.3%
Taylor expanded in n around inf 89.2%
log1p-define89.2%
Simplified89.2%
log1p-undefine89.2%
diff-log89.6%
Applied egg-rr89.6%
clear-num89.6%
log-rec89.7%
Applied egg-rr89.7%
if -3.1999999999999999e80 < n < -0.56000000000000005 or 5.8000000000000004e-6 < n < 8.0000000000000004e96Initial program 12.6%
Taylor expanded in x around inf 66.2%
+-commutative66.2%
associate-/l*66.2%
fma-define66.2%
Simplified66.3%
*-un-lft-identity66.3%
times-frac68.0%
Applied egg-rr68.0%
associate-*l/68.1%
*-un-lft-identity68.1%
Applied egg-rr68.1%
if -0.56000000000000005 < n < 5.8000000000000004e-6Initial program 84.6%
Taylor expanded in n around 0 84.6%
log1p-define100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
Simplified100.0%
if 8.0000000000000004e96 < n Initial program 43.5%
Taylor expanded in n around inf 89.6%
log1p-define89.6%
Simplified89.6%
clear-num89.6%
inv-pow89.6%
Applied egg-rr89.6%
unpow-189.6%
Simplified89.6%
Final simplification88.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (log (/ x (+ x 1.0))) (- n))))
(if (<= n -3.2e+80)
t_1
(if (<= n -7.6)
(fma t_0 (/ (/ -0.5 n) (pow x 2.0)) (* (/ t_0 n) (/ 1.0 x)))
(if (<= n 2.2e-6)
(- (exp (/ (log1p x) n)) t_0)
(if (<= n 2.5e+72) (/ (pow x (- -1.0 (/ -1.0 n))) n) t_1))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = log((x / (x + 1.0))) / -n;
double tmp;
if (n <= -3.2e+80) {
tmp = t_1;
} else if (n <= -7.6) {
tmp = fma(t_0, ((-0.5 / n) / pow(x, 2.0)), ((t_0 / n) * (1.0 / x)));
} else if (n <= 2.2e-6) {
tmp = exp((log1p(x) / n)) - t_0;
} else if (n <= 2.5e+72) {
tmp = pow(x, (-1.0 - (-1.0 / n))) / n;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)) tmp = 0.0 if (n <= -3.2e+80) tmp = t_1; elseif (n <= -7.6) tmp = fma(t_0, Float64(Float64(-0.5 / n) / (x ^ 2.0)), Float64(Float64(t_0 / n) * Float64(1.0 / x))); elseif (n <= 2.2e-6) tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); elseif (n <= 2.5e+72) tmp = Float64((x ^ Float64(-1.0 - Float64(-1.0 / n))) / n); else tmp = t_1; end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[n, -3.2e+80], t$95$1, If[LessEqual[n, -7.6], N[(t$95$0 * N[(N[(-0.5 / n), $MachinePrecision] / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$0 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.2e-6], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[n, 2.5e+72], N[(N[Power[x, N[(-1.0 - N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{if}\;n \leq -3.2 \cdot 10^{+80}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;n \leq -7.6:\\
\;\;\;\;\mathsf{fma}\left(t\_0, \frac{\frac{-0.5}{n}}{{x}^{2}}, \frac{t\_0}{n} \cdot \frac{1}{x}\right)\\
\mathbf{elif}\;n \leq 2.2 \cdot 10^{-6}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\mathbf{elif}\;n \leq 2.5 \cdot 10^{+72}:\\
\;\;\;\;\frac{{x}^{\left(-1 - \frac{-1}{n}\right)}}{n}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if n < -3.1999999999999999e80 or 2.49999999999999996e72 < n Initial program 35.7%
Taylor expanded in n around inf 87.3%
log1p-define87.3%
Simplified87.3%
log1p-undefine87.3%
diff-log87.5%
Applied egg-rr87.5%
clear-num87.5%
log-rec87.6%
Applied egg-rr87.6%
if -3.1999999999999999e80 < n < -7.5999999999999996Initial program 13.4%
Taylor expanded in x around inf 72.9%
+-commutative72.9%
associate-/l*72.9%
fma-define72.9%
Simplified72.9%
*-un-lft-identity72.9%
times-frac75.1%
Applied egg-rr75.1%
Taylor expanded in n around inf 75.1%
associate-/r*75.1%
Simplified75.1%
if -7.5999999999999996 < n < 2.2000000000000001e-6Initial program 84.6%
Taylor expanded in n around 0 84.6%
log1p-define100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
Simplified100.0%
if 2.2000000000000001e-6 < n < 2.49999999999999996e72Initial program 14.3%
Taylor expanded in x around inf 61.5%
log-rec61.5%
mul-1-neg61.5%
associate-*r/61.5%
associate-*r*61.5%
metadata-eval61.5%
*-commutative61.5%
associate-/l*61.5%
exp-to-pow61.7%
*-commutative61.7%
Simplified61.7%
add061.7%
associate-/r*63.6%
pow163.6%
pow-div62.8%
Applied egg-rr62.8%
add062.8%
sub-neg62.8%
metadata-eval62.8%
Simplified62.8%
Final simplification88.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (pow x (- -1.0 (/ -1.0 n))) n)))
(if (<= (/ 1.0 n) -5e-88)
t_0
(if (<= (/ 1.0 n) 5e-101)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 2e-39)
(/ (- (/ 1.0 x) (/ 0.5 (pow x 2.0))) n)
(if (<= (/ 1.0 n) 1e-18)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 200000.0)
t_0
(if (<= (/ 1.0 n) 2e+78)
(- 1.0 (pow x (/ 1.0 n)))
(log1p (expm1 (/ 1.0 (* n x))))))))))))
double code(double x, double n) {
double t_0 = pow(x, (-1.0 - (-1.0 / n))) / n;
double tmp;
if ((1.0 / n) <= -5e-88) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-101) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 2e-39) {
tmp = ((1.0 / x) - (0.5 / pow(x, 2.0))) / n;
} else if ((1.0 / n) <= 1e-18) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 200000.0) {
tmp = t_0;
} else if ((1.0 / n) <= 2e+78) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = log1p(expm1((1.0 / (n * x))));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (-1.0 - (-1.0 / n))) / n;
double tmp;
if ((1.0 / n) <= -5e-88) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-101) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 2e-39) {
tmp = ((1.0 / x) - (0.5 / Math.pow(x, 2.0))) / n;
} else if ((1.0 / n) <= 1e-18) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 200000.0) {
tmp = t_0;
} else if ((1.0 / n) <= 2e+78) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = Math.log1p(Math.expm1((1.0 / (n * x))));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (-1.0 - (-1.0 / n))) / n tmp = 0 if (1.0 / n) <= -5e-88: tmp = t_0 elif (1.0 / n) <= 5e-101: tmp = math.log((x / (x + 1.0))) / -n elif (1.0 / n) <= 2e-39: tmp = ((1.0 / x) - (0.5 / math.pow(x, 2.0))) / n elif (1.0 / n) <= 1e-18: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 200000.0: tmp = t_0 elif (1.0 / n) <= 2e+78: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = math.log1p(math.expm1((1.0 / (n * x)))) return tmp
function code(x, n) t_0 = Float64((x ^ Float64(-1.0 - Float64(-1.0 / n))) / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-88) tmp = t_0; elseif (Float64(1.0 / n) <= 5e-101) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 2e-39) tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / (x ^ 2.0))) / n); elseif (Float64(1.0 / n) <= 1e-18) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 200000.0) tmp = t_0; elseif (Float64(1.0 / n) <= 2e+78) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = log1p(expm1(Float64(1.0 / Float64(n * x)))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Power[x, N[(-1.0 - N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-88], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-101], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-39], 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], 1e-18], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 200000.0], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+78], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Log[1 + N[(Exp[N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{x}^{\left(-1 - \frac{-1}{n}\right)}}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-88}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-101}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-39}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{{x}^{2}}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-18}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 200000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+78}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{n \cdot x}\right)\right)\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000009e-88 or 1.0000000000000001e-18 < (/.f64 1 n) < 2e5Initial program 70.2%
Taylor expanded in x around inf 89.4%
log-rec89.4%
mul-1-neg89.4%
associate-*r/89.4%
associate-*r*89.4%
metadata-eval89.4%
*-commutative89.4%
associate-/l*89.5%
exp-to-pow89.5%
*-commutative89.5%
Simplified89.5%
add089.5%
associate-/r*90.5%
pow190.5%
pow-div90.1%
Applied egg-rr90.1%
add090.1%
sub-neg90.1%
metadata-eval90.1%
Simplified90.1%
if -5.00000000000000009e-88 < (/.f64 1 n) < 5.0000000000000001e-101Initial program 38.2%
Taylor expanded in n around inf 90.1%
log1p-define90.1%
Simplified90.1%
log1p-undefine90.1%
diff-log90.2%
Applied egg-rr90.2%
clear-num90.2%
log-rec90.3%
Applied egg-rr90.3%
if 5.0000000000000001e-101 < (/.f64 1 n) < 1.99999999999999986e-39Initial program 4.7%
Taylor expanded in n around inf 37.3%
log1p-define37.3%
Simplified37.3%
Taylor expanded in x around inf 72.9%
associate-*r/72.9%
metadata-eval72.9%
Simplified72.9%
if 1.99999999999999986e-39 < (/.f64 1 n) < 1.0000000000000001e-18Initial program 6.9%
Taylor expanded in n around inf 83.9%
log1p-define83.9%
Simplified83.9%
log1p-undefine83.9%
diff-log83.9%
Applied egg-rr83.9%
if 2e5 < (/.f64 1 n) < 2.00000000000000002e78Initial program 100.0%
Taylor expanded in x around 0 100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
Simplified100.0%
if 2.00000000000000002e78 < (/.f64 1 n) Initial program 26.1%
Taylor expanded in n around inf 5.9%
log1p-define5.9%
Simplified5.9%
Taylor expanded in x around inf 35.4%
*-commutative35.4%
Simplified35.4%
log1p-expm1-u79.6%
Applied egg-rr79.6%
Final simplification88.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (pow x (- -1.0 (/ -1.0 n))) n)))
(if (<= (/ 1.0 n) -5e-88)
t_0
(if (<= (/ 1.0 n) 5e-101)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 2e-33)
(/
(+
(/ 0.3333333333333333 (pow x 3.0))
(- (/ 1.0 x) (/ 0.5 (pow x 2.0))))
n)
(if (<= (/ 1.0 n) 1e-18)
(/ (- (* n x) (* n (log x))) (* n n))
(if (<= (/ 1.0 n) 200000.0)
t_0
(if (<= (/ 1.0 n) 2e+78)
(- 1.0 (pow x (/ 1.0 n)))
(log1p (expm1 (/ 1.0 (* n x))))))))))))
double code(double x, double n) {
double t_0 = pow(x, (-1.0 - (-1.0 / n))) / n;
double tmp;
if ((1.0 / n) <= -5e-88) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-101) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 2e-33) {
tmp = ((0.3333333333333333 / pow(x, 3.0)) + ((1.0 / x) - (0.5 / pow(x, 2.0)))) / n;
} else if ((1.0 / n) <= 1e-18) {
tmp = ((n * x) - (n * log(x))) / (n * n);
} else if ((1.0 / n) <= 200000.0) {
tmp = t_0;
} else if ((1.0 / n) <= 2e+78) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = log1p(expm1((1.0 / (n * x))));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (-1.0 - (-1.0 / n))) / n;
double tmp;
if ((1.0 / n) <= -5e-88) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-101) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 2e-33) {
tmp = ((0.3333333333333333 / Math.pow(x, 3.0)) + ((1.0 / x) - (0.5 / Math.pow(x, 2.0)))) / n;
} else if ((1.0 / n) <= 1e-18) {
tmp = ((n * x) - (n * Math.log(x))) / (n * n);
} else if ((1.0 / n) <= 200000.0) {
tmp = t_0;
} else if ((1.0 / n) <= 2e+78) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = Math.log1p(Math.expm1((1.0 / (n * x))));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (-1.0 - (-1.0 / n))) / n tmp = 0 if (1.0 / n) <= -5e-88: tmp = t_0 elif (1.0 / n) <= 5e-101: tmp = math.log((x / (x + 1.0))) / -n elif (1.0 / n) <= 2e-33: tmp = ((0.3333333333333333 / math.pow(x, 3.0)) + ((1.0 / x) - (0.5 / math.pow(x, 2.0)))) / n elif (1.0 / n) <= 1e-18: tmp = ((n * x) - (n * math.log(x))) / (n * n) elif (1.0 / n) <= 200000.0: tmp = t_0 elif (1.0 / n) <= 2e+78: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = math.log1p(math.expm1((1.0 / (n * x)))) return tmp
function code(x, n) t_0 = Float64((x ^ Float64(-1.0 - Float64(-1.0 / n))) / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-88) tmp = t_0; elseif (Float64(1.0 / n) <= 5e-101) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 2e-33) tmp = Float64(Float64(Float64(0.3333333333333333 / (x ^ 3.0)) + Float64(Float64(1.0 / x) - Float64(0.5 / (x ^ 2.0)))) / n); elseif (Float64(1.0 / n) <= 1e-18) tmp = Float64(Float64(Float64(n * x) - Float64(n * log(x))) / Float64(n * n)); elseif (Float64(1.0 / n) <= 200000.0) tmp = t_0; elseif (Float64(1.0 / n) <= 2e+78) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = log1p(expm1(Float64(1.0 / Float64(n * x)))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Power[x, N[(-1.0 - N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-88], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-101], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-33], 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], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-18], N[(N[(N[(n * x), $MachinePrecision] - N[(n * N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 200000.0], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+78], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Log[1 + N[(Exp[N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{x}^{\left(-1 - \frac{-1}{n}\right)}}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-88}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-101}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-33}:\\
\;\;\;\;\frac{\frac{0.3333333333333333}{{x}^{3}} + \left(\frac{1}{x} - \frac{0.5}{{x}^{2}}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-18}:\\
\;\;\;\;\frac{n \cdot x - n \cdot \log x}{n \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 200000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+78}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{n \cdot x}\right)\right)\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000009e-88 or 1.0000000000000001e-18 < (/.f64 1 n) < 2e5Initial program 70.2%
Taylor expanded in x around inf 89.4%
log-rec89.4%
mul-1-neg89.4%
associate-*r/89.4%
associate-*r*89.4%
metadata-eval89.4%
*-commutative89.4%
associate-/l*89.5%
exp-to-pow89.5%
*-commutative89.5%
Simplified89.5%
add089.5%
associate-/r*90.5%
pow190.5%
pow-div90.1%
Applied egg-rr90.1%
add090.1%
sub-neg90.1%
metadata-eval90.1%
Simplified90.1%
if -5.00000000000000009e-88 < (/.f64 1 n) < 5.0000000000000001e-101Initial program 38.2%
Taylor expanded in n around inf 90.1%
log1p-define90.1%
Simplified90.1%
log1p-undefine90.1%
diff-log90.2%
Applied egg-rr90.2%
clear-num90.2%
log-rec90.3%
Applied egg-rr90.3%
if 5.0000000000000001e-101 < (/.f64 1 n) < 2.0000000000000001e-33Initial program 4.6%
Taylor expanded in n around inf 39.1%
log1p-define39.1%
Simplified39.1%
Taylor expanded in x around inf 71.4%
associate--l+71.4%
associate-*r/71.4%
metadata-eval71.4%
associate-*r/71.4%
metadata-eval71.4%
Simplified71.4%
if 2.0000000000000001e-33 < (/.f64 1 n) < 1.0000000000000001e-18Initial program 8.2%
Taylor expanded in n around inf 99.6%
log1p-define99.6%
Simplified99.6%
Taylor expanded in x around 0 99.6%
associate-*r/99.6%
log-pow99.6%
inv-pow99.6%
neg-log99.6%
frac-2neg99.6%
frac-add100.0%
Applied egg-rr100.0%
if 2e5 < (/.f64 1 n) < 2.00000000000000002e78Initial program 100.0%
Taylor expanded in x around 0 100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
Simplified100.0%
if 2.00000000000000002e78 < (/.f64 1 n) Initial program 26.1%
Taylor expanded in n around inf 5.9%
log1p-define5.9%
Simplified5.9%
Taylor expanded in x around inf 35.4%
*-commutative35.4%
Simplified35.4%
log1p-expm1-u79.6%
Applied egg-rr79.6%
Final simplification88.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))) (t_1 (/ (pow x (- -1.0 (/ -1.0 n))) n)))
(if (<= (/ 1.0 n) -5e-88)
t_1
(if (<= (/ 1.0 n) 5e-101)
(/ (log t_0) (- n))
(if (<= (/ 1.0 n) 2e-39)
(/ (- (/ 1.0 x) (/ 0.5 (pow x 2.0))) n)
(if (<= (/ 1.0 n) 1e-18)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 200000.0)
t_1
(if (<= (/ 1.0 n) 2e+78)
(- 1.0 (pow x (/ 1.0 n)))
(/ (log1p (+ -1.0 t_0)) (- n))))))))))
double code(double x, double n) {
double t_0 = x / (x + 1.0);
double t_1 = pow(x, (-1.0 - (-1.0 / n))) / n;
double tmp;
if ((1.0 / n) <= -5e-88) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-101) {
tmp = log(t_0) / -n;
} else if ((1.0 / n) <= 2e-39) {
tmp = ((1.0 / x) - (0.5 / pow(x, 2.0))) / n;
} else if ((1.0 / n) <= 1e-18) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 200000.0) {
tmp = t_1;
} else if ((1.0 / n) <= 2e+78) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = log1p((-1.0 + t_0)) / -n;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = x / (x + 1.0);
double t_1 = Math.pow(x, (-1.0 - (-1.0 / n))) / n;
double tmp;
if ((1.0 / n) <= -5e-88) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-101) {
tmp = Math.log(t_0) / -n;
} else if ((1.0 / n) <= 2e-39) {
tmp = ((1.0 / x) - (0.5 / Math.pow(x, 2.0))) / n;
} else if ((1.0 / n) <= 1e-18) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 200000.0) {
tmp = t_1;
} else if ((1.0 / n) <= 2e+78) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = Math.log1p((-1.0 + t_0)) / -n;
}
return tmp;
}
def code(x, n): t_0 = x / (x + 1.0) t_1 = math.pow(x, (-1.0 - (-1.0 / n))) / n tmp = 0 if (1.0 / n) <= -5e-88: tmp = t_1 elif (1.0 / n) <= 5e-101: tmp = math.log(t_0) / -n elif (1.0 / n) <= 2e-39: tmp = ((1.0 / x) - (0.5 / math.pow(x, 2.0))) / n elif (1.0 / n) <= 1e-18: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 200000.0: tmp = t_1 elif (1.0 / n) <= 2e+78: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = math.log1p((-1.0 + t_0)) / -n return tmp
function code(x, n) t_0 = Float64(x / Float64(x + 1.0)) t_1 = Float64((x ^ Float64(-1.0 - Float64(-1.0 / n))) / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-88) tmp = t_1; elseif (Float64(1.0 / n) <= 5e-101) tmp = Float64(log(t_0) / Float64(-n)); elseif (Float64(1.0 / n) <= 2e-39) tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / (x ^ 2.0))) / n); elseif (Float64(1.0 / n) <= 1e-18) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 200000.0) tmp = t_1; elseif (Float64(1.0 / n) <= 2e+78) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(log1p(Float64(-1.0 + t_0)) / Float64(-n)); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[x, N[(-1.0 - N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-88], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-101], N[(N[Log[t$95$0], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-39], 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], 1e-18], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 200000.0], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+78], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Log[1 + N[(-1.0 + t$95$0), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
t_1 := \frac{{x}^{\left(-1 - \frac{-1}{n}\right)}}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-88}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-101}:\\
\;\;\;\;\frac{\log t\_0}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-39}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{{x}^{2}}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-18}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 200000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+78}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(-1 + t\_0\right)}{-n}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000009e-88 or 1.0000000000000001e-18 < (/.f64 1 n) < 2e5Initial program 70.2%
Taylor expanded in x around inf 89.4%
log-rec89.4%
mul-1-neg89.4%
associate-*r/89.4%
associate-*r*89.4%
metadata-eval89.4%
*-commutative89.4%
associate-/l*89.5%
exp-to-pow89.5%
*-commutative89.5%
Simplified89.5%
add089.5%
associate-/r*90.5%
pow190.5%
pow-div90.1%
Applied egg-rr90.1%
add090.1%
sub-neg90.1%
metadata-eval90.1%
Simplified90.1%
if -5.00000000000000009e-88 < (/.f64 1 n) < 5.0000000000000001e-101Initial program 38.2%
Taylor expanded in n around inf 90.1%
log1p-define90.1%
Simplified90.1%
log1p-undefine90.1%
diff-log90.2%
Applied egg-rr90.2%
clear-num90.2%
log-rec90.3%
Applied egg-rr90.3%
if 5.0000000000000001e-101 < (/.f64 1 n) < 1.99999999999999986e-39Initial program 4.7%
Taylor expanded in n around inf 37.3%
log1p-define37.3%
Simplified37.3%
Taylor expanded in x around inf 72.9%
associate-*r/72.9%
metadata-eval72.9%
Simplified72.9%
if 1.99999999999999986e-39 < (/.f64 1 n) < 1.0000000000000001e-18Initial program 6.9%
Taylor expanded in n around inf 83.9%
log1p-define83.9%
Simplified83.9%
log1p-undefine83.9%
diff-log83.9%
Applied egg-rr83.9%
if 2e5 < (/.f64 1 n) < 2.00000000000000002e78Initial program 100.0%
Taylor expanded in x around 0 100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
Simplified100.0%
if 2.00000000000000002e78 < (/.f64 1 n) Initial program 26.1%
Taylor expanded in n around inf 5.9%
log1p-define5.9%
Simplified5.9%
log1p-undefine5.9%
diff-log5.9%
Applied egg-rr5.9%
clear-num5.9%
log-rec5.9%
Applied egg-rr5.9%
log1p-expm1-u74.5%
expm1-undefine74.5%
add-exp-log74.5%
+-commutative74.5%
Applied egg-rr74.5%
Final simplification88.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (log (/ x (+ x 1.0))) (- n))))
(if (<= n -2.8e+87)
t_1
(if (<= n -1400.0)
(/ (/ 1.0 n) x)
(if (<= n -3.2e-154)
t_0
(if (<= n -6.7e-276)
(/ 0.0 n)
(if (<= n 9.5e-224)
(/ 1.0 (* n x))
(if (<= n 1900000000.0) t_0 t_1))))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double t_1 = log((x / (x + 1.0))) / -n;
double tmp;
if (n <= -2.8e+87) {
tmp = t_1;
} else if (n <= -1400.0) {
tmp = (1.0 / n) / x;
} else if (n <= -3.2e-154) {
tmp = t_0;
} else if (n <= -6.7e-276) {
tmp = 0.0 / n;
} else if (n <= 9.5e-224) {
tmp = 1.0 / (n * x);
} else if (n <= 1900000000.0) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
t_1 = log((x / (x + 1.0d0))) / -n
if (n <= (-2.8d+87)) then
tmp = t_1
else if (n <= (-1400.0d0)) then
tmp = (1.0d0 / n) / x
else if (n <= (-3.2d-154)) then
tmp = t_0
else if (n <= (-6.7d-276)) then
tmp = 0.0d0 / n
else if (n <= 9.5d-224) then
tmp = 1.0d0 / (n * x)
else if (n <= 1900000000.0d0) then
tmp = t_0
else
tmp = t_1
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 t_1 = Math.log((x / (x + 1.0))) / -n;
double tmp;
if (n <= -2.8e+87) {
tmp = t_1;
} else if (n <= -1400.0) {
tmp = (1.0 / n) / x;
} else if (n <= -3.2e-154) {
tmp = t_0;
} else if (n <= -6.7e-276) {
tmp = 0.0 / n;
} else if (n <= 9.5e-224) {
tmp = 1.0 / (n * x);
} else if (n <= 1900000000.0) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) t_1 = math.log((x / (x + 1.0))) / -n tmp = 0 if n <= -2.8e+87: tmp = t_1 elif n <= -1400.0: tmp = (1.0 / n) / x elif n <= -3.2e-154: tmp = t_0 elif n <= -6.7e-276: tmp = 0.0 / n elif n <= 9.5e-224: tmp = 1.0 / (n * x) elif n <= 1900000000.0: tmp = t_0 else: tmp = t_1 return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) t_1 = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)) tmp = 0.0 if (n <= -2.8e+87) tmp = t_1; elseif (n <= -1400.0) tmp = Float64(Float64(1.0 / n) / x); elseif (n <= -3.2e-154) tmp = t_0; elseif (n <= -6.7e-276) tmp = Float64(0.0 / n); elseif (n <= 9.5e-224) tmp = Float64(1.0 / Float64(n * x)); elseif (n <= 1900000000.0) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); t_1 = log((x / (x + 1.0))) / -n; tmp = 0.0; if (n <= -2.8e+87) tmp = t_1; elseif (n <= -1400.0) tmp = (1.0 / n) / x; elseif (n <= -3.2e-154) tmp = t_0; elseif (n <= -6.7e-276) tmp = 0.0 / n; elseif (n <= 9.5e-224) tmp = 1.0 / (n * x); elseif (n <= 1900000000.0) tmp = t_0; else tmp = t_1; 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]}, Block[{t$95$1 = N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[n, -2.8e+87], t$95$1, If[LessEqual[n, -1400.0], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[n, -3.2e-154], t$95$0, If[LessEqual[n, -6.7e-276], N[(0.0 / n), $MachinePrecision], If[LessEqual[n, 9.5e-224], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1900000000.0], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{if}\;n \leq -2.8 \cdot 10^{+87}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;n \leq -1400:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{elif}\;n \leq -3.2 \cdot 10^{-154}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -6.7 \cdot 10^{-276}:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{elif}\;n \leq 9.5 \cdot 10^{-224}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;n \leq 1900000000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if n < -2.80000000000000015e87 or 1.9e9 < n Initial program 32.9%
Taylor expanded in n around inf 82.2%
log1p-define82.2%
Simplified82.2%
log1p-undefine82.2%
diff-log82.5%
Applied egg-rr82.5%
clear-num82.5%
log-rec82.6%
Applied egg-rr82.6%
if -2.80000000000000015e87 < n < -1400Initial program 12.8%
Taylor expanded in n around inf 36.9%
log1p-define36.9%
Simplified36.9%
log1p-undefine36.9%
diff-log37.2%
Applied egg-rr37.2%
clear-num37.2%
log-rec37.1%
Applied egg-rr37.1%
Taylor expanded in x around inf 64.2%
associate-/r*64.7%
Simplified64.7%
if -1400 < n < -3.20000000000000005e-154 or 9.5000000000000003e-224 < n < 1.9e9Initial program 80.6%
Taylor expanded in x around 0 58.2%
*-rgt-identity58.2%
associate-/l*58.2%
exp-to-pow58.2%
Simplified58.2%
if -3.20000000000000005e-154 < n < -6.69999999999999983e-276Initial program 100.0%
Taylor expanded in n around inf 60.5%
log1p-define60.5%
Simplified60.5%
log1p-undefine60.5%
diff-log60.5%
Applied egg-rr60.5%
Taylor expanded in x around inf 67.2%
if -6.69999999999999983e-276 < n < 9.5000000000000003e-224Initial program 63.7%
Taylor expanded in n around inf 32.7%
log1p-define32.7%
Simplified32.7%
Taylor expanded in x around inf 69.6%
*-commutative69.6%
Simplified69.6%
Final simplification73.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (pow x (- -1.0 (/ -1.0 n))) n)))
(if (<= (/ 1.0 n) -5e-88)
t_0
(if (<= (/ 1.0 n) 2e-73)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 200000.0)
t_0
(if (<= (/ 1.0 n) 2e+233)
(- (+ 1.0 (/ x n)) (pow x (/ 1.0 n)))
(/ 1.0 (* n x))))))))
double code(double x, double n) {
double t_0 = pow(x, (-1.0 - (-1.0 / n))) / n;
double tmp;
if ((1.0 / n) <= -5e-88) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-73) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 200000.0) {
tmp = t_0;
} else if ((1.0 / n) <= 2e+233) {
tmp = (1.0 + (x / n)) - pow(x, (1.0 / n));
} 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) - ((-1.0d0) / n))) / n
if ((1.0d0 / n) <= (-5d-88)) then
tmp = t_0
else if ((1.0d0 / n) <= 2d-73) then
tmp = log((x / (x + 1.0d0))) / -n
else if ((1.0d0 / n) <= 200000.0d0) then
tmp = t_0
else if ((1.0d0 / n) <= 2d+233) then
tmp = (1.0d0 + (x / n)) - (x ** (1.0d0 / n))
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 - (-1.0 / n))) / n;
double tmp;
if ((1.0 / n) <= -5e-88) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-73) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 200000.0) {
tmp = t_0;
} else if ((1.0 / n) <= 2e+233) {
tmp = (1.0 + (x / n)) - Math.pow(x, (1.0 / n));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (-1.0 - (-1.0 / n))) / n tmp = 0 if (1.0 / n) <= -5e-88: tmp = t_0 elif (1.0 / n) <= 2e-73: tmp = math.log((x / (x + 1.0))) / -n elif (1.0 / n) <= 200000.0: tmp = t_0 elif (1.0 / n) <= 2e+233: tmp = (1.0 + (x / n)) - math.pow(x, (1.0 / n)) else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = Float64((x ^ Float64(-1.0 - Float64(-1.0 / n))) / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-88) tmp = t_0; elseif (Float64(1.0 / n) <= 2e-73) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 200000.0) tmp = t_0; elseif (Float64(1.0 / n) <= 2e+233) tmp = Float64(Float64(1.0 + Float64(x / n)) - (x ^ Float64(1.0 / n))); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = (x ^ (-1.0 - (-1.0 / n))) / n; tmp = 0.0; if ((1.0 / n) <= -5e-88) tmp = t_0; elseif ((1.0 / n) <= 2e-73) tmp = log((x / (x + 1.0))) / -n; elseif ((1.0 / n) <= 200000.0) tmp = t_0; elseif ((1.0 / n) <= 2e+233) tmp = (1.0 + (x / n)) - (x ^ (1.0 / n)); else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Power[x, N[(-1.0 - N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-88], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-73], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 200000.0], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+233], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{x}^{\left(-1 - \frac{-1}{n}\right)}}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-88}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-73}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 200000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+233}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000009e-88 or 1.99999999999999999e-73 < (/.f64 1 n) < 2e5Initial program 62.1%
Taylor expanded in x around inf 85.3%
log-rec85.3%
mul-1-neg85.3%
associate-*r/85.3%
associate-*r*85.3%
metadata-eval85.3%
*-commutative85.3%
associate-/l*85.4%
exp-to-pow85.4%
*-commutative85.4%
Simplified85.4%
add085.4%
associate-/r*86.3%
pow186.3%
pow-div85.9%
Applied egg-rr85.9%
add085.9%
sub-neg85.9%
metadata-eval85.9%
Simplified85.9%
if -5.00000000000000009e-88 < (/.f64 1 n) < 1.99999999999999999e-73Initial program 36.2%
Taylor expanded in n around inf 87.9%
log1p-define87.9%
Simplified87.9%
log1p-undefine87.9%
diff-log88.1%
Applied egg-rr88.1%
clear-num88.1%
log-rec88.1%
Applied egg-rr88.1%
if 2e5 < (/.f64 1 n) < 1.99999999999999995e233Initial program 62.6%
Taylor expanded in x around 0 60.6%
if 1.99999999999999995e233 < (/.f64 1 n) Initial program 3.1%
Taylor expanded in n around inf 8.7%
log1p-define8.7%
Simplified8.7%
Taylor expanded in x around inf 85.1%
*-commutative85.1%
Simplified85.1%
Final simplification84.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))) (t_1 (/ (pow x (- -1.0 (/ -1.0 n))) n)))
(if (<= (/ 1.0 n) -5e-88)
t_1
(if (<= (/ 1.0 n) 2e-73)
(/ (log t_0) (- n))
(if (<= (/ 1.0 n) 200000.0)
t_1
(if (<= (/ 1.0 n) 2e+78)
(- 1.0 (pow x (/ 1.0 n)))
(/ (log1p (+ -1.0 t_0)) (- n))))))))
double code(double x, double n) {
double t_0 = x / (x + 1.0);
double t_1 = pow(x, (-1.0 - (-1.0 / n))) / n;
double tmp;
if ((1.0 / n) <= -5e-88) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-73) {
tmp = log(t_0) / -n;
} else if ((1.0 / n) <= 200000.0) {
tmp = t_1;
} else if ((1.0 / n) <= 2e+78) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = log1p((-1.0 + t_0)) / -n;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = x / (x + 1.0);
double t_1 = Math.pow(x, (-1.0 - (-1.0 / n))) / n;
double tmp;
if ((1.0 / n) <= -5e-88) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-73) {
tmp = Math.log(t_0) / -n;
} else if ((1.0 / n) <= 200000.0) {
tmp = t_1;
} else if ((1.0 / n) <= 2e+78) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = Math.log1p((-1.0 + t_0)) / -n;
}
return tmp;
}
def code(x, n): t_0 = x / (x + 1.0) t_1 = math.pow(x, (-1.0 - (-1.0 / n))) / n tmp = 0 if (1.0 / n) <= -5e-88: tmp = t_1 elif (1.0 / n) <= 2e-73: tmp = math.log(t_0) / -n elif (1.0 / n) <= 200000.0: tmp = t_1 elif (1.0 / n) <= 2e+78: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = math.log1p((-1.0 + t_0)) / -n return tmp
function code(x, n) t_0 = Float64(x / Float64(x + 1.0)) t_1 = Float64((x ^ Float64(-1.0 - Float64(-1.0 / n))) / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-88) tmp = t_1; elseif (Float64(1.0 / n) <= 2e-73) tmp = Float64(log(t_0) / Float64(-n)); elseif (Float64(1.0 / n) <= 200000.0) tmp = t_1; elseif (Float64(1.0 / n) <= 2e+78) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(log1p(Float64(-1.0 + t_0)) / Float64(-n)); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[x, N[(-1.0 - N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-88], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-73], N[(N[Log[t$95$0], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 200000.0], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+78], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Log[1 + N[(-1.0 + t$95$0), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
t_1 := \frac{{x}^{\left(-1 - \frac{-1}{n}\right)}}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-88}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-73}:\\
\;\;\;\;\frac{\log t\_0}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 200000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+78}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(-1 + t\_0\right)}{-n}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000009e-88 or 1.99999999999999999e-73 < (/.f64 1 n) < 2e5Initial program 62.1%
Taylor expanded in x around inf 85.3%
log-rec85.3%
mul-1-neg85.3%
associate-*r/85.3%
associate-*r*85.3%
metadata-eval85.3%
*-commutative85.3%
associate-/l*85.4%
exp-to-pow85.4%
*-commutative85.4%
Simplified85.4%
add085.4%
associate-/r*86.3%
pow186.3%
pow-div85.9%
Applied egg-rr85.9%
add085.9%
sub-neg85.9%
metadata-eval85.9%
Simplified85.9%
if -5.00000000000000009e-88 < (/.f64 1 n) < 1.99999999999999999e-73Initial program 36.2%
Taylor expanded in n around inf 87.9%
log1p-define87.9%
Simplified87.9%
log1p-undefine87.9%
diff-log88.1%
Applied egg-rr88.1%
clear-num88.1%
log-rec88.1%
Applied egg-rr88.1%
if 2e5 < (/.f64 1 n) < 2.00000000000000002e78Initial program 100.0%
Taylor expanded in x around 0 100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
Simplified100.0%
if 2.00000000000000002e78 < (/.f64 1 n) Initial program 26.1%
Taylor expanded in n around inf 5.9%
log1p-define5.9%
Simplified5.9%
log1p-undefine5.9%
diff-log5.9%
Applied egg-rr5.9%
clear-num5.9%
log-rec5.9%
Applied egg-rr5.9%
log1p-expm1-u74.5%
expm1-undefine74.5%
add-exp-log74.5%
+-commutative74.5%
Applied egg-rr74.5%
Final simplification86.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (log (/ (+ x 1.0) x)) n)))
(if (<= n -1.6e+87)
t_1
(if (<= n -1400.0)
(/ (/ 1.0 n) x)
(if (<= n -2.6e-146)
t_0
(if (<= n -3.7e-276)
(/ 0.0 n)
(if (<= n 2.4e-218)
(/ 1.0 (* n x))
(if (<= n 1800000000.0) t_0 t_1))))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double t_1 = log(((x + 1.0) / x)) / n;
double tmp;
if (n <= -1.6e+87) {
tmp = t_1;
} else if (n <= -1400.0) {
tmp = (1.0 / n) / x;
} else if (n <= -2.6e-146) {
tmp = t_0;
} else if (n <= -3.7e-276) {
tmp = 0.0 / n;
} else if (n <= 2.4e-218) {
tmp = 1.0 / (n * x);
} else if (n <= 1800000000.0) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
t_1 = log(((x + 1.0d0) / x)) / n
if (n <= (-1.6d+87)) then
tmp = t_1
else if (n <= (-1400.0d0)) then
tmp = (1.0d0 / n) / x
else if (n <= (-2.6d-146)) then
tmp = t_0
else if (n <= (-3.7d-276)) then
tmp = 0.0d0 / n
else if (n <= 2.4d-218) then
tmp = 1.0d0 / (n * x)
else if (n <= 1800000000.0d0) then
tmp = t_0
else
tmp = t_1
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 t_1 = Math.log(((x + 1.0) / x)) / n;
double tmp;
if (n <= -1.6e+87) {
tmp = t_1;
} else if (n <= -1400.0) {
tmp = (1.0 / n) / x;
} else if (n <= -2.6e-146) {
tmp = t_0;
} else if (n <= -3.7e-276) {
tmp = 0.0 / n;
} else if (n <= 2.4e-218) {
tmp = 1.0 / (n * x);
} else if (n <= 1800000000.0) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) t_1 = math.log(((x + 1.0) / x)) / n tmp = 0 if n <= -1.6e+87: tmp = t_1 elif n <= -1400.0: tmp = (1.0 / n) / x elif n <= -2.6e-146: tmp = t_0 elif n <= -3.7e-276: tmp = 0.0 / n elif n <= 2.4e-218: tmp = 1.0 / (n * x) elif n <= 1800000000.0: tmp = t_0 else: tmp = t_1 return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) t_1 = Float64(log(Float64(Float64(x + 1.0) / x)) / n) tmp = 0.0 if (n <= -1.6e+87) tmp = t_1; elseif (n <= -1400.0) tmp = Float64(Float64(1.0 / n) / x); elseif (n <= -2.6e-146) tmp = t_0; elseif (n <= -3.7e-276) tmp = Float64(0.0 / n); elseif (n <= 2.4e-218) tmp = Float64(1.0 / Float64(n * x)); elseif (n <= 1800000000.0) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); t_1 = log(((x + 1.0) / x)) / n; tmp = 0.0; if (n <= -1.6e+87) tmp = t_1; elseif (n <= -1400.0) tmp = (1.0 / n) / x; elseif (n <= -2.6e-146) tmp = t_0; elseif (n <= -3.7e-276) tmp = 0.0 / n; elseif (n <= 2.4e-218) tmp = 1.0 / (n * x); elseif (n <= 1800000000.0) tmp = t_0; else tmp = t_1; 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]}, Block[{t$95$1 = N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[n, -1.6e+87], t$95$1, If[LessEqual[n, -1400.0], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[n, -2.6e-146], t$95$0, If[LessEqual[n, -3.7e-276], N[(0.0 / n), $MachinePrecision], If[LessEqual[n, 2.4e-218], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1800000000.0], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{if}\;n \leq -1.6 \cdot 10^{+87}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;n \leq -1400:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{elif}\;n \leq -2.6 \cdot 10^{-146}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -3.7 \cdot 10^{-276}:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{elif}\;n \leq 2.4 \cdot 10^{-218}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;n \leq 1800000000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if n < -1.6e87 or 1.8e9 < n Initial program 32.9%
Taylor expanded in n around inf 82.2%
log1p-define82.2%
Simplified82.2%
log1p-undefine82.2%
diff-log82.5%
Applied egg-rr82.5%
if -1.6e87 < n < -1400Initial program 12.8%
Taylor expanded in n around inf 36.9%
log1p-define36.9%
Simplified36.9%
log1p-undefine36.9%
diff-log37.2%
Applied egg-rr37.2%
clear-num37.2%
log-rec37.1%
Applied egg-rr37.1%
Taylor expanded in x around inf 64.2%
associate-/r*64.7%
Simplified64.7%
if -1400 < n < -2.59999999999999987e-146 or 2.4000000000000001e-218 < n < 1.8e9Initial program 80.6%
Taylor expanded in x around 0 58.2%
*-rgt-identity58.2%
associate-/l*58.2%
exp-to-pow58.2%
Simplified58.2%
if -2.59999999999999987e-146 < n < -3.7e-276Initial program 100.0%
Taylor expanded in n around inf 60.5%
log1p-define60.5%
Simplified60.5%
log1p-undefine60.5%
diff-log60.5%
Applied egg-rr60.5%
Taylor expanded in x around inf 67.2%
if -3.7e-276 < n < 2.4000000000000001e-218Initial program 63.7%
Taylor expanded in n around inf 32.7%
log1p-define32.7%
Simplified32.7%
Taylor expanded in x around inf 69.6%
*-commutative69.6%
Simplified69.6%
Final simplification73.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (pow x (- -1.0 (/ -1.0 n))) n)))
(if (<= (/ 1.0 n) -5e-88)
t_0
(if (<= (/ 1.0 n) 2e-73)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 200000.0)
t_0
(if (<= (/ 1.0 n) 5e+211)
(- 1.0 (pow x (/ 1.0 n)))
(/ 1.0 (* n x))))))))
double code(double x, double n) {
double t_0 = pow(x, (-1.0 - (-1.0 / n))) / n;
double tmp;
if ((1.0 / n) <= -5e-88) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-73) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 200000.0) {
tmp = t_0;
} else if ((1.0 / n) <= 5e+211) {
tmp = 1.0 - pow(x, (1.0 / n));
} 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) - ((-1.0d0) / n))) / n
if ((1.0d0 / n) <= (-5d-88)) then
tmp = t_0
else if ((1.0d0 / n) <= 2d-73) then
tmp = log((x / (x + 1.0d0))) / -n
else if ((1.0d0 / n) <= 200000.0d0) then
tmp = t_0
else if ((1.0d0 / n) <= 5d+211) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
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 - (-1.0 / n))) / n;
double tmp;
if ((1.0 / n) <= -5e-88) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-73) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 200000.0) {
tmp = t_0;
} else if ((1.0 / n) <= 5e+211) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (-1.0 - (-1.0 / n))) / n tmp = 0 if (1.0 / n) <= -5e-88: tmp = t_0 elif (1.0 / n) <= 2e-73: tmp = math.log((x / (x + 1.0))) / -n elif (1.0 / n) <= 200000.0: tmp = t_0 elif (1.0 / n) <= 5e+211: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = Float64((x ^ Float64(-1.0 - Float64(-1.0 / n))) / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-88) tmp = t_0; elseif (Float64(1.0 / n) <= 2e-73) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 200000.0) tmp = t_0; elseif (Float64(1.0 / n) <= 5e+211) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = (x ^ (-1.0 - (-1.0 / n))) / n; tmp = 0.0; if ((1.0 / n) <= -5e-88) tmp = t_0; elseif ((1.0 / n) <= 2e-73) tmp = log((x / (x + 1.0))) / -n; elseif ((1.0 / n) <= 200000.0) tmp = t_0; elseif ((1.0 / n) <= 5e+211) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Power[x, N[(-1.0 - N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-88], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-73], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 200000.0], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+211], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{x}^{\left(-1 - \frac{-1}{n}\right)}}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-88}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-73}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 200000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+211}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000009e-88 or 1.99999999999999999e-73 < (/.f64 1 n) < 2e5Initial program 62.1%
Taylor expanded in x around inf 85.3%
log-rec85.3%
mul-1-neg85.3%
associate-*r/85.3%
associate-*r*85.3%
metadata-eval85.3%
*-commutative85.3%
associate-/l*85.4%
exp-to-pow85.4%
*-commutative85.4%
Simplified85.4%
add085.4%
associate-/r*86.3%
pow186.3%
pow-div85.9%
Applied egg-rr85.9%
add085.9%
sub-neg85.9%
metadata-eval85.9%
Simplified85.9%
if -5.00000000000000009e-88 < (/.f64 1 n) < 1.99999999999999999e-73Initial program 36.2%
Taylor expanded in n around inf 87.9%
log1p-define87.9%
Simplified87.9%
log1p-undefine87.9%
diff-log88.1%
Applied egg-rr88.1%
clear-num88.1%
log-rec88.1%
Applied egg-rr88.1%
if 2e5 < (/.f64 1 n) < 4.9999999999999995e211Initial program 64.2%
Taylor expanded in x around 0 59.4%
*-rgt-identity59.4%
associate-/l*59.4%
exp-to-pow59.4%
Simplified59.4%
if 4.9999999999999995e211 < (/.f64 1 n) Initial program 13.8%
Taylor expanded in n around inf 7.8%
log1p-define7.8%
Simplified7.8%
Taylor expanded in x around inf 76.7%
*-commutative76.7%
Simplified76.7%
Final simplification84.6%
(FPCore (x n)
:precision binary64
(if (<= x 2.5e-247)
(/ (log x) (- n))
(if (<= x 2.5e-230)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 2.05e-7)
(/ (- x (log x)) n)
(if (<= x 9e+182) (/ (/ 1.0 n) x) (/ 0.0 n))))))
double code(double x, double n) {
double tmp;
if (x <= 2.5e-247) {
tmp = log(x) / -n;
} else if (x <= 2.5e-230) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 2.05e-7) {
tmp = (x - log(x)) / n;
} else if (x <= 9e+182) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0 / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 2.5d-247) then
tmp = log(x) / -n
else if (x <= 2.5d-230) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 2.05d-7) then
tmp = (x - log(x)) / n
else if (x <= 9d+182) then
tmp = (1.0d0 / n) / x
else
tmp = 0.0d0 / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 2.5e-247) {
tmp = Math.log(x) / -n;
} else if (x <= 2.5e-230) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 2.05e-7) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 9e+182) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2.5e-247: tmp = math.log(x) / -n elif x <= 2.5e-230: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 2.05e-7: tmp = (x - math.log(x)) / n elif x <= 9e+182: tmp = (1.0 / n) / x else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 2.5e-247) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 2.5e-230) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 2.05e-7) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 9e+182) tmp = Float64(Float64(1.0 / n) / x); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 2.5e-247) tmp = log(x) / -n; elseif (x <= 2.5e-230) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 2.05e-7) tmp = (x - log(x)) / n; elseif (x <= 9e+182) tmp = (1.0 / n) / x; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2.5e-247], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 2.5e-230], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.05e-7], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 9e+182], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.5 \cdot 10^{-247}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-230}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{-7}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+182}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 2.49999999999999989e-247Initial program 27.4%
Taylor expanded in n around inf 81.4%
log1p-define81.4%
Simplified81.4%
Taylor expanded in x around 0 81.4%
neg-mul-181.4%
Simplified81.4%
if 2.49999999999999989e-247 < x < 2.50000000000000017e-230Initial program 84.8%
Taylor expanded in x around 0 84.8%
*-rgt-identity84.8%
associate-/l*84.8%
exp-to-pow84.8%
Simplified84.8%
if 2.50000000000000017e-230 < x < 2.05e-7Initial program 36.9%
Taylor expanded in n around inf 54.9%
log1p-define54.9%
Simplified54.9%
Taylor expanded in x around 0 54.9%
neg-mul-154.9%
sub-neg54.9%
Simplified54.9%
if 2.05e-7 < x < 9.00000000000000058e182Initial program 48.8%
Taylor expanded in n around inf 46.5%
log1p-define46.5%
Simplified46.5%
log1p-undefine46.5%
diff-log47.0%
Applied egg-rr47.0%
clear-num47.0%
log-rec47.2%
Applied egg-rr47.2%
Taylor expanded in x around inf 63.4%
associate-/r*65.3%
Simplified65.3%
if 9.00000000000000058e182 < x Initial program 83.9%
Taylor expanded in n around inf 83.9%
log1p-define83.9%
Simplified83.9%
log1p-undefine83.9%
diff-log83.9%
Applied egg-rr83.9%
Taylor expanded in x around inf 83.9%
Final simplification67.1%
(FPCore (x n) :precision binary64 (if (<= x 2.05e-7) (/ (- x (log x)) n) (if (<= x 4.1e+185) (/ (/ 1.0 n) x) (/ 0.0 n))))
double code(double x, double n) {
double tmp;
if (x <= 2.05e-7) {
tmp = (x - log(x)) / n;
} else if (x <= 4.1e+185) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0 / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 2.05d-7) then
tmp = (x - log(x)) / n
else if (x <= 4.1d+185) then
tmp = (1.0d0 / n) / x
else
tmp = 0.0d0 / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 2.05e-7) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 4.1e+185) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2.05e-7: tmp = (x - math.log(x)) / n elif x <= 4.1e+185: tmp = (1.0 / n) / x else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 2.05e-7) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 4.1e+185) tmp = Float64(Float64(1.0 / n) / x); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 2.05e-7) tmp = (x - log(x)) / n; elseif (x <= 4.1e+185) tmp = (1.0 / n) / x; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2.05e-7], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 4.1e+185], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.05 \cdot 10^{-7}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{+185}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 2.05e-7Initial program 37.3%
Taylor expanded in n around inf 59.0%
log1p-define59.0%
Simplified59.0%
Taylor expanded in x around 0 59.0%
neg-mul-159.0%
sub-neg59.0%
Simplified59.0%
if 2.05e-7 < x < 4.1e185Initial program 48.8%
Taylor expanded in n around inf 46.5%
log1p-define46.5%
Simplified46.5%
log1p-undefine46.5%
diff-log47.0%
Applied egg-rr47.0%
clear-num47.0%
log-rec47.2%
Applied egg-rr47.2%
Taylor expanded in x around inf 63.4%
associate-/r*65.3%
Simplified65.3%
if 4.1e185 < x Initial program 83.9%
Taylor expanded in n around inf 83.9%
log1p-define83.9%
Simplified83.9%
log1p-undefine83.9%
diff-log83.9%
Applied egg-rr83.9%
Taylor expanded in x around inf 83.9%
Final simplification65.3%
(FPCore (x n) :precision binary64 (if (<= x 2.05e-7) (/ (log x) (- n)) (if (<= x 7.8e+181) (/ (/ 1.0 n) x) (/ 0.0 n))))
double code(double x, double n) {
double tmp;
if (x <= 2.05e-7) {
tmp = log(x) / -n;
} else if (x <= 7.8e+181) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0 / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 2.05d-7) then
tmp = log(x) / -n
else if (x <= 7.8d+181) then
tmp = (1.0d0 / n) / x
else
tmp = 0.0d0 / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 2.05e-7) {
tmp = Math.log(x) / -n;
} else if (x <= 7.8e+181) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2.05e-7: tmp = math.log(x) / -n elif x <= 7.8e+181: tmp = (1.0 / n) / x else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 2.05e-7) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 7.8e+181) tmp = Float64(Float64(1.0 / n) / x); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 2.05e-7) tmp = log(x) / -n; elseif (x <= 7.8e+181) tmp = (1.0 / n) / x; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2.05e-7], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 7.8e+181], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.05 \cdot 10^{-7}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 7.8 \cdot 10^{+181}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 2.05e-7Initial program 37.3%
Taylor expanded in n around inf 59.0%
log1p-define59.0%
Simplified59.0%
Taylor expanded in x around 0 58.4%
neg-mul-158.4%
Simplified58.4%
if 2.05e-7 < x < 7.8e181Initial program 48.8%
Taylor expanded in n around inf 46.5%
log1p-define46.5%
Simplified46.5%
log1p-undefine46.5%
diff-log47.0%
Applied egg-rr47.0%
clear-num47.0%
log-rec47.2%
Applied egg-rr47.2%
Taylor expanded in x around inf 63.4%
associate-/r*65.3%
Simplified65.3%
if 7.8e181 < x Initial program 83.9%
Taylor expanded in n around inf 83.9%
log1p-define83.9%
Simplified83.9%
log1p-undefine83.9%
diff-log83.9%
Applied egg-rr83.9%
Taylor expanded in x around inf 83.9%
Final simplification65.0%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -2e+14) (/ 0.0 n) (/ (/ 1.0 n) x)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e+14) {
tmp = 0.0 / n;
} 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) :: tmp
if ((1.0d0 / n) <= (-2d+14)) then
tmp = 0.0d0 / n
else
tmp = (1.0d0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e+14) {
tmp = 0.0 / n;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -2e+14: tmp = 0.0 / n else: tmp = (1.0 / n) / x return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -2e+14) tmp = Float64(0.0 / n); else tmp = Float64(Float64(1.0 / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -2e+14) tmp = 0.0 / n; else tmp = (1.0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+14], N[(0.0 / n), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{+14}:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e14Initial program 100.0%
Taylor expanded in n around inf 49.6%
log1p-define49.6%
Simplified49.6%
log1p-undefine49.6%
diff-log49.6%
Applied egg-rr49.6%
Taylor expanded in x around inf 50.8%
if -2e14 < (/.f64 1 n) Initial program 32.7%
Taylor expanded in n around inf 63.0%
log1p-define63.0%
Simplified63.0%
log1p-undefine63.0%
diff-log63.2%
Applied egg-rr63.2%
clear-num63.2%
log-rec63.3%
Applied egg-rr63.3%
Taylor expanded in x around inf 46.0%
associate-/r*46.9%
Simplified46.9%
Final simplification47.8%
(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 49.0%
Taylor expanded in n around inf 59.8%
log1p-define59.8%
Simplified59.8%
Taylor expanded in x around inf 41.1%
*-commutative41.1%
Simplified41.1%
Final simplification41.1%
(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 49.0%
Taylor expanded in n around inf 59.8%
log1p-define59.8%
Simplified59.8%
log1p-undefine59.8%
diff-log59.9%
Applied egg-rr59.9%
clear-num59.9%
log-rec60.0%
Applied egg-rr60.0%
Taylor expanded in x around inf 41.1%
associate-/r*41.8%
Simplified41.8%
Final simplification41.8%
(FPCore (x n) :precision binary64 (/ x n))
double code(double x, double n) {
return x / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = x / n
end function
public static double code(double x, double n) {
return x / n;
}
def code(x, n): return x / n
function code(x, n) return Float64(x / n) end
function tmp = code(x, n) tmp = x / n; end
code[x_, n_] := N[(x / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{n}
\end{array}
Initial program 49.0%
Taylor expanded in x around 0 28.2%
Taylor expanded in x around inf 4.4%
Final simplification4.4%
herbie shell --seed 2024044
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))