
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (exp (/ (log x) n)) (* n x))))
(if (<= (/ 1.0 n) -5e-61)
t_0
(if (<= (/ 1.0 n) 4e-65)
(/ (log (/ x (+ 1.0 x))) (- n))
(if (<= (/ 1.0 n) 1e-10)
t_0
(log (exp (- (exp (/ (log1p x) n)) (pow x (/ 1.0 n))))))))))
double code(double x, double n) {
double t_0 = exp((log(x) / n)) / (n * x);
double tmp;
if ((1.0 / n) <= -5e-61) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-65) {
tmp = log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 1e-10) {
tmp = t_0;
} else {
tmp = log(exp((exp((log1p(x) / n)) - pow(x, (1.0 / n)))));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.exp((Math.log(x) / n)) / (n * x);
double tmp;
if ((1.0 / n) <= -5e-61) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-65) {
tmp = Math.log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 1e-10) {
tmp = t_0;
} else {
tmp = Math.log(Math.exp((Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n)))));
}
return tmp;
}
def code(x, n): t_0 = math.exp((math.log(x) / n)) / (n * x) tmp = 0 if (1.0 / n) <= -5e-61: tmp = t_0 elif (1.0 / n) <= 4e-65: tmp = math.log((x / (1.0 + x))) / -n elif (1.0 / n) <= 1e-10: tmp = t_0 else: tmp = math.log(math.exp((math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n))))) return tmp
function code(x, n) t_0 = Float64(exp(Float64(log(x) / n)) / Float64(n * x)) tmp = 0.0 if (Float64(1.0 / n) <= -5e-61) tmp = t_0; elseif (Float64(1.0 / n) <= 4e-65) tmp = Float64(log(Float64(x / Float64(1.0 + x))) / Float64(-n)); elseif (Float64(1.0 / n) <= 1e-10) tmp = t_0; else tmp = log(exp(Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-61], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-65], N[(N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-10], t$95$0, N[Log[N[Exp[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}
t_0 := \frac{e^{\frac{\log x}{n}}}{n \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-61}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-65}:\\
\;\;\;\;\frac{\log \left(\frac{x}{1 + x}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-10}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{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.9999999999999999e-61 or 3.99999999999999969e-65 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-10Initial program 77.2%
Taylor expanded in x around inf 91.5%
mul-1-neg91.5%
log-rec91.5%
mul-1-neg91.5%
distribute-neg-frac91.5%
mul-1-neg91.5%
remove-double-neg91.5%
*-commutative91.5%
Simplified91.5%
if -4.9999999999999999e-61 < (/.f64 #s(literal 1 binary64) n) < 3.99999999999999969e-65Initial program 23.1%
Taylor expanded in n around inf 83.6%
Simplified83.6%
add-log-exp83.6%
associate-+r-83.6%
exp-diff83.6%
add-exp-log67.0%
Applied egg-rr67.0%
associate-*r/67.0%
*-commutative67.0%
associate-/l*67.0%
Simplified67.0%
Taylor expanded in n around inf 83.9%
+-commutative83.9%
Simplified83.9%
clear-num83.9%
log-div84.0%
metadata-eval84.0%
Applied egg-rr84.0%
neg-sub084.0%
Simplified84.0%
if 1.00000000000000004e-10 < (/.f64 #s(literal 1 binary64) n) Initial program 57.5%
add-log-exp57.6%
pow-to-exp57.6%
un-div-inv57.6%
+-commutative57.6%
log1p-define99.7%
Applied egg-rr99.7%
Final simplification89.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (exp (/ (log x) n)) (* n x))))
(if (<= (/ 1.0 n) -5e-61)
t_0
(if (<= (/ 1.0 n) 4e-65)
(/ (log (/ x (+ 1.0 x))) (- n))
(if (<= (/ 1.0 n) 1e-10)
t_0
(- (exp (/ (log1p x) n)) (pow x (/ 1.0 n))))))))
double code(double x, double n) {
double t_0 = exp((log(x) / n)) / (n * x);
double tmp;
if ((1.0 / n) <= -5e-61) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-65) {
tmp = log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 1e-10) {
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.exp((Math.log(x) / n)) / (n * x);
double tmp;
if ((1.0 / n) <= -5e-61) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-65) {
tmp = Math.log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 1e-10) {
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.exp((math.log(x) / n)) / (n * x) tmp = 0 if (1.0 / n) <= -5e-61: tmp = t_0 elif (1.0 / n) <= 4e-65: tmp = math.log((x / (1.0 + x))) / -n elif (1.0 / n) <= 1e-10: 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(exp(Float64(log(x) / n)) / Float64(n * x)) tmp = 0.0 if (Float64(1.0 / n) <= -5e-61) tmp = t_0; elseif (Float64(1.0 / n) <= 4e-65) tmp = Float64(log(Float64(x / Float64(1.0 + x))) / Float64(-n)); elseif (Float64(1.0 / n) <= 1e-10) 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[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-61], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-65], N[(N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-10], 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{e^{\frac{\log x}{n}}}{n \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-61}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-65}:\\
\;\;\;\;\frac{\log \left(\frac{x}{1 + x}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-10}:\\
\;\;\;\;t\_0\\
\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.9999999999999999e-61 or 3.99999999999999969e-65 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-10Initial program 77.2%
Taylor expanded in x around inf 91.5%
mul-1-neg91.5%
log-rec91.5%
mul-1-neg91.5%
distribute-neg-frac91.5%
mul-1-neg91.5%
remove-double-neg91.5%
*-commutative91.5%
Simplified91.5%
if -4.9999999999999999e-61 < (/.f64 #s(literal 1 binary64) n) < 3.99999999999999969e-65Initial program 23.1%
Taylor expanded in n around inf 83.6%
Simplified83.6%
add-log-exp83.6%
associate-+r-83.6%
exp-diff83.6%
add-exp-log67.0%
Applied egg-rr67.0%
associate-*r/67.0%
*-commutative67.0%
associate-/l*67.0%
Simplified67.0%
Taylor expanded in n around inf 83.9%
+-commutative83.9%
Simplified83.9%
clear-num83.9%
log-div84.0%
metadata-eval84.0%
Applied egg-rr84.0%
neg-sub084.0%
Simplified84.0%
if 1.00000000000000004e-10 < (/.f64 #s(literal 1 binary64) n) Initial program 57.5%
Taylor expanded in n around 0 57.5%
log1p-define99.6%
Simplified99.6%
Final simplification89.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (exp (/ (log x) n)) (* n x))))
(if (<= (/ 1.0 n) -5e-61)
t_0
(if (<= (/ 1.0 n) 4e-65)
(/ (log (/ x (+ 1.0 x))) (- n))
(if (<= (/ 1.0 n) 1e-10)
t_0
(-
(+
1.0
(*
x
(+
(/ 1.0 n)
(* x (+ (* 0.5 (/ 1.0 (pow n 2.0))) (* 0.5 (/ -1.0 n)))))))
(pow x (/ 1.0 n))))))))
double code(double x, double n) {
double t_0 = exp((log(x) / n)) / (n * x);
double tmp;
if ((1.0 / n) <= -5e-61) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-65) {
tmp = log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 1e-10) {
tmp = t_0;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / pow(n, 2.0))) + (0.5 * (-1.0 / 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) :: t_0
real(8) :: tmp
t_0 = exp((log(x) / n)) / (n * x)
if ((1.0d0 / n) <= (-5d-61)) then
tmp = t_0
else if ((1.0d0 / n) <= 4d-65) then
tmp = log((x / (1.0d0 + x))) / -n
else if ((1.0d0 / n) <= 1d-10) then
tmp = t_0
else
tmp = (1.0d0 + (x * ((1.0d0 / n) + (x * ((0.5d0 * (1.0d0 / (n ** 2.0d0))) + (0.5d0 * ((-1.0d0) / n))))))) - (x ** (1.0d0 / n))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.exp((Math.log(x) / n)) / (n * x);
double tmp;
if ((1.0 / n) <= -5e-61) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-65) {
tmp = Math.log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 1e-10) {
tmp = t_0;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / Math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))))) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): t_0 = math.exp((math.log(x) / n)) / (n * x) tmp = 0 if (1.0 / n) <= -5e-61: tmp = t_0 elif (1.0 / n) <= 4e-65: tmp = math.log((x / (1.0 + x))) / -n elif (1.0 / n) <= 1e-10: tmp = t_0 else: tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))))) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) t_0 = Float64(exp(Float64(log(x) / n)) / Float64(n * x)) tmp = 0.0 if (Float64(1.0 / n) <= -5e-61) tmp = t_0; elseif (Float64(1.0 / n) <= 4e-65) tmp = Float64(log(Float64(x / Float64(1.0 + x))) / Float64(-n)); elseif (Float64(1.0 / n) <= 1e-10) tmp = t_0; else tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(x * Float64(Float64(0.5 * Float64(1.0 / (n ^ 2.0))) + Float64(0.5 * Float64(-1.0 / n))))))) - (x ^ Float64(1.0 / n))); end return tmp end
function tmp_2 = code(x, n) t_0 = exp((log(x) / n)) / (n * x); tmp = 0.0; if ((1.0 / n) <= -5e-61) tmp = t_0; elseif ((1.0 / n) <= 4e-65) tmp = log((x / (1.0 + x))) / -n; elseif ((1.0 / n) <= 1e-10) tmp = t_0; else tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / (n ^ 2.0))) + (0.5 * (-1.0 / n))))))) - (x ^ (1.0 / n)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-61], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-65], N[(N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-10], t$95$0, N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(x * N[(N[(0.5 * N[(1.0 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{e^{\frac{\log x}{n}}}{n \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-61}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-65}:\\
\;\;\;\;\frac{\log \left(\frac{x}{1 + x}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-10}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + x \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)\right)\right) - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.9999999999999999e-61 or 3.99999999999999969e-65 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-10Initial program 77.2%
Taylor expanded in x around inf 91.5%
mul-1-neg91.5%
log-rec91.5%
mul-1-neg91.5%
distribute-neg-frac91.5%
mul-1-neg91.5%
remove-double-neg91.5%
*-commutative91.5%
Simplified91.5%
if -4.9999999999999999e-61 < (/.f64 #s(literal 1 binary64) n) < 3.99999999999999969e-65Initial program 23.1%
Taylor expanded in n around inf 83.6%
Simplified83.6%
add-log-exp83.6%
associate-+r-83.6%
exp-diff83.6%
add-exp-log67.0%
Applied egg-rr67.0%
associate-*r/67.0%
*-commutative67.0%
associate-/l*67.0%
Simplified67.0%
Taylor expanded in n around inf 83.9%
+-commutative83.9%
Simplified83.9%
clear-num83.9%
log-div84.0%
metadata-eval84.0%
Applied egg-rr84.0%
neg-sub084.0%
Simplified84.0%
if 1.00000000000000004e-10 < (/.f64 #s(literal 1 binary64) n) Initial program 57.5%
Taylor expanded in x around 0 79.0%
Final simplification86.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (exp (/ (log x) n)) (* n x))))
(if (<= (/ 1.0 n) -5e-61)
t_0
(if (<= (/ 1.0 n) 4e-65)
(/ (log (/ x (+ 1.0 x))) (- n))
(if (<= (/ 1.0 n) 1e-10)
t_0
(if (<= (/ 1.0 n) 5e+176)
(- (+ 1.0 (/ x n)) (pow x (/ 1.0 n)))
(+ (exp (/ (log1p x) n)) -1.0)))))))
double code(double x, double n) {
double t_0 = exp((log(x) / n)) / (n * x);
double tmp;
if ((1.0 / n) <= -5e-61) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-65) {
tmp = log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 1e-10) {
tmp = t_0;
} else if ((1.0 / n) <= 5e+176) {
tmp = (1.0 + (x / n)) - pow(x, (1.0 / n));
} else {
tmp = exp((log1p(x) / n)) + -1.0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.exp((Math.log(x) / n)) / (n * x);
double tmp;
if ((1.0 / n) <= -5e-61) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-65) {
tmp = Math.log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 1e-10) {
tmp = t_0;
} else if ((1.0 / n) <= 5e+176) {
tmp = (1.0 + (x / n)) - Math.pow(x, (1.0 / n));
} else {
tmp = Math.exp((Math.log1p(x) / n)) + -1.0;
}
return tmp;
}
def code(x, n): t_0 = math.exp((math.log(x) / n)) / (n * x) tmp = 0 if (1.0 / n) <= -5e-61: tmp = t_0 elif (1.0 / n) <= 4e-65: tmp = math.log((x / (1.0 + x))) / -n elif (1.0 / n) <= 1e-10: tmp = t_0 elif (1.0 / n) <= 5e+176: tmp = (1.0 + (x / n)) - math.pow(x, (1.0 / n)) else: tmp = math.exp((math.log1p(x) / n)) + -1.0 return tmp
function code(x, n) t_0 = Float64(exp(Float64(log(x) / n)) / Float64(n * x)) tmp = 0.0 if (Float64(1.0 / n) <= -5e-61) tmp = t_0; elseif (Float64(1.0 / n) <= 4e-65) tmp = Float64(log(Float64(x / Float64(1.0 + x))) / Float64(-n)); elseif (Float64(1.0 / n) <= 1e-10) tmp = t_0; elseif (Float64(1.0 / n) <= 5e+176) tmp = Float64(Float64(1.0 + Float64(x / n)) - (x ^ Float64(1.0 / n))); else tmp = Float64(exp(Float64(log1p(x) / n)) + -1.0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-61], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-65], N[(N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-10], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+176], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{e^{\frac{\log x}{n}}}{n \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-61}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-65}:\\
\;\;\;\;\frac{\log \left(\frac{x}{1 + x}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-10}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+176}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} + -1\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.9999999999999999e-61 or 3.99999999999999969e-65 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-10Initial program 77.2%
Taylor expanded in x around inf 91.5%
mul-1-neg91.5%
log-rec91.5%
mul-1-neg91.5%
distribute-neg-frac91.5%
mul-1-neg91.5%
remove-double-neg91.5%
*-commutative91.5%
Simplified91.5%
if -4.9999999999999999e-61 < (/.f64 #s(literal 1 binary64) n) < 3.99999999999999969e-65Initial program 23.1%
Taylor expanded in n around inf 83.6%
Simplified83.6%
add-log-exp83.6%
associate-+r-83.6%
exp-diff83.6%
add-exp-log67.0%
Applied egg-rr67.0%
associate-*r/67.0%
*-commutative67.0%
associate-/l*67.0%
Simplified67.0%
Taylor expanded in n around inf 83.9%
+-commutative83.9%
Simplified83.9%
clear-num83.9%
log-div84.0%
metadata-eval84.0%
Applied egg-rr84.0%
neg-sub084.0%
Simplified84.0%
if 1.00000000000000004e-10 < (/.f64 #s(literal 1 binary64) n) < 5e176Initial program 82.6%
Taylor expanded in x around 0 82.7%
if 5e176 < (/.f64 #s(literal 1 binary64) n) Initial program 17.1%
Taylor expanded in n around 0 17.1%
log1p-define100.0%
Simplified100.0%
Taylor expanded in n around inf 84.7%
Final simplification86.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-61)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 4e-65)
(/ (log (/ x (+ 1.0 x))) (- n))
(if (<= (/ 1.0 n) 1e-10)
(/ (+ 1.0 (/ (log x) n)) (* n x))
(if (<= (/ 1.0 n) 5e+176)
(- (+ 1.0 (/ x n)) t_0)
(+ (exp (/ (log1p x) n)) -1.0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-61) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 4e-65) {
tmp = log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 1e-10) {
tmp = (1.0 + (log(x) / n)) / (n * x);
} else if ((1.0 / n) <= 5e+176) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = exp((log1p(x) / n)) + -1.0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-61) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 4e-65) {
tmp = Math.log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 1e-10) {
tmp = (1.0 + (Math.log(x) / n)) / (n * x);
} else if ((1.0 / n) <= 5e+176) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = Math.exp((Math.log1p(x) / n)) + -1.0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-61: tmp = (t_0 / n) / x elif (1.0 / n) <= 4e-65: tmp = math.log((x / (1.0 + x))) / -n elif (1.0 / n) <= 1e-10: tmp = (1.0 + (math.log(x) / n)) / (n * x) elif (1.0 / n) <= 5e+176: tmp = (1.0 + (x / n)) - t_0 else: tmp = math.exp((math.log1p(x) / n)) + -1.0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-61) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 4e-65) tmp = Float64(log(Float64(x / Float64(1.0 + x))) / Float64(-n)); elseif (Float64(1.0 / n) <= 1e-10) tmp = Float64(Float64(1.0 + Float64(log(x) / n)) / Float64(n * x)); elseif (Float64(1.0 / n) <= 5e+176) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(exp(Float64(log1p(x) / n)) + -1.0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-61], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-65], N[(N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-10], N[(N[(1.0 + N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+176], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-61}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-65}:\\
\;\;\;\;\frac{\log \left(\frac{x}{1 + x}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-10}:\\
\;\;\;\;\frac{1 + \frac{\log x}{n}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+176}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} + -1\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.9999999999999999e-61Initial program 91.3%
Taylor expanded in x around inf 96.5%
mul-1-neg96.5%
log-rec96.5%
mul-1-neg96.5%
distribute-neg-frac96.5%
mul-1-neg96.5%
remove-double-neg96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in x around 0 96.5%
associate-/r*96.4%
*-rgt-identity96.4%
associate-*l/96.4%
associate-*r/96.4%
exp-to-pow96.4%
Simplified96.4%
if -4.9999999999999999e-61 < (/.f64 #s(literal 1 binary64) n) < 3.99999999999999969e-65Initial program 23.1%
Taylor expanded in n around inf 83.6%
Simplified83.6%
add-log-exp83.6%
associate-+r-83.6%
exp-diff83.6%
add-exp-log67.0%
Applied egg-rr67.0%
associate-*r/67.0%
*-commutative67.0%
associate-/l*67.0%
Simplified67.0%
Taylor expanded in n around inf 83.9%
+-commutative83.9%
Simplified83.9%
clear-num83.9%
log-div84.0%
metadata-eval84.0%
Applied egg-rr84.0%
neg-sub084.0%
Simplified84.0%
if 3.99999999999999969e-65 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-10Initial program 16.3%
Taylor expanded in n around inf 45.5%
Simplified45.5%
Taylor expanded in x around inf 69.9%
mul-1-neg69.9%
log-rec69.9%
neg-mul-169.9%
associate-*r/69.9%
mul-1-neg69.9%
remove-double-neg69.9%
*-commutative69.9%
Simplified69.9%
if 1.00000000000000004e-10 < (/.f64 #s(literal 1 binary64) n) < 5e176Initial program 82.6%
Taylor expanded in x around 0 82.7%
if 5e176 < (/.f64 #s(literal 1 binary64) n) Initial program 17.1%
Taylor expanded in n around 0 17.1%
log1p-define100.0%
Simplified100.0%
Taylor expanded in n around inf 84.7%
Final simplification86.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) -2e+169)
(/ (/ (/ n x) n) n)
(if (<= (/ 1.0 n) -400000.0)
t_0
(if (<= (/ 1.0 n) 5e-90)
(/ (- x (log x)) n)
(if (<= (/ 1.0 n) 1e-10)
(/ (/ (+ 1.0 (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) x) n)
(if (<= (/ 1.0 n) 5e+176)
t_0
(/
(+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* n x)) (/ -0.5 n)) x))
x))))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e+169) {
tmp = ((n / x) / n) / n;
} else if ((1.0 / n) <= -400000.0) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-90) {
tmp = (x - log(x)) / n;
} else if ((1.0 / n) <= 1e-10) {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
} else if ((1.0 / n) <= 5e+176) {
tmp = t_0;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
if ((1.0d0 / n) <= (-2d+169)) then
tmp = ((n / x) / n) / n
else if ((1.0d0 / n) <= (-400000.0d0)) then
tmp = t_0
else if ((1.0d0 / n) <= 5d-90) then
tmp = (x - log(x)) / n
else if ((1.0d0 / n) <= 1d-10) then
tmp = ((1.0d0 + (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) / x) / n
else if ((1.0d0 / n) <= 5d+176) then
tmp = t_0
else
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) + ((-0.5d0) / n)) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e+169) {
tmp = ((n / x) / n) / n;
} else if ((1.0 / n) <= -400000.0) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-90) {
tmp = (x - Math.log(x)) / n;
} else if ((1.0 / n) <= 1e-10) {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
} else if ((1.0 / n) <= 5e+176) {
tmp = t_0;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e+169: tmp = ((n / x) / n) / n elif (1.0 / n) <= -400000.0: tmp = t_0 elif (1.0 / n) <= 5e-90: tmp = (x - math.log(x)) / n elif (1.0 / n) <= 1e-10: tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n elif (1.0 / n) <= 5e+176: tmp = t_0 else: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (Float64(1.0 / n) <= -2e+169) tmp = Float64(Float64(Float64(n / x) / n) / n); elseif (Float64(1.0 / n) <= -400000.0) tmp = t_0; elseif (Float64(1.0 / n) <= 5e-90) tmp = Float64(Float64(x - log(x)) / n); elseif (Float64(1.0 / n) <= 1e-10) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) / x) / n); elseif (Float64(1.0 / n) <= 5e+176) tmp = t_0; else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) + Float64(-0.5 / n)) / x)) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if ((1.0 / n) <= -2e+169) tmp = ((n / x) / n) / n; elseif ((1.0 / n) <= -400000.0) tmp = t_0; elseif ((1.0 / n) <= 5e-90) tmp = (x - log(x)) / n; elseif ((1.0 / n) <= 1e-10) tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n; elseif ((1.0 / n) <= 5e+176) tmp = t_0; else tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+169], N[(N[(N[(n / x), $MachinePrecision] / n), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -400000.0], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-90], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-10], N[(N[(N[(1.0 + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+176], t$95$0, N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $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^{+169}:\\
\;\;\;\;\frac{\frac{\frac{n}{x}}{n}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -400000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-90}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-10}:\\
\;\;\;\;\frac{\frac{1 + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+176}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999987e169Initial program 100.0%
Taylor expanded in n around inf 97.4%
Simplified97.4%
Taylor expanded in n around 0 97.4%
Taylor expanded in x around inf 50.9%
+-commutative50.9%
mul-1-neg50.9%
log-rec50.9%
remove-double-neg50.9%
Simplified50.9%
Taylor expanded in n around inf 67.3%
if -1.99999999999999987e169 < (/.f64 #s(literal 1 binary64) n) < -4e5 or 1.00000000000000004e-10 < (/.f64 #s(literal 1 binary64) n) < 5e176Initial program 92.3%
Taylor expanded in x around 0 68.4%
if -4e5 < (/.f64 #s(literal 1 binary64) n) < 5.00000000000000019e-90Initial program 22.6%
Taylor expanded in x around 0 13.4%
Taylor expanded in n around inf 59.8%
if 5.00000000000000019e-90 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-10Initial program 16.7%
Taylor expanded in n around inf 51.7%
Simplified51.7%
add-log-exp51.7%
associate-+r-51.7%
exp-diff51.7%
add-exp-log39.7%
Applied egg-rr39.7%
associate-*r/39.7%
*-commutative39.7%
associate-/l*39.7%
Simplified39.7%
Taylor expanded in n around inf 51.9%
+-commutative51.9%
Simplified51.9%
Taylor expanded in x around inf 62.5%
associate--l+62.5%
unpow262.5%
associate-/r*62.5%
metadata-eval62.5%
associate-*r/62.5%
associate-*r/62.5%
metadata-eval62.5%
div-sub62.5%
sub-neg62.5%
metadata-eval62.5%
+-commutative62.5%
associate-*r/62.5%
metadata-eval62.5%
Simplified62.5%
if 5e176 < (/.f64 #s(literal 1 binary64) n) Initial program 17.1%
Taylor expanded in n around inf 0.1%
Simplified0.1%
add-log-exp0.1%
associate-+r-0.1%
exp-diff0.1%
add-exp-log0.1%
Applied egg-rr0.1%
associate-*r/0.1%
*-commutative0.1%
associate-/l*0.1%
Simplified0.1%
Taylor expanded in n around inf 7.1%
+-commutative7.1%
Simplified7.1%
Taylor expanded in x around inf 6.1%
Simplified78.8%
Final simplification64.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-61)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 4e-65)
(/ (log (/ x (+ 1.0 x))) (- n))
(if (<= (/ 1.0 n) 1e-10)
(/ (+ 1.0 (/ (log x) n)) (* n x))
(if (<= (/ 1.0 n) 5e+176)
(- (+ 1.0 (/ x n)) t_0)
(/
(+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* n x)) (/ -0.5 n)) x))
x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-61) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 4e-65) {
tmp = log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 1e-10) {
tmp = (1.0 + (log(x) / n)) / (n * x);
} else if ((1.0 / n) <= 5e+176) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-5d-61)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 4d-65) then
tmp = log((x / (1.0d0 + x))) / -n
else if ((1.0d0 / n) <= 1d-10) then
tmp = (1.0d0 + (log(x) / n)) / (n * x)
else if ((1.0d0 / n) <= 5d+176) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) + ((-0.5d0) / n)) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-61) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 4e-65) {
tmp = Math.log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 1e-10) {
tmp = (1.0 + (Math.log(x) / n)) / (n * x);
} else if ((1.0 / n) <= 5e+176) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-61: tmp = (t_0 / n) / x elif (1.0 / n) <= 4e-65: tmp = math.log((x / (1.0 + x))) / -n elif (1.0 / n) <= 1e-10: tmp = (1.0 + (math.log(x) / n)) / (n * x) elif (1.0 / n) <= 5e+176: tmp = (1.0 + (x / n)) - t_0 else: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-61) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 4e-65) tmp = Float64(log(Float64(x / Float64(1.0 + x))) / Float64(-n)); elseif (Float64(1.0 / n) <= 1e-10) tmp = Float64(Float64(1.0 + Float64(log(x) / n)) / Float64(n * x)); elseif (Float64(1.0 / n) <= 5e+176) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) + Float64(-0.5 / n)) / x)) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -5e-61) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 4e-65) tmp = log((x / (1.0 + x))) / -n; elseif ((1.0 / n) <= 1e-10) tmp = (1.0 + (log(x) / n)) / (n * x); elseif ((1.0 / n) <= 5e+176) tmp = (1.0 + (x / n)) - t_0; else tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-61], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-65], N[(N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-10], N[(N[(1.0 + N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+176], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-61}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-65}:\\
\;\;\;\;\frac{\log \left(\frac{x}{1 + x}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-10}:\\
\;\;\;\;\frac{1 + \frac{\log x}{n}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+176}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.9999999999999999e-61Initial program 91.3%
Taylor expanded in x around inf 96.5%
mul-1-neg96.5%
log-rec96.5%
mul-1-neg96.5%
distribute-neg-frac96.5%
mul-1-neg96.5%
remove-double-neg96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in x around 0 96.5%
associate-/r*96.4%
*-rgt-identity96.4%
associate-*l/96.4%
associate-*r/96.4%
exp-to-pow96.4%
Simplified96.4%
if -4.9999999999999999e-61 < (/.f64 #s(literal 1 binary64) n) < 3.99999999999999969e-65Initial program 23.1%
Taylor expanded in n around inf 83.6%
Simplified83.6%
add-log-exp83.6%
associate-+r-83.6%
exp-diff83.6%
add-exp-log67.0%
Applied egg-rr67.0%
associate-*r/67.0%
*-commutative67.0%
associate-/l*67.0%
Simplified67.0%
Taylor expanded in n around inf 83.9%
+-commutative83.9%
Simplified83.9%
clear-num83.9%
log-div84.0%
metadata-eval84.0%
Applied egg-rr84.0%
neg-sub084.0%
Simplified84.0%
if 3.99999999999999969e-65 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-10Initial program 16.3%
Taylor expanded in n around inf 45.5%
Simplified45.5%
Taylor expanded in x around inf 69.9%
mul-1-neg69.9%
log-rec69.9%
neg-mul-169.9%
associate-*r/69.9%
mul-1-neg69.9%
remove-double-neg69.9%
*-commutative69.9%
Simplified69.9%
if 1.00000000000000004e-10 < (/.f64 #s(literal 1 binary64) n) < 5e176Initial program 82.6%
Taylor expanded in x around 0 82.7%
if 5e176 < (/.f64 #s(literal 1 binary64) n) Initial program 17.1%
Taylor expanded in n around inf 0.1%
Simplified0.1%
add-log-exp0.1%
associate-+r-0.1%
exp-diff0.1%
add-exp-log0.1%
Applied egg-rr0.1%
associate-*r/0.1%
*-commutative0.1%
associate-/l*0.1%
Simplified0.1%
Taylor expanded in n around inf 7.1%
+-commutative7.1%
Simplified7.1%
Taylor expanded in x around inf 6.1%
Simplified78.8%
Final simplification86.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-61)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 4e-65)
(/ (log (/ x (+ 1.0 x))) (- n))
(if (<= (/ 1.0 n) 1e-10)
(/ (+ 1.0 (/ (log x) n)) (* n x))
(if (<= (/ 1.0 n) 5e+176)
(- 1.0 t_0)
(/
(+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* n x)) (/ -0.5 n)) x))
x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-61) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 4e-65) {
tmp = log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 1e-10) {
tmp = (1.0 + (log(x) / n)) / (n * x);
} else if ((1.0 / n) <= 5e+176) {
tmp = 1.0 - t_0;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-5d-61)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 4d-65) then
tmp = log((x / (1.0d0 + x))) / -n
else if ((1.0d0 / n) <= 1d-10) then
tmp = (1.0d0 + (log(x) / n)) / (n * x)
else if ((1.0d0 / n) <= 5d+176) then
tmp = 1.0d0 - t_0
else
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) + ((-0.5d0) / n)) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-61) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 4e-65) {
tmp = Math.log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 1e-10) {
tmp = (1.0 + (Math.log(x) / n)) / (n * x);
} else if ((1.0 / n) <= 5e+176) {
tmp = 1.0 - t_0;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-61: tmp = (t_0 / n) / x elif (1.0 / n) <= 4e-65: tmp = math.log((x / (1.0 + x))) / -n elif (1.0 / n) <= 1e-10: tmp = (1.0 + (math.log(x) / n)) / (n * x) elif (1.0 / n) <= 5e+176: tmp = 1.0 - t_0 else: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-61) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 4e-65) tmp = Float64(log(Float64(x / Float64(1.0 + x))) / Float64(-n)); elseif (Float64(1.0 / n) <= 1e-10) tmp = Float64(Float64(1.0 + Float64(log(x) / n)) / Float64(n * x)); elseif (Float64(1.0 / n) <= 5e+176) tmp = Float64(1.0 - t_0); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) + Float64(-0.5 / n)) / x)) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -5e-61) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 4e-65) tmp = log((x / (1.0 + x))) / -n; elseif ((1.0 / n) <= 1e-10) tmp = (1.0 + (log(x) / n)) / (n * x); elseif ((1.0 / n) <= 5e+176) tmp = 1.0 - t_0; else tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-61], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-65], N[(N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-10], N[(N[(1.0 + N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+176], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-61}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-65}:\\
\;\;\;\;\frac{\log \left(\frac{x}{1 + x}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-10}:\\
\;\;\;\;\frac{1 + \frac{\log x}{n}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+176}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.9999999999999999e-61Initial program 91.3%
Taylor expanded in x around inf 96.5%
mul-1-neg96.5%
log-rec96.5%
mul-1-neg96.5%
distribute-neg-frac96.5%
mul-1-neg96.5%
remove-double-neg96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in x around 0 96.5%
associate-/r*96.4%
*-rgt-identity96.4%
associate-*l/96.4%
associate-*r/96.4%
exp-to-pow96.4%
Simplified96.4%
if -4.9999999999999999e-61 < (/.f64 #s(literal 1 binary64) n) < 3.99999999999999969e-65Initial program 23.1%
Taylor expanded in n around inf 83.6%
Simplified83.6%
add-log-exp83.6%
associate-+r-83.6%
exp-diff83.6%
add-exp-log67.0%
Applied egg-rr67.0%
associate-*r/67.0%
*-commutative67.0%
associate-/l*67.0%
Simplified67.0%
Taylor expanded in n around inf 83.9%
+-commutative83.9%
Simplified83.9%
clear-num83.9%
log-div84.0%
metadata-eval84.0%
Applied egg-rr84.0%
neg-sub084.0%
Simplified84.0%
if 3.99999999999999969e-65 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-10Initial program 16.3%
Taylor expanded in n around inf 45.5%
Simplified45.5%
Taylor expanded in x around inf 69.9%
mul-1-neg69.9%
log-rec69.9%
neg-mul-169.9%
associate-*r/69.9%
mul-1-neg69.9%
remove-double-neg69.9%
*-commutative69.9%
Simplified69.9%
if 1.00000000000000004e-10 < (/.f64 #s(literal 1 binary64) n) < 5e176Initial program 82.6%
Taylor expanded in x around 0 82.6%
if 5e176 < (/.f64 #s(literal 1 binary64) n) Initial program 17.1%
Taylor expanded in n around inf 0.1%
Simplified0.1%
add-log-exp0.1%
associate-+r-0.1%
exp-diff0.1%
add-exp-log0.1%
Applied egg-rr0.1%
associate-*r/0.1%
*-commutative0.1%
associate-/l*0.1%
Simplified0.1%
Taylor expanded in n around inf 7.1%
+-commutative7.1%
Simplified7.1%
Taylor expanded in x around inf 6.1%
Simplified78.8%
Final simplification86.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (/ t_0 n) x)))
(if (<= (/ 1.0 n) -5e-61)
t_1
(if (<= (/ 1.0 n) 4e-65)
(/ (log (/ x (+ 1.0 x))) (- n))
(if (<= (/ 1.0 n) 1e-10)
t_1
(if (<= (/ 1.0 n) 5e+176)
(- 1.0 t_0)
(/
(+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* n x)) (/ -0.5 n)) x))
x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = (t_0 / n) / x;
double tmp;
if ((1.0 / n) <= -5e-61) {
tmp = t_1;
} else if ((1.0 / n) <= 4e-65) {
tmp = log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 1e-10) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+176) {
tmp = 1.0 - t_0;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = (t_0 / n) / x
if ((1.0d0 / n) <= (-5d-61)) then
tmp = t_1
else if ((1.0d0 / n) <= 4d-65) then
tmp = log((x / (1.0d0 + x))) / -n
else if ((1.0d0 / n) <= 1d-10) then
tmp = t_1
else if ((1.0d0 / n) <= 5d+176) then
tmp = 1.0d0 - t_0
else
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) + ((-0.5d0) / n)) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = (t_0 / n) / x;
double tmp;
if ((1.0 / n) <= -5e-61) {
tmp = t_1;
} else if ((1.0 / n) <= 4e-65) {
tmp = Math.log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 1e-10) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+176) {
tmp = 1.0 - t_0;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = (t_0 / n) / x tmp = 0 if (1.0 / n) <= -5e-61: tmp = t_1 elif (1.0 / n) <= 4e-65: tmp = math.log((x / (1.0 + x))) / -n elif (1.0 / n) <= 1e-10: tmp = t_1 elif (1.0 / n) <= 5e+176: tmp = 1.0 - t_0 else: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(t_0 / n) / x) tmp = 0.0 if (Float64(1.0 / n) <= -5e-61) tmp = t_1; elseif (Float64(1.0 / n) <= 4e-65) tmp = Float64(log(Float64(x / Float64(1.0 + x))) / Float64(-n)); elseif (Float64(1.0 / n) <= 1e-10) tmp = t_1; elseif (Float64(1.0 / n) <= 5e+176) tmp = Float64(1.0 - t_0); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) + Float64(-0.5 / n)) / x)) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = (t_0 / n) / x; tmp = 0.0; if ((1.0 / n) <= -5e-61) tmp = t_1; elseif ((1.0 / n) <= 4e-65) tmp = log((x / (1.0 + x))) / -n; elseif ((1.0 / n) <= 1e-10) tmp = t_1; elseif ((1.0 / n) <= 5e+176) tmp = 1.0 - t_0; else tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-61], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-65], N[(N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-10], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+176], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\frac{t\_0}{n}}{x}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-65}:\\
\;\;\;\;\frac{\log \left(\frac{x}{1 + x}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-10}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+176}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.9999999999999999e-61 or 3.99999999999999969e-65 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-10Initial program 77.2%
Taylor expanded in x around inf 91.5%
mul-1-neg91.5%
log-rec91.5%
mul-1-neg91.5%
distribute-neg-frac91.5%
mul-1-neg91.5%
remove-double-neg91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in x around 0 91.5%
associate-/r*91.4%
*-rgt-identity91.4%
associate-*l/91.4%
associate-*r/91.4%
exp-to-pow91.4%
Simplified91.4%
if -4.9999999999999999e-61 < (/.f64 #s(literal 1 binary64) n) < 3.99999999999999969e-65Initial program 23.1%
Taylor expanded in n around inf 83.6%
Simplified83.6%
add-log-exp83.6%
associate-+r-83.6%
exp-diff83.6%
add-exp-log67.0%
Applied egg-rr67.0%
associate-*r/67.0%
*-commutative67.0%
associate-/l*67.0%
Simplified67.0%
Taylor expanded in n around inf 83.9%
+-commutative83.9%
Simplified83.9%
clear-num83.9%
log-div84.0%
metadata-eval84.0%
Applied egg-rr84.0%
neg-sub084.0%
Simplified84.0%
if 1.00000000000000004e-10 < (/.f64 #s(literal 1 binary64) n) < 5e176Initial program 82.6%
Taylor expanded in x around 0 82.6%
if 5e176 < (/.f64 #s(literal 1 binary64) n) Initial program 17.1%
Taylor expanded in n around inf 0.1%
Simplified0.1%
add-log-exp0.1%
associate-+r-0.1%
exp-diff0.1%
add-exp-log0.1%
Applied egg-rr0.1%
associate-*r/0.1%
*-commutative0.1%
associate-/l*0.1%
Simplified0.1%
Taylor expanded in n around inf 7.1%
+-commutative7.1%
Simplified7.1%
Taylor expanded in x around inf 6.1%
Simplified78.8%
Final simplification86.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) -2e+169)
(/ (/ (/ n x) n) n)
(if (<= (/ 1.0 n) -5e+121)
t_0
(if (<= (/ 1.0 n) 1e-10)
(/ (log (/ x (+ 1.0 x))) (- n))
(if (<= (/ 1.0 n) 5e+176)
t_0
(/
(+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* n x)) (/ -0.5 n)) x))
x)))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e+169) {
tmp = ((n / x) / n) / n;
} else if ((1.0 / n) <= -5e+121) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-10) {
tmp = log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 5e+176) {
tmp = t_0;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
if ((1.0d0 / n) <= (-2d+169)) then
tmp = ((n / x) / n) / n
else if ((1.0d0 / n) <= (-5d+121)) then
tmp = t_0
else if ((1.0d0 / n) <= 1d-10) then
tmp = log((x / (1.0d0 + x))) / -n
else if ((1.0d0 / n) <= 5d+176) then
tmp = t_0
else
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) + ((-0.5d0) / n)) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e+169) {
tmp = ((n / x) / n) / n;
} else if ((1.0 / n) <= -5e+121) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-10) {
tmp = Math.log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 5e+176) {
tmp = t_0;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e+169: tmp = ((n / x) / n) / n elif (1.0 / n) <= -5e+121: tmp = t_0 elif (1.0 / n) <= 1e-10: tmp = math.log((x / (1.0 + x))) / -n elif (1.0 / n) <= 5e+176: tmp = t_0 else: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (Float64(1.0 / n) <= -2e+169) tmp = Float64(Float64(Float64(n / x) / n) / n); elseif (Float64(1.0 / n) <= -5e+121) tmp = t_0; elseif (Float64(1.0 / n) <= 1e-10) tmp = Float64(log(Float64(x / Float64(1.0 + x))) / Float64(-n)); elseif (Float64(1.0 / n) <= 5e+176) tmp = t_0; else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) + Float64(-0.5 / n)) / x)) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if ((1.0 / n) <= -2e+169) tmp = ((n / x) / n) / n; elseif ((1.0 / n) <= -5e+121) tmp = t_0; elseif ((1.0 / n) <= 1e-10) tmp = log((x / (1.0 + x))) / -n; elseif ((1.0 / n) <= 5e+176) tmp = t_0; else tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+169], N[(N[(N[(n / x), $MachinePrecision] / n), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e+121], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-10], N[(N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+176], t$95$0, N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $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^{+169}:\\
\;\;\;\;\frac{\frac{\frac{n}{x}}{n}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{+121}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-10}:\\
\;\;\;\;\frac{\log \left(\frac{x}{1 + x}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+176}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999987e169Initial program 100.0%
Taylor expanded in n around inf 97.4%
Simplified97.4%
Taylor expanded in n around 0 97.4%
Taylor expanded in x around inf 50.9%
+-commutative50.9%
mul-1-neg50.9%
log-rec50.9%
remove-double-neg50.9%
Simplified50.9%
Taylor expanded in n around inf 67.3%
if -1.99999999999999987e169 < (/.f64 #s(literal 1 binary64) n) < -5.00000000000000007e121 or 1.00000000000000004e-10 < (/.f64 #s(literal 1 binary64) n) < 5e176Initial program 88.3%
Taylor expanded in x around 0 79.3%
if -5.00000000000000007e121 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-10Initial program 32.4%
Taylor expanded in n around inf 73.0%
Simplified72.9%
add-log-exp79.1%
associate-+r-79.1%
exp-diff79.1%
add-exp-log58.8%
Applied egg-rr58.8%
associate-*r/58.8%
*-commutative58.8%
associate-/l*58.8%
Simplified58.8%
Taylor expanded in n around inf 72.9%
+-commutative72.9%
Simplified72.9%
clear-num72.9%
log-div73.0%
metadata-eval73.0%
Applied egg-rr73.0%
neg-sub073.0%
Simplified73.0%
if 5e176 < (/.f64 #s(literal 1 binary64) n) Initial program 17.1%
Taylor expanded in n around inf 0.1%
Simplified0.1%
add-log-exp0.1%
associate-+r-0.1%
exp-diff0.1%
add-exp-log0.1%
Applied egg-rr0.1%
associate-*r/0.1%
*-commutative0.1%
associate-/l*0.1%
Simplified0.1%
Taylor expanded in n around inf 7.1%
+-commutative7.1%
Simplified7.1%
Taylor expanded in x around inf 6.1%
Simplified78.8%
Final simplification73.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) -2e+169)
(/ (/ (/ n x) n) n)
(if (<= (/ 1.0 n) -5e+121)
t_0
(if (<= (/ 1.0 n) 1e-10)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 5e+176)
t_0
(/
(+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* n x)) (/ -0.5 n)) x))
x)))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e+169) {
tmp = ((n / x) / n) / n;
} else if ((1.0 / n) <= -5e+121) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-10) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 5e+176) {
tmp = t_0;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
if ((1.0d0 / n) <= (-2d+169)) then
tmp = ((n / x) / n) / n
else if ((1.0d0 / n) <= (-5d+121)) then
tmp = t_0
else if ((1.0d0 / n) <= 1d-10) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 5d+176) then
tmp = t_0
else
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) + ((-0.5d0) / n)) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e+169) {
tmp = ((n / x) / n) / n;
} else if ((1.0 / n) <= -5e+121) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-10) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 5e+176) {
tmp = t_0;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e+169: tmp = ((n / x) / n) / n elif (1.0 / n) <= -5e+121: tmp = t_0 elif (1.0 / n) <= 1e-10: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 5e+176: tmp = t_0 else: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (Float64(1.0 / n) <= -2e+169) tmp = Float64(Float64(Float64(n / x) / n) / n); elseif (Float64(1.0 / n) <= -5e+121) tmp = t_0; elseif (Float64(1.0 / n) <= 1e-10) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 5e+176) tmp = t_0; else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) + Float64(-0.5 / n)) / x)) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if ((1.0 / n) <= -2e+169) tmp = ((n / x) / n) / n; elseif ((1.0 / n) <= -5e+121) tmp = t_0; elseif ((1.0 / n) <= 1e-10) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 5e+176) tmp = t_0; else tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+169], N[(N[(N[(n / x), $MachinePrecision] / n), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e+121], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-10], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+176], t$95$0, N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $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^{+169}:\\
\;\;\;\;\frac{\frac{\frac{n}{x}}{n}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{+121}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-10}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+176}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999987e169Initial program 100.0%
Taylor expanded in n around inf 97.4%
Simplified97.4%
Taylor expanded in n around 0 97.4%
Taylor expanded in x around inf 50.9%
+-commutative50.9%
mul-1-neg50.9%
log-rec50.9%
remove-double-neg50.9%
Simplified50.9%
Taylor expanded in n around inf 67.3%
if -1.99999999999999987e169 < (/.f64 #s(literal 1 binary64) n) < -5.00000000000000007e121 or 1.00000000000000004e-10 < (/.f64 #s(literal 1 binary64) n) < 5e176Initial program 88.3%
Taylor expanded in x around 0 79.3%
if -5.00000000000000007e121 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-10Initial program 32.4%
Taylor expanded in n around inf 73.0%
Simplified72.9%
add-log-exp79.1%
associate-+r-79.1%
exp-diff79.1%
add-exp-log58.8%
Applied egg-rr58.8%
associate-*r/58.8%
*-commutative58.8%
associate-/l*58.8%
Simplified58.8%
Taylor expanded in n around inf 72.9%
+-commutative72.9%
Simplified72.9%
if 5e176 < (/.f64 #s(literal 1 binary64) n) Initial program 17.1%
Taylor expanded in n around inf 0.1%
Simplified0.1%
add-log-exp0.1%
associate-+r-0.1%
exp-diff0.1%
add-exp-log0.1%
Applied egg-rr0.1%
associate-*r/0.1%
*-commutative0.1%
associate-/l*0.1%
Simplified0.1%
Taylor expanded in n around inf 7.1%
+-commutative7.1%
Simplified7.1%
Taylor expanded in x around inf 6.1%
Simplified78.8%
Final simplification73.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) -2e+169)
(/ (/ (/ n x) n) n)
(if (<= (/ 1.0 n) -5e+121)
t_0
(if (<= (/ 1.0 n) 1e-10)
(/ (log (+ 1.0 (/ 1.0 x))) n)
(if (<= (/ 1.0 n) 5e+176)
t_0
(/
(+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* n x)) (/ -0.5 n)) x))
x)))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e+169) {
tmp = ((n / x) / n) / n;
} else if ((1.0 / n) <= -5e+121) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-10) {
tmp = log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 5e+176) {
tmp = t_0;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
if ((1.0d0 / n) <= (-2d+169)) then
tmp = ((n / x) / n) / n
else if ((1.0d0 / n) <= (-5d+121)) then
tmp = t_0
else if ((1.0d0 / n) <= 1d-10) then
tmp = log((1.0d0 + (1.0d0 / x))) / n
else if ((1.0d0 / n) <= 5d+176) then
tmp = t_0
else
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) + ((-0.5d0) / n)) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e+169) {
tmp = ((n / x) / n) / n;
} else if ((1.0 / n) <= -5e+121) {
tmp = t_0;
} else if ((1.0 / n) <= 1e-10) {
tmp = Math.log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 5e+176) {
tmp = t_0;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e+169: tmp = ((n / x) / n) / n elif (1.0 / n) <= -5e+121: tmp = t_0 elif (1.0 / n) <= 1e-10: tmp = math.log((1.0 + (1.0 / x))) / n elif (1.0 / n) <= 5e+176: tmp = t_0 else: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (Float64(1.0 / n) <= -2e+169) tmp = Float64(Float64(Float64(n / x) / n) / n); elseif (Float64(1.0 / n) <= -5e+121) tmp = t_0; elseif (Float64(1.0 / n) <= 1e-10) tmp = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n); elseif (Float64(1.0 / n) <= 5e+176) tmp = t_0; else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) + Float64(-0.5 / n)) / x)) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if ((1.0 / n) <= -2e+169) tmp = ((n / x) / n) / n; elseif ((1.0 / n) <= -5e+121) tmp = t_0; elseif ((1.0 / n) <= 1e-10) tmp = log((1.0 + (1.0 / x))) / n; elseif ((1.0 / n) <= 5e+176) tmp = t_0; else tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+169], N[(N[(N[(n / x), $MachinePrecision] / n), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e+121], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-10], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+176], t$95$0, N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $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^{+169}:\\
\;\;\;\;\frac{\frac{\frac{n}{x}}{n}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{+121}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-10}:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+176}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999987e169Initial program 100.0%
Taylor expanded in n around inf 97.4%
Simplified97.4%
Taylor expanded in n around 0 97.4%
Taylor expanded in x around inf 50.9%
+-commutative50.9%
mul-1-neg50.9%
log-rec50.9%
remove-double-neg50.9%
Simplified50.9%
Taylor expanded in n around inf 67.3%
if -1.99999999999999987e169 < (/.f64 #s(literal 1 binary64) n) < -5.00000000000000007e121 or 1.00000000000000004e-10 < (/.f64 #s(literal 1 binary64) n) < 5e176Initial program 88.3%
Taylor expanded in x around 0 79.3%
if -5.00000000000000007e121 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000004e-10Initial program 32.4%
Taylor expanded in n around inf 73.0%
Simplified72.9%
add-log-exp79.1%
associate-+r-79.1%
exp-diff79.1%
add-exp-log58.8%
Applied egg-rr58.8%
associate-*r/58.8%
*-commutative58.8%
associate-/l*58.8%
Simplified58.8%
Taylor expanded in n around inf 72.9%
+-commutative72.9%
Simplified72.9%
Taylor expanded in x around inf 72.9%
if 5e176 < (/.f64 #s(literal 1 binary64) n) Initial program 17.1%
Taylor expanded in n around inf 0.1%
Simplified0.1%
add-log-exp0.1%
associate-+r-0.1%
exp-diff0.1%
add-exp-log0.1%
Applied egg-rr0.1%
associate-*r/0.1%
*-commutative0.1%
associate-/l*0.1%
Simplified0.1%
Taylor expanded in n around inf 7.1%
+-commutative7.1%
Simplified7.1%
Taylor expanded in x around inf 6.1%
Simplified78.8%
Final simplification73.6%
(FPCore (x n)
:precision binary64
(if (<= x 1.95e-141)
(/ (log x) (- n))
(if (<= x 4.8e-116)
(/ (/ (+ 1.0 (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) x) n)
(if (<= x 1.0) (/ (- x (log x)) n) (/ (/ (/ n x) n) n)))))
double code(double x, double n) {
double tmp;
if (x <= 1.95e-141) {
tmp = log(x) / -n;
} else if (x <= 4.8e-116) {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
} else if (x <= 1.0) {
tmp = (x - log(x)) / n;
} else {
tmp = ((n / x) / n) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.95d-141) then
tmp = log(x) / -n
else if (x <= 4.8d-116) then
tmp = ((1.0d0 + (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) / x) / n
else if (x <= 1.0d0) then
tmp = (x - log(x)) / n
else
tmp = ((n / x) / n) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.95e-141) {
tmp = Math.log(x) / -n;
} else if (x <= 4.8e-116) {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
} else if (x <= 1.0) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = ((n / x) / n) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.95e-141: tmp = math.log(x) / -n elif x <= 4.8e-116: tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n elif x <= 1.0: tmp = (x - math.log(x)) / n else: tmp = ((n / x) / n) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.95e-141) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 4.8e-116) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) / x) / n); elseif (x <= 1.0) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(Float64(n / x) / n) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.95e-141) tmp = log(x) / -n; elseif (x <= 4.8e-116) tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n; elseif (x <= 1.0) tmp = (x - log(x)) / n; else tmp = ((n / x) / n) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.95e-141], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 4.8e-116], N[(N[(N[(1.0 + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 1.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(n / x), $MachinePrecision] / n), $MachinePrecision] / n), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.95 \cdot 10^{-141}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-116}:\\
\;\;\;\;\frac{\frac{1 + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}}{x}}{n}\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{n}{x}}{n}}{n}\\
\end{array}
\end{array}
if x < 1.9499999999999999e-141Initial program 48.2%
Taylor expanded in x around 0 48.2%
Taylor expanded in n around inf 51.8%
mul-1-neg51.8%
Simplified51.8%
if 1.9499999999999999e-141 < x < 4.79999999999999986e-116Initial program 70.2%
Taylor expanded in n around inf 26.3%
Simplified26.3%
add-log-exp61.6%
associate-+r-61.6%
exp-diff61.6%
add-exp-log61.6%
Applied egg-rr61.6%
associate-*r/61.6%
*-commutative61.6%
associate-/l*61.6%
Simplified61.6%
Taylor expanded in n around inf 13.1%
+-commutative13.1%
Simplified13.1%
Taylor expanded in x around inf 77.6%
associate--l+77.6%
unpow277.6%
associate-/r*77.6%
metadata-eval77.6%
associate-*r/77.6%
associate-*r/77.6%
metadata-eval77.6%
div-sub77.6%
sub-neg77.6%
metadata-eval77.6%
+-commutative77.6%
associate-*r/77.6%
metadata-eval77.6%
Simplified77.6%
if 4.79999999999999986e-116 < x < 1Initial program 31.7%
Taylor expanded in x around 0 32.0%
Taylor expanded in n around inf 52.7%
if 1 < x Initial program 61.8%
Taylor expanded in n around inf 63.1%
Simplified63.0%
Taylor expanded in n around 0 63.1%
Taylor expanded in x around inf 60.7%
+-commutative60.7%
mul-1-neg60.7%
log-rec60.7%
remove-double-neg60.7%
Simplified60.7%
Taylor expanded in n around inf 71.8%
Final simplification60.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) (- n))))
(if (<= x 2.45e-141)
t_0
(if (<= x 4.4e-116)
(/ (/ (+ 1.0 (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) x) n)
(if (<= x 0.55) t_0 (/ (/ (/ n x) n) n))))))
double code(double x, double n) {
double t_0 = log(x) / -n;
double tmp;
if (x <= 2.45e-141) {
tmp = t_0;
} else if (x <= 4.4e-116) {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
} else if (x <= 0.55) {
tmp = t_0;
} else {
tmp = ((n / x) / n) / 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 = log(x) / -n
if (x <= 2.45d-141) then
tmp = t_0
else if (x <= 4.4d-116) then
tmp = ((1.0d0 + (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) / x) / n
else if (x <= 0.55d0) then
tmp = t_0
else
tmp = ((n / x) / n) / n
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 <= 2.45e-141) {
tmp = t_0;
} else if (x <= 4.4e-116) {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
} else if (x <= 0.55) {
tmp = t_0;
} else {
tmp = ((n / x) / n) / n;
}
return tmp;
}
def code(x, n): t_0 = math.log(x) / -n tmp = 0 if x <= 2.45e-141: tmp = t_0 elif x <= 4.4e-116: tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n elif x <= 0.55: tmp = t_0 else: tmp = ((n / x) / n) / n return tmp
function code(x, n) t_0 = Float64(log(x) / Float64(-n)) tmp = 0.0 if (x <= 2.45e-141) tmp = t_0; elseif (x <= 4.4e-116) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) / x) / n); elseif (x <= 0.55) tmp = t_0; else tmp = Float64(Float64(Float64(n / x) / n) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = log(x) / -n; tmp = 0.0; if (x <= 2.45e-141) tmp = t_0; elseif (x <= 4.4e-116) tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n; elseif (x <= 0.55) tmp = t_0; else tmp = ((n / x) / n) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 2.45e-141], t$95$0, If[LessEqual[x, 4.4e-116], N[(N[(N[(1.0 + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 0.55], t$95$0, N[(N[(N[(n / x), $MachinePrecision] / n), $MachinePrecision] / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
\mathbf{if}\;x \leq 2.45 \cdot 10^{-141}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{-116}:\\
\;\;\;\;\frac{\frac{1 + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}}{x}}{n}\\
\mathbf{elif}\;x \leq 0.55:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{n}{x}}{n}}{n}\\
\end{array}
\end{array}
if x < 2.45000000000000003e-141 or 4.4000000000000002e-116 < x < 0.55000000000000004Initial program 41.8%
Taylor expanded in x around 0 41.8%
Taylor expanded in n around inf 51.2%
mul-1-neg51.2%
Simplified51.2%
if 2.45000000000000003e-141 < x < 4.4000000000000002e-116Initial program 70.2%
Taylor expanded in n around inf 26.3%
Simplified26.3%
add-log-exp61.6%
associate-+r-61.6%
exp-diff61.6%
add-exp-log61.6%
Applied egg-rr61.6%
associate-*r/61.6%
*-commutative61.6%
associate-/l*61.6%
Simplified61.6%
Taylor expanded in n around inf 13.1%
+-commutative13.1%
Simplified13.1%
Taylor expanded in x around inf 77.6%
associate--l+77.6%
unpow277.6%
associate-/r*77.6%
metadata-eval77.6%
associate-*r/77.6%
associate-*r/77.6%
metadata-eval77.6%
div-sub77.6%
sub-neg77.6%
metadata-eval77.6%
+-commutative77.6%
associate-*r/77.6%
metadata-eval77.6%
Simplified77.6%
if 0.55000000000000004 < x Initial program 61.8%
Taylor expanded in n around inf 63.1%
Simplified63.0%
Taylor expanded in n around 0 63.1%
Taylor expanded in x around inf 60.7%
+-commutative60.7%
mul-1-neg60.7%
log-rec60.7%
remove-double-neg60.7%
Simplified60.7%
Taylor expanded in n around inf 71.8%
Final simplification60.3%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -1e+191)
(/ (/ (/ n x) n) n)
(if (<= (/ 1.0 n) -20000000000000.0)
0.0
(/ (+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* n x)) (/ -0.5 n)) x)) x))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1e+191) {
tmp = ((n / x) / n) / n;
} else if ((1.0 / n) <= -20000000000000.0) {
tmp = 0.0;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / 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) <= (-1d+191)) then
tmp = ((n / x) / n) / n
else if ((1.0d0 / n) <= (-20000000000000.0d0)) then
tmp = 0.0d0
else
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) + ((-0.5d0) / n)) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1e+191) {
tmp = ((n / x) / n) / n;
} else if ((1.0 / n) <= -20000000000000.0) {
tmp = 0.0;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1e+191: tmp = ((n / x) / n) / n elif (1.0 / n) <= -20000000000000.0: tmp = 0.0 else: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1e+191) tmp = Float64(Float64(Float64(n / x) / n) / n); elseif (Float64(1.0 / n) <= -20000000000000.0) tmp = 0.0; else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) + Float64(-0.5 / n)) / x)) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -1e+191) tmp = ((n / x) / n) / n; elseif ((1.0 / n) <= -20000000000000.0) tmp = 0.0; else tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+191], N[(N[(N[(n / x), $MachinePrecision] / n), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -20000000000000.0], 0.0, N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+191}:\\
\;\;\;\;\frac{\frac{\frac{n}{x}}{n}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -20000000000000:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000007e191Initial program 100.0%
Taylor expanded in n around inf 95.9%
Simplified95.9%
Taylor expanded in n around 0 95.9%
Taylor expanded in x around inf 59.1%
+-commutative59.1%
mul-1-neg59.1%
log-rec59.1%
remove-double-neg59.1%
Simplified59.1%
Taylor expanded in n around inf 76.4%
if -1.00000000000000007e191 < (/.f64 #s(literal 1 binary64) n) < -2e13Initial program 100.0%
Taylor expanded in x around 0 48.5%
Taylor expanded in n around inf 53.9%
metadata-eval53.9%
Applied egg-rr53.9%
if -2e13 < (/.f64 #s(literal 1 binary64) n) Initial program 31.9%
Taylor expanded in n around inf 55.8%
Simplified55.8%
add-log-exp57.3%
associate-+r-57.3%
exp-diff57.3%
add-exp-log46.4%
Applied egg-rr46.4%
associate-*r/46.4%
*-commutative46.4%
associate-/l*46.4%
Simplified46.4%
Taylor expanded in n around inf 57.1%
+-commutative57.1%
Simplified57.1%
Taylor expanded in x around inf 36.3%
Simplified43.7%
Final simplification48.6%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -1e+191)
(/ (/ (/ n x) n) n)
(if (<= (/ 1.0 n) -20000000000000.0)
0.0
(/ (/ (+ 1.0 (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) x) n))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1e+191) {
tmp = ((n / x) / n) / n;
} else if ((1.0 / n) <= -20000000000000.0) {
tmp = 0.0;
} else {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((1.0d0 / n) <= (-1d+191)) then
tmp = ((n / x) / n) / n
else if ((1.0d0 / n) <= (-20000000000000.0d0)) then
tmp = 0.0d0
else
tmp = ((1.0d0 + (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1e+191) {
tmp = ((n / x) / n) / n;
} else if ((1.0 / n) <= -20000000000000.0) {
tmp = 0.0;
} else {
tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1e+191: tmp = ((n / x) / n) / n elif (1.0 / n) <= -20000000000000.0: tmp = 0.0 else: tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1e+191) tmp = Float64(Float64(Float64(n / x) / n) / n); elseif (Float64(1.0 / n) <= -20000000000000.0) tmp = 0.0; else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -1e+191) tmp = ((n / x) / n) / n; elseif ((1.0 / n) <= -20000000000000.0) tmp = 0.0; else tmp = ((1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+191], N[(N[(N[(n / x), $MachinePrecision] / n), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -20000000000000.0], 0.0, N[(N[(N[(1.0 + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+191}:\\
\;\;\;\;\frac{\frac{\frac{n}{x}}{n}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -20000000000000:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000007e191Initial program 100.0%
Taylor expanded in n around inf 95.9%
Simplified95.9%
Taylor expanded in n around 0 95.9%
Taylor expanded in x around inf 59.1%
+-commutative59.1%
mul-1-neg59.1%
log-rec59.1%
remove-double-neg59.1%
Simplified59.1%
Taylor expanded in n around inf 76.4%
if -1.00000000000000007e191 < (/.f64 #s(literal 1 binary64) n) < -2e13Initial program 100.0%
Taylor expanded in x around 0 48.5%
Taylor expanded in n around inf 53.9%
metadata-eval53.9%
Applied egg-rr53.9%
if -2e13 < (/.f64 #s(literal 1 binary64) n) Initial program 31.9%
Taylor expanded in n around inf 55.8%
Simplified55.8%
add-log-exp57.3%
associate-+r-57.3%
exp-diff57.3%
add-exp-log46.4%
Applied egg-rr46.4%
associate-*r/46.4%
*-commutative46.4%
associate-/l*46.4%
Simplified46.4%
Taylor expanded in n around inf 57.1%
+-commutative57.1%
Simplified57.1%
Taylor expanded in x around inf 43.6%
associate--l+43.6%
unpow243.6%
associate-/r*43.6%
metadata-eval43.6%
associate-*r/43.6%
associate-*r/43.6%
metadata-eval43.6%
div-sub43.6%
sub-neg43.6%
metadata-eval43.6%
+-commutative43.6%
associate-*r/43.6%
metadata-eval43.6%
Simplified43.6%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -1e+191) (/ (/ (/ n x) n) n) (if (<= (/ 1.0 n) -20000000000000.0) 0.0 (/ (/ 1.0 x) n))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1e+191) {
tmp = ((n / x) / n) / n;
} else if ((1.0 / n) <= -20000000000000.0) {
tmp = 0.0;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((1.0d0 / n) <= (-1d+191)) then
tmp = ((n / x) / n) / n
else if ((1.0d0 / n) <= (-20000000000000.0d0)) then
tmp = 0.0d0
else
tmp = (1.0d0 / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1e+191) {
tmp = ((n / x) / n) / n;
} else if ((1.0 / n) <= -20000000000000.0) {
tmp = 0.0;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1e+191: tmp = ((n / x) / n) / n elif (1.0 / n) <= -20000000000000.0: tmp = 0.0 else: tmp = (1.0 / x) / n return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1e+191) tmp = Float64(Float64(Float64(n / x) / n) / n); elseif (Float64(1.0 / n) <= -20000000000000.0) tmp = 0.0; else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -1e+191) tmp = ((n / x) / n) / n; elseif ((1.0 / n) <= -20000000000000.0) tmp = 0.0; else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+191], N[(N[(N[(n / x), $MachinePrecision] / n), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -20000000000000.0], 0.0, N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+191}:\\
\;\;\;\;\frac{\frac{\frac{n}{x}}{n}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -20000000000000:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000007e191Initial program 100.0%
Taylor expanded in n around inf 95.9%
Simplified95.9%
Taylor expanded in n around 0 95.9%
Taylor expanded in x around inf 59.1%
+-commutative59.1%
mul-1-neg59.1%
log-rec59.1%
remove-double-neg59.1%
Simplified59.1%
Taylor expanded in n around inf 76.4%
if -1.00000000000000007e191 < (/.f64 #s(literal 1 binary64) n) < -2e13Initial program 100.0%
Taylor expanded in x around 0 48.5%
Taylor expanded in n around inf 53.9%
metadata-eval53.9%
Applied egg-rr53.9%
if -2e13 < (/.f64 #s(literal 1 binary64) n) Initial program 31.9%
Taylor expanded in n around inf 55.8%
Simplified55.8%
add-log-exp57.3%
associate-+r-57.3%
exp-diff57.3%
add-exp-log46.4%
Applied egg-rr46.4%
associate-*r/46.4%
*-commutative46.4%
associate-/l*46.4%
Simplified46.4%
Taylor expanded in n around inf 57.1%
+-commutative57.1%
Simplified57.1%
Taylor expanded in x around inf 40.5%
(FPCore (x n) :precision binary64 (if (or (<= n -1.4e-8) (not (<= n -2.45e-232))) (/ (/ 1.0 x) n) 0.0))
double code(double x, double n) {
double tmp;
if ((n <= -1.4e-8) || !(n <= -2.45e-232)) {
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 ((n <= (-1.4d-8)) .or. (.not. (n <= (-2.45d-232)))) 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 ((n <= -1.4e-8) || !(n <= -2.45e-232)) {
tmp = (1.0 / x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if (n <= -1.4e-8) or not (n <= -2.45e-232): tmp = (1.0 / x) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if ((n <= -1.4e-8) || !(n <= -2.45e-232)) tmp = Float64(Float64(1.0 / x) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((n <= -1.4e-8) || ~((n <= -2.45e-232))) tmp = (1.0 / x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[Or[LessEqual[n, -1.4e-8], N[Not[LessEqual[n, -2.45e-232]], $MachinePrecision]], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.4 \cdot 10^{-8} \lor \neg \left(n \leq -2.45 \cdot 10^{-232}\right):\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if n < -1.4e-8 or -2.4500000000000002e-232 < n Initial program 37.0%
Taylor expanded in n around inf 59.1%
Simplified59.1%
add-log-exp60.5%
associate-+r-60.5%
exp-diff60.5%
add-exp-log48.4%
Applied egg-rr48.4%
associate-*r/48.4%
*-commutative48.4%
associate-/l*48.4%
Simplified48.4%
Taylor expanded in n around inf 55.7%
+-commutative55.7%
Simplified55.7%
Taylor expanded in x around inf 42.2%
if -1.4e-8 < n < -2.4500000000000002e-232Initial program 100.0%
Taylor expanded in x around 0 46.4%
Taylor expanded in n around inf 56.1%
metadata-eval56.1%
Applied egg-rr56.1%
Final simplification45.2%
(FPCore (x n) :precision binary64 (if (or (<= n -1.4e-8) (not (<= n -6.8e-233))) (/ 1.0 (* n x)) 0.0))
double code(double x, double n) {
double tmp;
if ((n <= -1.4e-8) || !(n <= -6.8e-233)) {
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 ((n <= (-1.4d-8)) .or. (.not. (n <= (-6.8d-233)))) 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 ((n <= -1.4e-8) || !(n <= -6.8e-233)) {
tmp = 1.0 / (n * x);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if (n <= -1.4e-8) or not (n <= -6.8e-233): tmp = 1.0 / (n * x) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if ((n <= -1.4e-8) || !(n <= -6.8e-233)) tmp = Float64(1.0 / Float64(n * x)); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((n <= -1.4e-8) || ~((n <= -6.8e-233))) tmp = 1.0 / (n * x); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[Or[LessEqual[n, -1.4e-8], N[Not[LessEqual[n, -6.8e-233]], $MachinePrecision]], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.4 \cdot 10^{-8} \lor \neg \left(n \leq -6.8 \cdot 10^{-233}\right):\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if n < -1.4e-8 or -6.8000000000000004e-233 < n Initial program 37.0%
Taylor expanded in x around inf 40.1%
mul-1-neg40.1%
log-rec40.1%
mul-1-neg40.1%
distribute-neg-frac40.1%
mul-1-neg40.1%
remove-double-neg40.1%
*-commutative40.1%
Simplified40.1%
Taylor expanded in n around inf 42.1%
if -1.4e-8 < n < -6.8000000000000004e-233Initial program 100.0%
Taylor expanded in x around 0 46.4%
Taylor expanded in n around inf 56.1%
metadata-eval56.1%
Applied egg-rr56.1%
Final simplification45.2%
(FPCore (x n) :precision binary64 (if (<= n -1.4e-8) (/ 1.0 (* n x)) (if (<= n -1.3e-232) 0.0 (/ (/ 1.0 n) x))))
double code(double x, double n) {
double tmp;
if (n <= -1.4e-8) {
tmp = 1.0 / (n * x);
} else if (n <= -1.3e-232) {
tmp = 0.0;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.4d-8)) then
tmp = 1.0d0 / (n * x)
else if (n <= (-1.3d-232)) then
tmp = 0.0d0
else
tmp = (1.0d0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (n <= -1.4e-8) {
tmp = 1.0 / (n * x);
} else if (n <= -1.3e-232) {
tmp = 0.0;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -1.4e-8: tmp = 1.0 / (n * x) elif n <= -1.3e-232: tmp = 0.0 else: tmp = (1.0 / n) / x return tmp
function code(x, n) tmp = 0.0 if (n <= -1.4e-8) tmp = Float64(1.0 / Float64(n * x)); elseif (n <= -1.3e-232) tmp = 0.0; else tmp = Float64(Float64(1.0 / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (n <= -1.4e-8) tmp = 1.0 / (n * x); elseif (n <= -1.3e-232) tmp = 0.0; else tmp = (1.0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[n, -1.4e-8], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -1.3e-232], 0.0, N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.4 \cdot 10^{-8}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;n \leq -1.3 \cdot 10^{-232}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\end{array}
\end{array}
if n < -1.4e-8Initial program 22.8%
Taylor expanded in x around inf 48.5%
mul-1-neg48.5%
log-rec48.5%
mul-1-neg48.5%
distribute-neg-frac48.5%
mul-1-neg48.5%
remove-double-neg48.5%
*-commutative48.5%
Simplified48.5%
Taylor expanded in n around inf 43.9%
if -1.4e-8 < n < -1.29999999999999998e-232Initial program 100.0%
Taylor expanded in x around 0 46.4%
Taylor expanded in n around inf 56.1%
metadata-eval56.1%
Applied egg-rr56.1%
if -1.29999999999999998e-232 < n Initial program 44.3%
Taylor expanded in x around inf 35.8%
mul-1-neg35.8%
log-rec35.8%
mul-1-neg35.8%
distribute-neg-frac35.8%
mul-1-neg35.8%
remove-double-neg35.8%
*-commutative35.8%
Simplified35.8%
Taylor expanded in n around inf 41.2%
associate-/r*41.2%
Simplified41.2%
(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 50.8%
Taylor expanded in x around 0 37.4%
Taylor expanded in n around inf 25.4%
metadata-eval25.4%
Applied egg-rr25.4%
herbie shell --seed 2024121
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))