
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -5e-65)
(/ (exp (/ (log x) n)) (* x n))
(if (<= (/ 1.0 n) 1e-13)
(/ (log (/ x (+ x 1.0))) (- n))
(exp (log (- (exp (/ (log1p x) n)) (pow x (/ 1.0 n))))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -5e-65) {
tmp = exp((log(x) / n)) / (x * n);
} else if ((1.0 / n) <= 1e-13) {
tmp = log((x / (x + 1.0))) / -n;
} else {
tmp = exp(log((exp((log1p(x) / n)) - pow(x, (1.0 / n)))));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -5e-65) {
tmp = Math.exp((Math.log(x) / n)) / (x * n);
} else if ((1.0 / n) <= 1e-13) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else {
tmp = Math.exp(Math.log((Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n)))));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -5e-65: tmp = math.exp((math.log(x) / n)) / (x * n) elif (1.0 / n) <= 1e-13: tmp = math.log((x / (x + 1.0))) / -n else: tmp = math.exp(math.log((math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n))))) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-65) tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n)); elseif (Float64(1.0 / n) <= 1e-13) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); else tmp = exp(log(Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))))); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-65], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-13], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], N[Exp[N[Log[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-65}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-13}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{else}:\\
\;\;\;\;e^{\log \left(e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.99999999999999983e-65Initial program 82.5%
Taylor expanded in x around inf 89.8%
mul-1-neg89.8%
log-rec89.8%
mul-1-neg89.8%
distribute-neg-frac89.8%
mul-1-neg89.8%
remove-double-neg89.8%
*-commutative89.8%
Simplified89.8%
if -4.99999999999999983e-65 < (/.f64 #s(literal 1 binary64) n) < 1e-13Initial program 30.3%
Taylor expanded in n around inf 80.7%
log1p-define80.7%
Simplified80.7%
log1p-undefine80.7%
diff-log80.8%
Applied egg-rr80.8%
+-commutative80.8%
Simplified80.8%
clear-num80.8%
log-div80.9%
metadata-eval80.9%
Applied egg-rr80.9%
neg-sub080.9%
Simplified80.9%
if 1e-13 < (/.f64 #s(literal 1 binary64) n) Initial program 65.1%
add-exp-log65.1%
pow-to-exp65.4%
un-div-inv65.4%
+-commutative65.4%
log1p-define96.9%
Applied egg-rr96.9%
Final simplification86.2%
(FPCore (x n)
:precision binary64
(if (<= x 5500000.0)
(/
(-
(+
(log1p x)
(/
(+
(* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0)))
(*
0.16666666666666666
(/ (- (pow (log1p x) 3.0) (pow (log x) 3.0)) n)))
n))
(log x))
n)
(/ (/ (pow x (/ 1.0 n)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 5500000.0) {
tmp = ((log1p(x) + (((0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0))) + (0.16666666666666666 * ((pow(log1p(x), 3.0) - pow(log(x), 3.0)) / n))) / n)) - log(x)) / n;
} else {
tmp = (pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if (x <= 5500000.0) {
tmp = ((Math.log1p(x) + (((0.5 * (Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0))) + (0.16666666666666666 * ((Math.pow(Math.log1p(x), 3.0) - Math.pow(Math.log(x), 3.0)) / n))) / n)) - Math.log(x)) / n;
} else {
tmp = (Math.pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 5500000.0: tmp = ((math.log1p(x) + (((0.5 * (math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0))) + (0.16666666666666666 * ((math.pow(math.log1p(x), 3.0) - math.pow(math.log(x), 3.0)) / n))) / n)) - math.log(x)) / n else: tmp = (math.pow(x, (1.0 / n)) / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 5500000.0) tmp = Float64(Float64(Float64(log1p(x) + Float64(Float64(Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) + Float64(0.16666666666666666 * Float64(Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0)) / n))) / n)) - log(x)) / n); else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / n) / x); end return tmp end
code[x_, n_] := If[LessEqual[x, 5500000.0], N[(N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5500000:\\
\;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + 0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}}{n}\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\
\end{array}
\end{array}
if x < 5.5e6Initial program 44.9%
Taylor expanded in n around -inf 76.9%
Simplified76.9%
if 5.5e6 < x Initial program 66.3%
Taylor expanded in x around inf 98.8%
associate-/r*99.5%
mul-1-neg99.5%
log-rec99.5%
mul-1-neg99.5%
distribute-neg-frac99.5%
mul-1-neg99.5%
remove-double-neg99.5%
*-rgt-identity99.5%
associate-/l*99.5%
exp-to-pow99.5%
Simplified99.5%
Final simplification86.2%
(FPCore (x n)
:precision binary64
(if (<= x 0.27)
(/
(-
(/
(+
(* -0.16666666666666666 (/ (pow (log x) 3.0) n))
(* (pow (log x) 2.0) -0.5))
n)
(log x))
n)
(/ (/ (pow x (/ 1.0 n)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 0.27) {
tmp = ((((-0.16666666666666666 * (pow(log(x), 3.0) / n)) + (pow(log(x), 2.0) * -0.5)) / n) - log(x)) / n;
} else {
tmp = (pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.27d0) then
tmp = (((((-0.16666666666666666d0) * ((log(x) ** 3.0d0) / n)) + ((log(x) ** 2.0d0) * (-0.5d0))) / n) - log(x)) / n
else
tmp = ((x ** (1.0d0 / n)) / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.27) {
tmp = ((((-0.16666666666666666 * (Math.pow(Math.log(x), 3.0) / n)) + (Math.pow(Math.log(x), 2.0) * -0.5)) / n) - Math.log(x)) / n;
} else {
tmp = (Math.pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.27: tmp = ((((-0.16666666666666666 * (math.pow(math.log(x), 3.0) / n)) + (math.pow(math.log(x), 2.0) * -0.5)) / n) - math.log(x)) / n else: tmp = (math.pow(x, (1.0 / n)) / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 0.27) tmp = Float64(Float64(Float64(Float64(Float64(-0.16666666666666666 * Float64((log(x) ^ 3.0) / n)) + Float64((log(x) ^ 2.0) * -0.5)) / n) - log(x)) / n); else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.27) tmp = ((((-0.16666666666666666 * ((log(x) ^ 3.0) / n)) + ((log(x) ^ 2.0) * -0.5)) / n) - log(x)) / n; else tmp = ((x ^ (1.0 / n)) / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.27], N[(N[(N[(N[(N[(-0.16666666666666666 * N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.27:\\
\;\;\;\;\frac{\frac{-0.16666666666666666 \cdot \frac{{\log x}^{3}}{n} + {\log x}^{2} \cdot -0.5}{n} - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\
\end{array}
\end{array}
if x < 0.27000000000000002Initial program 45.6%
Taylor expanded in x around 0 44.3%
*-rgt-identity44.3%
associate-*l/44.3%
associate-/l*44.3%
exp-to-pow44.3%
Simplified44.3%
Taylor expanded in n around -inf 76.4%
mul-1-neg76.4%
Simplified76.4%
if 0.27000000000000002 < x Initial program 64.4%
Taylor expanded in x around inf 96.3%
associate-/r*96.9%
mul-1-neg96.9%
log-rec96.9%
mul-1-neg96.9%
distribute-neg-frac96.9%
mul-1-neg96.9%
remove-double-neg96.9%
*-rgt-identity96.9%
associate-/l*96.9%
exp-to-pow96.9%
Simplified96.9%
Final simplification85.2%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -5e-65)
(/ (exp (/ (log x) n)) (* x n))
(if (<= (/ 1.0 n) 1e-13)
(/ (log (/ x (+ x 1.0))) (- n))
(- (exp (/ (log1p x) n)) (pow x (/ 1.0 n))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -5e-65) {
tmp = exp((log(x) / n)) / (x * n);
} else if ((1.0 / n) <= 1e-13) {
tmp = log((x / (x + 1.0))) / -n;
} else {
tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -5e-65) {
tmp = Math.exp((Math.log(x) / n)) / (x * n);
} else if ((1.0 / n) <= 1e-13) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -5e-65: tmp = math.exp((math.log(x) / n)) / (x * n) elif (1.0 / n) <= 1e-13: tmp = math.log((x / (x + 1.0))) / -n else: tmp = math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-65) tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n)); elseif (Float64(1.0 / n) <= 1e-13) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); else tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-65], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-13], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], 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}
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-65}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-13}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.99999999999999983e-65Initial program 82.5%
Taylor expanded in x around inf 89.8%
mul-1-neg89.8%
log-rec89.8%
mul-1-neg89.8%
distribute-neg-frac89.8%
mul-1-neg89.8%
remove-double-neg89.8%
*-commutative89.8%
Simplified89.8%
if -4.99999999999999983e-65 < (/.f64 #s(literal 1 binary64) n) < 1e-13Initial program 30.3%
Taylor expanded in n around inf 80.7%
log1p-define80.7%
Simplified80.7%
log1p-undefine80.7%
diff-log80.8%
Applied egg-rr80.8%
+-commutative80.8%
Simplified80.8%
clear-num80.8%
log-div80.9%
metadata-eval80.9%
Applied egg-rr80.9%
neg-sub080.9%
Simplified80.9%
if 1e-13 < (/.f64 #s(literal 1 binary64) n) Initial program 65.1%
Taylor expanded in n around 0 65.1%
log1p-define96.6%
*-rgt-identity96.6%
associate-*l/96.6%
associate-/l*96.6%
exp-to-pow96.9%
Simplified96.9%
Final simplification86.2%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -5e-65)
(/ (exp (/ (log x) n)) (* x n))
(if (<= (/ 1.0 n) 1e-13)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 4e+191)
(- (+ 1.0 (/ x n)) (pow x (/ 1.0 n)))
(log1p (expm1 (/ 1.0 (* x n))))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -5e-65) {
tmp = exp((log(x) / n)) / (x * n);
} else if ((1.0 / n) <= 1e-13) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 4e+191) {
tmp = (1.0 + (x / n)) - pow(x, (1.0 / n));
} else {
tmp = log1p(expm1((1.0 / (x * n))));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -5e-65) {
tmp = Math.exp((Math.log(x) / n)) / (x * n);
} else if ((1.0 / n) <= 1e-13) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 4e+191) {
tmp = (1.0 + (x / n)) - Math.pow(x, (1.0 / n));
} else {
tmp = Math.log1p(Math.expm1((1.0 / (x * n))));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -5e-65: tmp = math.exp((math.log(x) / n)) / (x * n) elif (1.0 / n) <= 1e-13: tmp = math.log((x / (x + 1.0))) / -n elif (1.0 / n) <= 4e+191: tmp = (1.0 + (x / n)) - math.pow(x, (1.0 / n)) else: tmp = math.log1p(math.expm1((1.0 / (x * n)))) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-65) tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n)); elseif (Float64(1.0 / n) <= 1e-13) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 4e+191) tmp = Float64(Float64(1.0 + Float64(x / n)) - (x ^ Float64(1.0 / n))); else tmp = log1p(expm1(Float64(1.0 / Float64(x * n)))); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-65], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-13], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+191], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Log[1 + N[(Exp[N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-65}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-13}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+191}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{x \cdot n}\right)\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.99999999999999983e-65Initial program 82.5%
Taylor expanded in x around inf 89.8%
mul-1-neg89.8%
log-rec89.8%
mul-1-neg89.8%
distribute-neg-frac89.8%
mul-1-neg89.8%
remove-double-neg89.8%
*-commutative89.8%
Simplified89.8%
if -4.99999999999999983e-65 < (/.f64 #s(literal 1 binary64) n) < 1e-13Initial program 30.3%
Taylor expanded in n around inf 80.7%
log1p-define80.7%
Simplified80.7%
log1p-undefine80.7%
diff-log80.8%
Applied egg-rr80.8%
+-commutative80.8%
Simplified80.8%
clear-num80.8%
log-div80.9%
metadata-eval80.9%
Applied egg-rr80.9%
neg-sub080.9%
Simplified80.9%
if 1e-13 < (/.f64 #s(literal 1 binary64) n) < 4.00000000000000029e191Initial program 75.8%
Taylor expanded in x around 0 72.2%
if 4.00000000000000029e191 < (/.f64 #s(literal 1 binary64) n) Initial program 35.4%
Taylor expanded in n around inf 6.7%
log1p-define6.7%
Simplified6.7%
log1p-undefine6.7%
diff-log6.7%
Applied egg-rr6.7%
+-commutative6.7%
Simplified6.7%
Taylor expanded in x around inf 57.7%
*-commutative57.7%
Simplified57.7%
log1p-expm1-u78.5%
Applied egg-rr78.5%
Final simplification83.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-65)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 1e-13)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 4e+191)
(- (+ 1.0 (/ x n)) t_0)
(log1p (expm1 (/ 1.0 (* x n)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-65) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 1e-13) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 4e+191) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = log1p(expm1((1.0 / (x * 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-65) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 1e-13) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 4e+191) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = Math.log1p(Math.expm1((1.0 / (x * n))));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-65: tmp = t_0 / (x * n) elif (1.0 / n) <= 1e-13: tmp = math.log((x / (x + 1.0))) / -n elif (1.0 / n) <= 4e+191: tmp = (1.0 + (x / n)) - t_0 else: tmp = math.log1p(math.expm1((1.0 / (x * n)))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-65) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 1e-13) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 4e+191) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = log1p(expm1(Float64(1.0 / Float64(x * 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-65], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-13], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+191], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[Log[1 + N[(Exp[N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]] - 1), $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^{-65}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-13}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+191}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{x \cdot n}\right)\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.99999999999999983e-65Initial program 82.5%
Taylor expanded in x around inf 89.8%
mul-1-neg89.8%
log-rec89.8%
mul-1-neg89.8%
distribute-neg-frac89.8%
mul-1-neg89.8%
remove-double-neg89.8%
*-commutative89.8%
Simplified89.8%
*-un-lft-identity89.8%
div-inv89.8%
exp-to-pow89.8%
Applied egg-rr89.8%
*-lft-identity89.8%
Simplified89.8%
if -4.99999999999999983e-65 < (/.f64 #s(literal 1 binary64) n) < 1e-13Initial program 30.3%
Taylor expanded in n around inf 80.7%
log1p-define80.7%
Simplified80.7%
log1p-undefine80.7%
diff-log80.8%
Applied egg-rr80.8%
+-commutative80.8%
Simplified80.8%
clear-num80.8%
log-div80.9%
metadata-eval80.9%
Applied egg-rr80.9%
neg-sub080.9%
Simplified80.9%
if 1e-13 < (/.f64 #s(literal 1 binary64) n) < 4.00000000000000029e191Initial program 75.8%
Taylor expanded in x around 0 72.2%
if 4.00000000000000029e191 < (/.f64 #s(literal 1 binary64) n) Initial program 35.4%
Taylor expanded in n around inf 6.7%
log1p-define6.7%
Simplified6.7%
log1p-undefine6.7%
diff-log6.7%
Applied egg-rr6.7%
+-commutative6.7%
Simplified6.7%
Taylor expanded in x around inf 57.7%
*-commutative57.7%
Simplified57.7%
log1p-expm1-u78.5%
Applied egg-rr78.5%
Final simplification83.1%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -5e-65)
(/ (exp (/ (log x) n)) (* x n))
(if (<= (/ 1.0 n) 1e-13)
(/ (log (/ x (+ x 1.0))) (- n))
(- (exp (/ x n)) (pow x (/ 1.0 n))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -5e-65) {
tmp = exp((log(x) / n)) / (x * n);
} else if ((1.0 / n) <= 1e-13) {
tmp = log((x / (x + 1.0))) / -n;
} else {
tmp = exp((x / n)) - pow(x, (1.0 / 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) <= (-5d-65)) then
tmp = exp((log(x) / n)) / (x * n)
else if ((1.0d0 / n) <= 1d-13) then
tmp = log((x / (x + 1.0d0))) / -n
else
tmp = exp((x / n)) - (x ** (1.0d0 / n))
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -5e-65) {
tmp = Math.exp((Math.log(x) / n)) / (x * n);
} else if ((1.0 / n) <= 1e-13) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else {
tmp = Math.exp((x / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -5e-65: tmp = math.exp((math.log(x) / n)) / (x * n) elif (1.0 / n) <= 1e-13: tmp = math.log((x / (x + 1.0))) / -n else: tmp = math.exp((x / n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-65) tmp = Float64(exp(Float64(log(x) / n)) / Float64(x * n)); elseif (Float64(1.0 / n) <= 1e-13) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); else tmp = Float64(exp(Float64(x / n)) - (x ^ Float64(1.0 / n))); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -5e-65) tmp = exp((log(x) / n)) / (x * n); elseif ((1.0 / n) <= 1e-13) tmp = log((x / (x + 1.0))) / -n; else tmp = exp((x / n)) - (x ^ (1.0 / n)); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-65], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-13], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-65}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-13}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.99999999999999983e-65Initial program 82.5%
Taylor expanded in x around inf 89.8%
mul-1-neg89.8%
log-rec89.8%
mul-1-neg89.8%
distribute-neg-frac89.8%
mul-1-neg89.8%
remove-double-neg89.8%
*-commutative89.8%
Simplified89.8%
if -4.99999999999999983e-65 < (/.f64 #s(literal 1 binary64) n) < 1e-13Initial program 30.3%
Taylor expanded in n around inf 80.7%
log1p-define80.7%
Simplified80.7%
log1p-undefine80.7%
diff-log80.8%
Applied egg-rr80.8%
+-commutative80.8%
Simplified80.8%
clear-num80.8%
log-div80.9%
metadata-eval80.9%
Applied egg-rr80.9%
neg-sub080.9%
Simplified80.9%
if 1e-13 < (/.f64 #s(literal 1 binary64) n) Initial program 65.1%
Taylor expanded in n around 0 65.1%
log1p-define96.6%
*-rgt-identity96.6%
associate-*l/96.6%
associate-/l*96.6%
exp-to-pow96.9%
Simplified96.9%
Taylor expanded in x around 0 96.7%
Final simplification86.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) -2e+275)
(/ 1.0 (* x n))
(if (<= (/ 1.0 n) -5e+204)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) -2e+46)
t_0
(if (<= (/ 1.0 n) 1e-13)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 4e+191)
t_0
(/
(/ (+ (/ (+ 0.5 (/ -0.3333333333333333 x)) x) -1.0) (- x))
n))))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e+275) {
tmp = 1.0 / (x * n);
} else if ((1.0 / n) <= -5e+204) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= -2e+46) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-13) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 4e+191) {
tmp = t_0;
} else {
tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -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) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
if ((1.0d0 / n) <= (-2d+275)) then
tmp = 1.0d0 / (x * n)
else if ((1.0d0 / n) <= (-5d+204)) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= (-2d+46)) then
tmp = t_0
else if ((1.0d0 / n) <= 1d-13) then
tmp = log((x / (x + 1.0d0))) / -n
else if ((1.0d0 / n) <= 4d+191) then
tmp = t_0
else
tmp = ((((0.5d0 + ((-0.3333333333333333d0) / x)) / x) + (-1.0d0)) / -x) / n
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) <= -2e+275) {
tmp = 1.0 / (x * n);
} else if ((1.0 / n) <= -5e+204) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= -2e+46) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-13) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 4e+191) {
tmp = t_0;
} else {
tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n;
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e+275: tmp = 1.0 / (x * n) elif (1.0 / n) <= -5e+204: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= -2e+46: tmp = t_0 elif (1.0 / n) <= 1e-13: tmp = math.log((x / (x + 1.0))) / -n elif (1.0 / n) <= 4e+191: tmp = t_0 else: tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (Float64(1.0 / n) <= -2e+275) tmp = Float64(1.0 / Float64(x * n)); elseif (Float64(1.0 / n) <= -5e+204) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= -2e+46) tmp = t_0; elseif (Float64(1.0 / n) <= 1e-13) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 4e+191) tmp = t_0; else tmp = Float64(Float64(Float64(Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x) + -1.0) / Float64(-x)) / n); 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) <= -2e+275) tmp = 1.0 / (x * n); elseif ((1.0 / n) <= -5e+204) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= -2e+46) tmp = t_0; elseif ((1.0 / n) <= 1e-13) tmp = log((x / (x + 1.0))) / -n; elseif ((1.0 / n) <= 4e+191) tmp = t_0; else tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n; 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], -2e+275], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e+204], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+46], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-13], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+191], t$95$0, N[(N[(N[(N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + -1.0), $MachinePrecision] / (-x)), $MachinePrecision] / n), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{+275}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{+204}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{+46}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-13}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+191}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{0.5 + \frac{-0.3333333333333333}{x}}{x} + -1}{-x}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999992e275Initial program 100.0%
Taylor expanded in n around inf 10.3%
log1p-define10.3%
Simplified10.3%
Taylor expanded in x around inf 100.0%
if -1.99999999999999992e275 < (/.f64 #s(literal 1 binary64) n) < -5.00000000000000008e204Initial program 100.0%
Taylor expanded in n around inf 74.2%
log1p-define74.2%
Simplified74.2%
log1p-undefine74.2%
diff-log74.2%
Applied egg-rr74.2%
+-commutative74.2%
Simplified74.2%
if -5.00000000000000008e204 < (/.f64 #s(literal 1 binary64) n) < -2e46 or 1e-13 < (/.f64 #s(literal 1 binary64) n) < 4.00000000000000029e191Initial program 89.9%
Taylor expanded in x around 0 68.9%
*-rgt-identity68.9%
associate-*l/68.9%
associate-/l*68.9%
exp-to-pow68.9%
Simplified68.9%
if -2e46 < (/.f64 #s(literal 1 binary64) n) < 1e-13Initial program 34.5%
Taylor expanded in n around inf 74.4%
log1p-define74.4%
Simplified74.4%
log1p-undefine74.4%
diff-log74.5%
Applied egg-rr74.5%
+-commutative74.5%
Simplified74.5%
clear-num74.5%
log-div74.5%
metadata-eval74.5%
Applied egg-rr74.5%
neg-sub074.5%
Simplified74.5%
if 4.00000000000000029e191 < (/.f64 #s(literal 1 binary64) n) Initial program 35.4%
Taylor expanded in n around inf 6.7%
log1p-define6.7%
Simplified6.7%
log1p-undefine6.7%
diff-log6.7%
Applied egg-rr6.7%
+-commutative6.7%
Simplified6.7%
Taylor expanded in x around -inf 78.5%
mul-1-neg78.5%
distribute-neg-frac278.5%
sub-neg78.5%
associate-*r/78.5%
sub-neg78.5%
metadata-eval78.5%
distribute-lft-in78.5%
neg-mul-178.5%
associate-*r/78.5%
metadata-eval78.5%
distribute-neg-frac78.5%
metadata-eval78.5%
metadata-eval78.5%
metadata-eval78.5%
Simplified78.5%
Final simplification73.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (log (/ (+ x 1.0) x)) n)))
(if (<= (/ 1.0 n) -2e+275)
(/ 1.0 (* x n))
(if (<= (/ 1.0 n) -5e+204)
t_1
(if (<= (/ 1.0 n) -2e+46)
t_0
(if (<= (/ 1.0 n) 1e-13)
t_1
(if (<= (/ 1.0 n) 4e+191)
t_0
(/
(/ (+ (/ (+ 0.5 (/ -0.3333333333333333 x)) x) -1.0) (- x))
n))))))))
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 ((1.0 / n) <= -2e+275) {
tmp = 1.0 / (x * n);
} else if ((1.0 / n) <= -5e+204) {
tmp = t_1;
} else if ((1.0 / n) <= -2e+46) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-13) {
tmp = t_1;
} else if ((1.0 / n) <= 4e+191) {
tmp = t_0;
} else {
tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -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 = 1.0d0 - (x ** (1.0d0 / n))
t_1 = log(((x + 1.0d0) / x)) / n
if ((1.0d0 / n) <= (-2d+275)) then
tmp = 1.0d0 / (x * n)
else if ((1.0d0 / n) <= (-5d+204)) then
tmp = t_1
else if ((1.0d0 / n) <= (-2d+46)) then
tmp = t_0
else if ((1.0d0 / n) <= 1d-13) then
tmp = t_1
else if ((1.0d0 / n) <= 4d+191) then
tmp = t_0
else
tmp = ((((0.5d0 + ((-0.3333333333333333d0) / x)) / x) + (-1.0d0)) / -x) / n
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 ((1.0 / n) <= -2e+275) {
tmp = 1.0 / (x * n);
} else if ((1.0 / n) <= -5e+204) {
tmp = t_1;
} else if ((1.0 / n) <= -2e+46) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-13) {
tmp = t_1;
} else if ((1.0 / n) <= 4e+191) {
tmp = t_0;
} else {
tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n;
}
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 (1.0 / n) <= -2e+275: tmp = 1.0 / (x * n) elif (1.0 / n) <= -5e+204: tmp = t_1 elif (1.0 / n) <= -2e+46: tmp = t_0 elif (1.0 / n) <= 1e-13: tmp = t_1 elif (1.0 / n) <= 4e+191: tmp = t_0 else: tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n 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 (Float64(1.0 / n) <= -2e+275) tmp = Float64(1.0 / Float64(x * n)); elseif (Float64(1.0 / n) <= -5e+204) tmp = t_1; elseif (Float64(1.0 / n) <= -2e+46) tmp = t_0; elseif (Float64(1.0 / n) <= 1e-13) tmp = t_1; elseif (Float64(1.0 / n) <= 4e+191) tmp = t_0; else tmp = Float64(Float64(Float64(Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x) + -1.0) / Float64(-x)) / n); 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 ((1.0 / n) <= -2e+275) tmp = 1.0 / (x * n); elseif ((1.0 / n) <= -5e+204) tmp = t_1; elseif ((1.0 / n) <= -2e+46) tmp = t_0; elseif ((1.0 / n) <= 1e-13) tmp = t_1; elseif ((1.0 / n) <= 4e+191) tmp = t_0; else tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n; 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.0 / n), $MachinePrecision], -2e+275], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e+204], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+46], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-13], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+191], t$95$0, N[(N[(N[(N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + -1.0), $MachinePrecision] / (-x)), $MachinePrecision] / n), $MachinePrecision]]]]]]]]
\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}\;\frac{1}{n} \leq -2 \cdot 10^{+275}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{+204}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{+46}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-13}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+191}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{0.5 + \frac{-0.3333333333333333}{x}}{x} + -1}{-x}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999992e275Initial program 100.0%
Taylor expanded in n around inf 10.3%
log1p-define10.3%
Simplified10.3%
Taylor expanded in x around inf 100.0%
if -1.99999999999999992e275 < (/.f64 #s(literal 1 binary64) n) < -5.00000000000000008e204 or -2e46 < (/.f64 #s(literal 1 binary64) n) < 1e-13Initial program 41.0%
Taylor expanded in n around inf 74.4%
log1p-define74.4%
Simplified74.4%
log1p-undefine74.4%
diff-log74.5%
Applied egg-rr74.5%
+-commutative74.5%
Simplified74.5%
if -5.00000000000000008e204 < (/.f64 #s(literal 1 binary64) n) < -2e46 or 1e-13 < (/.f64 #s(literal 1 binary64) n) < 4.00000000000000029e191Initial program 89.9%
Taylor expanded in x around 0 68.9%
*-rgt-identity68.9%
associate-*l/68.9%
associate-/l*68.9%
exp-to-pow68.9%
Simplified68.9%
if 4.00000000000000029e191 < (/.f64 #s(literal 1 binary64) n) Initial program 35.4%
Taylor expanded in n around inf 6.7%
log1p-define6.7%
Simplified6.7%
log1p-undefine6.7%
diff-log6.7%
Applied egg-rr6.7%
+-commutative6.7%
Simplified6.7%
Taylor expanded in x around -inf 78.5%
mul-1-neg78.5%
distribute-neg-frac278.5%
sub-neg78.5%
associate-*r/78.5%
sub-neg78.5%
metadata-eval78.5%
distribute-lft-in78.5%
neg-mul-178.5%
associate-*r/78.5%
metadata-eval78.5%
distribute-neg-frac78.5%
metadata-eval78.5%
metadata-eval78.5%
metadata-eval78.5%
Simplified78.5%
Final simplification73.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-65)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 1e-13)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 4e+191)
(- (+ 1.0 (/ x n)) t_0)
(/ (/ (+ (/ (+ 0.5 (/ -0.3333333333333333 x)) x) -1.0) (- x)) n))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-65) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 1e-13) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 4e+191) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -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) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-5d-65)) then
tmp = t_0 / (x * n)
else if ((1.0d0 / n) <= 1d-13) then
tmp = log((x / (x + 1.0d0))) / -n
else if ((1.0d0 / n) <= 4d+191) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = ((((0.5d0 + ((-0.3333333333333333d0) / x)) / x) + (-1.0d0)) / -x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-65) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 1e-13) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 4e+191) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-65: tmp = t_0 / (x * n) elif (1.0 / n) <= 1e-13: tmp = math.log((x / (x + 1.0))) / -n elif (1.0 / n) <= 4e+191: tmp = (1.0 + (x / n)) - t_0 else: tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-65) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 1e-13) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 4e+191) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(Float64(Float64(Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x) + -1.0) / Float64(-x)) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -5e-65) tmp = t_0 / (x * n); elseif ((1.0 / n) <= 1e-13) tmp = log((x / (x + 1.0))) / -n; elseif ((1.0 / n) <= 4e+191) tmp = (1.0 + (x / n)) - t_0; else tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n; 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-65], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-13], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+191], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(N[(N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + -1.0), $MachinePrecision] / (-x)), $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^{-65}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-13}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+191}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{0.5 + \frac{-0.3333333333333333}{x}}{x} + -1}{-x}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.99999999999999983e-65Initial program 82.5%
Taylor expanded in x around inf 89.8%
mul-1-neg89.8%
log-rec89.8%
mul-1-neg89.8%
distribute-neg-frac89.8%
mul-1-neg89.8%
remove-double-neg89.8%
*-commutative89.8%
Simplified89.8%
*-un-lft-identity89.8%
div-inv89.8%
exp-to-pow89.8%
Applied egg-rr89.8%
*-lft-identity89.8%
Simplified89.8%
if -4.99999999999999983e-65 < (/.f64 #s(literal 1 binary64) n) < 1e-13Initial program 30.3%
Taylor expanded in n around inf 80.7%
log1p-define80.7%
Simplified80.7%
log1p-undefine80.7%
diff-log80.8%
Applied egg-rr80.8%
+-commutative80.8%
Simplified80.8%
clear-num80.8%
log-div80.9%
metadata-eval80.9%
Applied egg-rr80.9%
neg-sub080.9%
Simplified80.9%
if 1e-13 < (/.f64 #s(literal 1 binary64) n) < 4.00000000000000029e191Initial program 75.8%
Taylor expanded in x around 0 72.2%
if 4.00000000000000029e191 < (/.f64 #s(literal 1 binary64) n) Initial program 35.4%
Taylor expanded in n around inf 6.7%
log1p-define6.7%
Simplified6.7%
log1p-undefine6.7%
diff-log6.7%
Applied egg-rr6.7%
+-commutative6.7%
Simplified6.7%
Taylor expanded in x around -inf 78.5%
mul-1-neg78.5%
distribute-neg-frac278.5%
sub-neg78.5%
associate-*r/78.5%
sub-neg78.5%
metadata-eval78.5%
distribute-lft-in78.5%
neg-mul-178.5%
associate-*r/78.5%
metadata-eval78.5%
distribute-neg-frac78.5%
metadata-eval78.5%
metadata-eval78.5%
metadata-eval78.5%
Simplified78.5%
Final simplification83.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-65)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) 1e-13)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 4e+191)
(- 1.0 t_0)
(/ (/ (+ (/ (+ 0.5 (/ -0.3333333333333333 x)) x) -1.0) (- x)) n))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-65) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 1e-13) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 4e+191) {
tmp = 1.0 - t_0;
} else {
tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -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) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-5d-65)) then
tmp = t_0 / (x * n)
else if ((1.0d0 / n) <= 1d-13) then
tmp = log((x / (x + 1.0d0))) / -n
else if ((1.0d0 / n) <= 4d+191) then
tmp = 1.0d0 - t_0
else
tmp = ((((0.5d0 + ((-0.3333333333333333d0) / x)) / x) + (-1.0d0)) / -x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-65) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= 1e-13) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 4e+191) {
tmp = 1.0 - t_0;
} else {
tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-65: tmp = t_0 / (x * n) elif (1.0 / n) <= 1e-13: tmp = math.log((x / (x + 1.0))) / -n elif (1.0 / n) <= 4e+191: tmp = 1.0 - t_0 else: tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-65) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= 1e-13) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 4e+191) tmp = Float64(1.0 - t_0); else tmp = Float64(Float64(Float64(Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x) + -1.0) / Float64(-x)) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -5e-65) tmp = t_0 / (x * n); elseif ((1.0 / n) <= 1e-13) tmp = log((x / (x + 1.0))) / -n; elseif ((1.0 / n) <= 4e+191) tmp = 1.0 - t_0; else tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n; 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-65], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-13], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+191], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(N[(N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + -1.0), $MachinePrecision] / (-x)), $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^{-65}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-13}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+191}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{0.5 + \frac{-0.3333333333333333}{x}}{x} + -1}{-x}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.99999999999999983e-65Initial program 82.5%
Taylor expanded in x around inf 89.8%
mul-1-neg89.8%
log-rec89.8%
mul-1-neg89.8%
distribute-neg-frac89.8%
mul-1-neg89.8%
remove-double-neg89.8%
*-commutative89.8%
Simplified89.8%
*-un-lft-identity89.8%
div-inv89.8%
exp-to-pow89.8%
Applied egg-rr89.8%
*-lft-identity89.8%
Simplified89.8%
if -4.99999999999999983e-65 < (/.f64 #s(literal 1 binary64) n) < 1e-13Initial program 30.3%
Taylor expanded in n around inf 80.7%
log1p-define80.7%
Simplified80.7%
log1p-undefine80.7%
diff-log80.8%
Applied egg-rr80.8%
+-commutative80.8%
Simplified80.8%
clear-num80.8%
log-div80.9%
metadata-eval80.9%
Applied egg-rr80.9%
neg-sub080.9%
Simplified80.9%
if 1e-13 < (/.f64 #s(literal 1 binary64) n) < 4.00000000000000029e191Initial program 75.8%
Taylor expanded in x around 0 71.9%
*-rgt-identity71.9%
associate-*l/71.9%
associate-/l*71.9%
exp-to-pow71.9%
Simplified71.9%
if 4.00000000000000029e191 < (/.f64 #s(literal 1 binary64) n) Initial program 35.4%
Taylor expanded in n around inf 6.7%
log1p-define6.7%
Simplified6.7%
log1p-undefine6.7%
diff-log6.7%
Applied egg-rr6.7%
+-commutative6.7%
Simplified6.7%
Taylor expanded in x around -inf 78.5%
mul-1-neg78.5%
distribute-neg-frac278.5%
sub-neg78.5%
associate-*r/78.5%
sub-neg78.5%
metadata-eval78.5%
distribute-lft-in78.5%
neg-mul-178.5%
associate-*r/78.5%
metadata-eval78.5%
distribute-neg-frac78.5%
metadata-eval78.5%
metadata-eval78.5%
metadata-eval78.5%
Simplified78.5%
Final simplification83.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-55)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 1e-13)
(/ (log (/ x (+ x 1.0))) (- n))
(if (<= (/ 1.0 n) 4e+191)
(- 1.0 t_0)
(/ (/ (+ (/ (+ 0.5 (/ -0.3333333333333333 x)) x) -1.0) (- x)) n))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-55) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 1e-13) {
tmp = log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 4e+191) {
tmp = 1.0 - t_0;
} else {
tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -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) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-5d-55)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 1d-13) then
tmp = log((x / (x + 1.0d0))) / -n
else if ((1.0d0 / n) <= 4d+191) then
tmp = 1.0d0 - t_0
else
tmp = ((((0.5d0 + ((-0.3333333333333333d0) / x)) / x) + (-1.0d0)) / -x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-55) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 1e-13) {
tmp = Math.log((x / (x + 1.0))) / -n;
} else if ((1.0 / n) <= 4e+191) {
tmp = 1.0 - t_0;
} else {
tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-55: tmp = (t_0 / n) / x elif (1.0 / n) <= 1e-13: tmp = math.log((x / (x + 1.0))) / -n elif (1.0 / n) <= 4e+191: tmp = 1.0 - t_0 else: tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-55) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 1e-13) tmp = Float64(log(Float64(x / Float64(x + 1.0))) / Float64(-n)); elseif (Float64(1.0 / n) <= 4e+191) tmp = Float64(1.0 - t_0); else tmp = Float64(Float64(Float64(Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x) + -1.0) / Float64(-x)) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -5e-55) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 1e-13) tmp = log((x / (x + 1.0))) / -n; elseif ((1.0 / n) <= 4e+191) tmp = 1.0 - t_0; else tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n; 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-55], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-13], N[(N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+191], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(N[(N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + -1.0), $MachinePrecision] / (-x)), $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^{-55}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-13}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x + 1}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+191}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{0.5 + \frac{-0.3333333333333333}{x}}{x} + -1}{-x}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -5.0000000000000002e-55Initial program 83.9%
Taylor expanded in x around inf 90.4%
associate-/r*90.3%
mul-1-neg90.3%
log-rec90.3%
mul-1-neg90.3%
distribute-neg-frac90.3%
mul-1-neg90.3%
remove-double-neg90.3%
*-rgt-identity90.3%
associate-/l*90.3%
exp-to-pow90.3%
Simplified90.3%
if -5.0000000000000002e-55 < (/.f64 #s(literal 1 binary64) n) < 1e-13Initial program 31.0%
Taylor expanded in n around inf 80.6%
log1p-define80.6%
Simplified80.6%
log1p-undefine80.6%
diff-log80.7%
Applied egg-rr80.7%
+-commutative80.7%
Simplified80.7%
clear-num80.7%
log-div80.7%
metadata-eval80.7%
Applied egg-rr80.7%
neg-sub080.7%
Simplified80.7%
if 1e-13 < (/.f64 #s(literal 1 binary64) n) < 4.00000000000000029e191Initial program 75.8%
Taylor expanded in x around 0 71.9%
*-rgt-identity71.9%
associate-*l/71.9%
associate-/l*71.9%
exp-to-pow71.9%
Simplified71.9%
if 4.00000000000000029e191 < (/.f64 #s(literal 1 binary64) n) Initial program 35.4%
Taylor expanded in n around inf 6.7%
log1p-define6.7%
Simplified6.7%
log1p-undefine6.7%
diff-log6.7%
Applied egg-rr6.7%
+-commutative6.7%
Simplified6.7%
Taylor expanded in x around -inf 78.5%
mul-1-neg78.5%
distribute-neg-frac278.5%
sub-neg78.5%
associate-*r/78.5%
sub-neg78.5%
metadata-eval78.5%
distribute-lft-in78.5%
neg-mul-178.5%
associate-*r/78.5%
metadata-eval78.5%
distribute-neg-frac78.5%
metadata-eval78.5%
metadata-eval78.5%
metadata-eval78.5%
Simplified78.5%
Final simplification83.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= x 2.05e-277)
t_0
(if (<= x 4.6e-146)
(/ (log x) (- n))
(if (<= x 1.35e-97)
t_0
(if (<= x 0.86)
(/ (- x (log x)) n)
(if (<= x 3.3e+75)
(/
(/
(+
1.0
(/ (- (/ (- 0.3333333333333333 (* 0.25 (/ 1.0 x))) x) 0.5) x))
x)
n)
0.0)))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if (x <= 2.05e-277) {
tmp = t_0;
} else if (x <= 4.6e-146) {
tmp = log(x) / -n;
} else if (x <= 1.35e-97) {
tmp = t_0;
} else if (x <= 0.86) {
tmp = (x - log(x)) / n;
} else if (x <= 3.3e+75) {
tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.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 = 1.0d0 - (x ** (1.0d0 / n))
if (x <= 2.05d-277) then
tmp = t_0
else if (x <= 4.6d-146) then
tmp = log(x) / -n
else if (x <= 1.35d-97) then
tmp = t_0
else if (x <= 0.86d0) then
tmp = (x - log(x)) / n
else if (x <= 3.3d+75) then
tmp = ((1.0d0 + ((((0.3333333333333333d0 - (0.25d0 * (1.0d0 / x))) / x) - 0.5d0) / x)) / x) / n
else
tmp = 0.0d0
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 (x <= 2.05e-277) {
tmp = t_0;
} else if (x <= 4.6e-146) {
tmp = Math.log(x) / -n;
} else if (x <= 1.35e-97) {
tmp = t_0;
} else if (x <= 0.86) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 3.3e+75) {
tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if x <= 2.05e-277: tmp = t_0 elif x <= 4.6e-146: tmp = math.log(x) / -n elif x <= 1.35e-97: tmp = t_0 elif x <= 0.86: tmp = (x - math.log(x)) / n elif x <= 3.3e+75: tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n else: tmp = 0.0 return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (x <= 2.05e-277) tmp = t_0; elseif (x <= 4.6e-146) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 1.35e-97) tmp = t_0; elseif (x <= 0.86) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 3.3e+75) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 - Float64(0.25 * Float64(1.0 / x))) / x) - 0.5) / x)) / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if (x <= 2.05e-277) tmp = t_0; elseif (x <= 4.6e-146) tmp = log(x) / -n; elseif (x <= 1.35e-97) tmp = t_0; elseif (x <= 0.86) tmp = (x - log(x)) / n; elseif (x <= 3.3e+75) tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n; else tmp = 0.0; 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[x, 2.05e-277], t$95$0, If[LessEqual[x, 4.6e-146], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 1.35e-97], t$95$0, If[LessEqual[x, 0.86], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 3.3e+75], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 - N[(0.25 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 2.05 \cdot 10^{-277}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{-146}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-97}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 0.86:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{+75}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x} - 0.5}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.04999999999999994e-277 or 4.6000000000000001e-146 < x < 1.34999999999999993e-97Initial program 62.3%
Taylor expanded in x around 0 62.3%
*-rgt-identity62.3%
associate-*l/62.3%
associate-/l*62.3%
exp-to-pow62.3%
Simplified62.3%
if 2.04999999999999994e-277 < x < 4.6000000000000001e-146Initial program 39.1%
Taylor expanded in n around inf 65.5%
log1p-define65.5%
Simplified65.5%
Taylor expanded in x around 0 65.5%
neg-mul-165.5%
Simplified65.5%
if 1.34999999999999993e-97 < x < 0.859999999999999987Initial program 37.5%
Taylor expanded in n around inf 55.2%
log1p-define55.2%
Simplified55.2%
Taylor expanded in x around 0 52.0%
if 0.859999999999999987 < x < 3.29999999999999998e75Initial program 23.9%
Taylor expanded in n around inf 30.6%
log1p-define30.6%
Simplified30.6%
Taylor expanded in x around -inf 79.6%
if 3.29999999999999998e75 < x Initial program 81.8%
sub-neg81.8%
+-commutative81.8%
add-log-exp81.8%
add-log-exp81.8%
sum-log81.8%
pow-to-exp81.8%
un-div-inv81.8%
+-commutative81.8%
log1p-define81.8%
Applied egg-rr81.8%
Taylor expanded in n around inf 81.8%
prod-exp81.8%
metadata-eval81.8%
1-exp81.8%
metadata-eval81.8%
Simplified81.8%
Final simplification69.4%
(FPCore (x n)
:precision binary64
(if (<= x 9.2e-144)
(/ (log x) (- n))
(if (<= x 6.5e-100)
(/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* x n)) (/ 0.5 n)) x)) x)
(if (<= x 0.88)
(/ (- x (log x)) n)
(if (<= x 2.25e+77)
(/
(/
(+
1.0
(/ (- (/ (- 0.3333333333333333 (* 0.25 (/ 1.0 x))) x) 0.5) x))
x)
n)
0.0)))))
double code(double x, double n) {
double tmp;
if (x <= 9.2e-144) {
tmp = log(x) / -n;
} else if (x <= 6.5e-100) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else if (x <= 0.88) {
tmp = (x - log(x)) / n;
} else if (x <= 2.25e+77) {
tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 9.2d-144) then
tmp = log(x) / -n
else if (x <= 6.5d-100) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (x * n)) - (0.5d0 / n)) / x)) / x
else if (x <= 0.88d0) then
tmp = (x - log(x)) / n
else if (x <= 2.25d+77) then
tmp = ((1.0d0 + ((((0.3333333333333333d0 - (0.25d0 * (1.0d0 / x))) / x) - 0.5d0) / x)) / x) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 9.2e-144) {
tmp = Math.log(x) / -n;
} else if (x <= 6.5e-100) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else if (x <= 0.88) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 2.25e+77) {
tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 9.2e-144: tmp = math.log(x) / -n elif x <= 6.5e-100: tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x elif x <= 0.88: tmp = (x - math.log(x)) / n elif x <= 2.25e+77: tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 9.2e-144) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 6.5e-100) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(x * n)) - Float64(0.5 / n)) / x)) / x); elseif (x <= 0.88) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 2.25e+77) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 - Float64(0.25 * Float64(1.0 / x))) / x) - 0.5) / x)) / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 9.2e-144) tmp = log(x) / -n; elseif (x <= 6.5e-100) tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x; elseif (x <= 0.88) tmp = (x - log(x)) / n; elseif (x <= 2.25e+77) tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 9.2e-144], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 6.5e-100], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.88], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 2.25e+77], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 - N[(0.25 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.2 \cdot 10^{-144}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{-100}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{elif}\;x \leq 0.88:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 2.25 \cdot 10^{+77}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x} - 0.5}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 9.2e-144Initial program 47.6%
Taylor expanded in n around inf 57.3%
log1p-define57.3%
Simplified57.3%
Taylor expanded in x around 0 57.3%
neg-mul-157.3%
Simplified57.3%
if 9.2e-144 < x < 6.50000000000000013e-100Initial program 56.0%
Taylor expanded in n around inf 28.6%
log1p-define28.6%
Simplified28.6%
Taylor expanded in x around -inf 51.5%
associate-*r/51.5%
mul-1-neg51.5%
associate-*r/51.5%
mul-1-neg51.5%
associate-*r/51.5%
metadata-eval51.5%
*-commutative51.5%
associate-*r/51.5%
metadata-eval51.5%
Simplified51.5%
if 6.50000000000000013e-100 < x < 0.880000000000000004Initial program 37.5%
Taylor expanded in n around inf 55.2%
log1p-define55.2%
Simplified55.2%
Taylor expanded in x around 0 52.0%
if 0.880000000000000004 < x < 2.25000000000000012e77Initial program 23.9%
Taylor expanded in n around inf 30.6%
log1p-define30.6%
Simplified30.6%
Taylor expanded in x around -inf 79.6%
if 2.25000000000000012e77 < x Initial program 81.8%
sub-neg81.8%
+-commutative81.8%
add-log-exp81.8%
add-log-exp81.8%
sum-log81.8%
pow-to-exp81.8%
un-div-inv81.8%
+-commutative81.8%
log1p-define81.8%
Applied egg-rr81.8%
Taylor expanded in n around inf 81.8%
prod-exp81.8%
metadata-eval81.8%
1-exp81.8%
metadata-eval81.8%
Simplified81.8%
Final simplification66.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) (- n))))
(if (<= x 1.6e-144)
t_0
(if (<= x 6.5e-100)
(/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* x n)) (/ 0.5 n)) x)) x)
(if (<= x 0.7)
t_0
(if (<= x 8.6e+71)
(/
(/
(+
1.0
(/ (- (/ (- 0.3333333333333333 (* 0.25 (/ 1.0 x))) x) 0.5) x))
x)
n)
0.0))))))
double code(double x, double n) {
double t_0 = log(x) / -n;
double tmp;
if (x <= 1.6e-144) {
tmp = t_0;
} else if (x <= 6.5e-100) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else if (x <= 0.7) {
tmp = t_0;
} else if (x <= 8.6e+71) {
tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.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 = log(x) / -n
if (x <= 1.6d-144) then
tmp = t_0
else if (x <= 6.5d-100) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (x * n)) - (0.5d0 / n)) / x)) / x
else if (x <= 0.7d0) then
tmp = t_0
else if (x <= 8.6d+71) then
tmp = ((1.0d0 + ((((0.3333333333333333d0 - (0.25d0 * (1.0d0 / x))) / x) - 0.5d0) / x)) / x) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(x) / -n;
double tmp;
if (x <= 1.6e-144) {
tmp = t_0;
} else if (x <= 6.5e-100) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else if (x <= 0.7) {
tmp = t_0;
} else if (x <= 8.6e+71) {
tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): t_0 = math.log(x) / -n tmp = 0 if x <= 1.6e-144: tmp = t_0 elif x <= 6.5e-100: tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x elif x <= 0.7: tmp = t_0 elif x <= 8.6e+71: tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n else: tmp = 0.0 return tmp
function code(x, n) t_0 = Float64(log(x) / Float64(-n)) tmp = 0.0 if (x <= 1.6e-144) tmp = t_0; elseif (x <= 6.5e-100) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(x * n)) - Float64(0.5 / n)) / x)) / x); elseif (x <= 0.7) tmp = t_0; elseif (x <= 8.6e+71) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 - Float64(0.25 * Float64(1.0 / x))) / x) - 0.5) / x)) / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) t_0 = log(x) / -n; tmp = 0.0; if (x <= 1.6e-144) tmp = t_0; elseif (x <= 6.5e-100) tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x; elseif (x <= 0.7) tmp = t_0; elseif (x <= 8.6e+71) tmp = ((1.0 + ((((0.3333333333333333 - (0.25 * (1.0 / x))) / x) - 0.5) / x)) / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 1.6e-144], t$95$0, If[LessEqual[x, 6.5e-100], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.7], t$95$0, If[LessEqual[x, 8.6e+71], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 - N[(0.25 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
\mathbf{if}\;x \leq 1.6 \cdot 10^{-144}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{-100}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{elif}\;x \leq 0.7:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 8.6 \cdot 10^{+71}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 - 0.25 \cdot \frac{1}{x}}{x} - 0.5}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.59999999999999986e-144 or 6.50000000000000013e-100 < x < 0.69999999999999996Initial program 44.1%
Taylor expanded in n around inf 56.6%
log1p-define56.6%
Simplified56.6%
Taylor expanded in x around 0 55.3%
neg-mul-155.3%
Simplified55.3%
if 1.59999999999999986e-144 < x < 6.50000000000000013e-100Initial program 56.0%
Taylor expanded in n around inf 28.6%
log1p-define28.6%
Simplified28.6%
Taylor expanded in x around -inf 51.5%
associate-*r/51.5%
mul-1-neg51.5%
associate-*r/51.5%
mul-1-neg51.5%
associate-*r/51.5%
metadata-eval51.5%
*-commutative51.5%
associate-*r/51.5%
metadata-eval51.5%
Simplified51.5%
if 0.69999999999999996 < x < 8.59999999999999967e71Initial program 23.9%
Taylor expanded in n around inf 30.6%
log1p-define30.6%
Simplified30.6%
Taylor expanded in x around -inf 79.6%
if 8.59999999999999967e71 < x Initial program 81.8%
sub-neg81.8%
+-commutative81.8%
add-log-exp81.8%
add-log-exp81.8%
sum-log81.8%
pow-to-exp81.8%
un-div-inv81.8%
+-commutative81.8%
log1p-define81.8%
Applied egg-rr81.8%
Taylor expanded in n around inf 81.8%
prod-exp81.8%
metadata-eval81.8%
1-exp81.8%
metadata-eval81.8%
Simplified81.8%
Final simplification66.1%
(FPCore (x n) :precision binary64 (if (<= x 3.1e+76) (/ (/ (- 1.0 (/ (+ 0.5 (/ (+ 0.3333333333333333 (/ -0.25 x)) x)) x)) x) n) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 3.1e+76) {
tmp = ((1.0 - ((0.5 + ((0.3333333333333333 + (-0.25 / x)) / x)) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 3.1d+76) then
tmp = ((1.0d0 - ((0.5d0 + ((0.3333333333333333d0 + ((-0.25d0) / x)) / x)) / x)) / x) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 3.1e+76) {
tmp = ((1.0 - ((0.5 + ((0.3333333333333333 + (-0.25 / x)) / x)) / x)) / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 3.1e+76: tmp = ((1.0 - ((0.5 + ((0.3333333333333333 + (-0.25 / x)) / x)) / x)) / x) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 3.1e+76) tmp = Float64(Float64(Float64(1.0 - Float64(Float64(0.5 + Float64(Float64(0.3333333333333333 + Float64(-0.25 / x)) / x)) / x)) / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 3.1e+76) tmp = ((1.0 - ((0.5 + ((0.3333333333333333 + (-0.25 / x)) / x)) / x)) / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 3.1e+76], N[(N[(N[(1.0 - N[(N[(0.5 + N[(N[(0.3333333333333333 + N[(-0.25 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.1 \cdot 10^{+76}:\\
\;\;\;\;\frac{\frac{1 - \frac{0.5 + \frac{0.3333333333333333 + \frac{-0.25}{x}}{x}}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 3.10000000000000011e76Initial program 41.6%
Taylor expanded in n around inf 49.0%
log1p-define49.0%
Simplified49.0%
Taylor expanded in x around -inf 15.3%
add-sqr-sqrt0.7%
sqrt-unprod15.0%
sqr-neg15.0%
mul-1-neg15.0%
mul-1-neg15.0%
sqrt-unprod14.4%
add-sqr-sqrt40.3%
sub-neg40.3%
un-div-inv40.3%
metadata-eval40.3%
Applied egg-rr40.3%
neg-mul-140.3%
distribute-neg-frac40.3%
+-commutative40.3%
distribute-neg-in40.3%
metadata-eval40.3%
distribute-neg-frac40.3%
metadata-eval40.3%
Simplified40.3%
if 3.10000000000000011e76 < x Initial program 81.8%
sub-neg81.8%
+-commutative81.8%
add-log-exp81.8%
add-log-exp81.8%
sum-log81.8%
pow-to-exp81.8%
un-div-inv81.8%
+-commutative81.8%
log1p-define81.8%
Applied egg-rr81.8%
Taylor expanded in n around inf 81.8%
prod-exp81.8%
metadata-eval81.8%
1-exp81.8%
metadata-eval81.8%
Simplified81.8%
Final simplification52.8%
(FPCore (x n) :precision binary64 (if (<= x 1e+75) (/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* x n)) (/ 0.5 n)) x)) x) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 1e+75) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1d+75) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (x * n)) - (0.5d0 / n)) / x)) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1e+75) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1e+75: tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 1e+75) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(x * n)) - Float64(0.5 / n)) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1e+75) tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1e+75], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{+75}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 9.99999999999999927e74Initial program 41.6%
Taylor expanded in n around inf 49.0%
log1p-define49.0%
Simplified49.0%
Taylor expanded in x around -inf 40.1%
associate-*r/40.1%
mul-1-neg40.1%
associate-*r/40.1%
mul-1-neg40.1%
associate-*r/40.1%
metadata-eval40.1%
*-commutative40.1%
associate-*r/40.1%
metadata-eval40.1%
Simplified40.1%
if 9.99999999999999927e74 < x Initial program 81.8%
sub-neg81.8%
+-commutative81.8%
add-log-exp81.8%
add-log-exp81.8%
sum-log81.8%
pow-to-exp81.8%
un-div-inv81.8%
+-commutative81.8%
log1p-define81.8%
Applied egg-rr81.8%
Taylor expanded in n around inf 81.8%
prod-exp81.8%
metadata-eval81.8%
1-exp81.8%
metadata-eval81.8%
Simplified81.8%
Final simplification52.6%
(FPCore (x n) :precision binary64 (if (<= x 2.9e+73) (/ (/ (+ (/ (+ 0.5 (/ -0.3333333333333333 x)) x) -1.0) (- x)) n) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 2.9e+73) {
tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 2.9d+73) then
tmp = ((((0.5d0 + ((-0.3333333333333333d0) / x)) / x) + (-1.0d0)) / -x) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 2.9e+73) {
tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2.9e+73: tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 2.9e+73) tmp = Float64(Float64(Float64(Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x) + -1.0) / Float64(-x)) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 2.9e+73) tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2.9e+73], N[(N[(N[(N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + -1.0), $MachinePrecision] / (-x)), $MachinePrecision] / n), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.9 \cdot 10^{+73}:\\
\;\;\;\;\frac{\frac{\frac{0.5 + \frac{-0.3333333333333333}{x}}{x} + -1}{-x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.9000000000000002e73Initial program 41.6%
Taylor expanded in n around inf 49.0%
log1p-define49.0%
Simplified49.0%
log1p-undefine49.0%
diff-log49.1%
Applied egg-rr49.1%
+-commutative49.1%
Simplified49.1%
Taylor expanded in x around -inf 40.1%
mul-1-neg40.1%
distribute-neg-frac240.1%
sub-neg40.1%
associate-*r/40.1%
sub-neg40.1%
metadata-eval40.1%
distribute-lft-in40.1%
neg-mul-140.1%
associate-*r/40.1%
metadata-eval40.1%
distribute-neg-frac40.1%
metadata-eval40.1%
metadata-eval40.1%
metadata-eval40.1%
Simplified40.1%
if 2.9000000000000002e73 < x Initial program 81.8%
sub-neg81.8%
+-commutative81.8%
add-log-exp81.8%
add-log-exp81.8%
sum-log81.8%
pow-to-exp81.8%
un-div-inv81.8%
+-commutative81.8%
log1p-define81.8%
Applied egg-rr81.8%
Taylor expanded in n around inf 81.8%
prod-exp81.8%
metadata-eval81.8%
1-exp81.8%
metadata-eval81.8%
Simplified81.8%
Final simplification52.6%
(FPCore (x n) :precision binary64 (if (<= x 9.5e+76) (/ (/ 1.0 n) x) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 9.5e+76) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 9.5d+76) then
tmp = (1.0d0 / n) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 9.5e+76) {
tmp = (1.0 / n) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 9.5e+76: tmp = (1.0 / n) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 9.5e+76) tmp = Float64(Float64(1.0 / n) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 9.5e+76) tmp = (1.0 / n) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 9.5e+76], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.5 \cdot 10^{+76}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 9.5000000000000003e76Initial program 41.6%
Taylor expanded in n around inf 49.0%
log1p-define49.0%
Simplified49.0%
Taylor expanded in x around inf 32.2%
associate-/r*32.6%
Simplified32.6%
if 9.5000000000000003e76 < x Initial program 81.8%
sub-neg81.8%
+-commutative81.8%
add-log-exp81.8%
add-log-exp81.8%
sum-log81.8%
pow-to-exp81.8%
un-div-inv81.8%
+-commutative81.8%
log1p-define81.8%
Applied egg-rr81.8%
Taylor expanded in n around inf 81.8%
prod-exp81.8%
metadata-eval81.8%
1-exp81.8%
metadata-eval81.8%
Simplified81.8%
(FPCore (x n) :precision binary64 (if (<= x 6.5e+76) (/ 1.0 (* x n)) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 6.5e+76) {
tmp = 1.0 / (x * n);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 6.5d+76) then
tmp = 1.0d0 / (x * n)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 6.5e+76) {
tmp = 1.0 / (x * n);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 6.5e+76: tmp = 1.0 / (x * n) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 6.5e+76) tmp = Float64(1.0 / Float64(x * n)); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 6.5e+76) tmp = 1.0 / (x * n); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 6.5e+76], N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.5 \cdot 10^{+76}:\\
\;\;\;\;\frac{1}{x \cdot n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 6.5000000000000005e76Initial program 41.6%
Taylor expanded in n around inf 49.0%
log1p-define49.0%
Simplified49.0%
Taylor expanded in x around inf 32.2%
if 6.5000000000000005e76 < x Initial program 81.8%
sub-neg81.8%
+-commutative81.8%
add-log-exp81.8%
add-log-exp81.8%
sum-log81.8%
pow-to-exp81.8%
un-div-inv81.8%
+-commutative81.8%
log1p-define81.8%
Applied egg-rr81.8%
Taylor expanded in n around inf 81.8%
prod-exp81.8%
metadata-eval81.8%
1-exp81.8%
metadata-eval81.8%
Simplified81.8%
Final simplification47.1%
(FPCore (x n) :precision binary64 0.0)
double code(double x, double n) {
return 0.0;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 0.0d0
end function
public static double code(double x, double n) {
return 0.0;
}
def code(x, n): return 0.0
function code(x, n) return 0.0 end
function tmp = code(x, n) tmp = 0.0; end
code[x_, n_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 53.7%
sub-neg53.7%
+-commutative53.7%
add-log-exp53.3%
add-log-exp53.3%
sum-log53.2%
pow-to-exp53.2%
un-div-inv53.2%
+-commutative53.2%
log1p-define57.4%
Applied egg-rr57.4%
Taylor expanded in n around inf 29.4%
prod-exp29.4%
metadata-eval29.4%
1-exp29.4%
metadata-eval29.4%
Simplified29.4%
herbie shell --seed 2024088
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))