
(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 20 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 (log (+ 1.0 x))) (t_1 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-42)
(/ t_1 (* n x))
(if (<= (/ 1.0 n) 5e-7)
(-
(+
(/ (- t_0 (log x)) n)
(+
(/
(-
(* -0.16666666666666666 (pow (log x) 3.0))
(* -0.16666666666666666 (pow t_0 3.0)))
(pow n 3.0))
(+
(* 0.041666666666666664 (/ (pow t_0 4.0) (pow n 4.0)))
(* 0.5 (/ (pow t_0 2.0) (pow n 2.0))))))
(+
(* 0.041666666666666664 (/ (pow (log x) 4.0) (pow n 4.0)))
(* 0.5 (/ (pow (log x) 2.0) (pow n 2.0)))))
(- (exp (/ (log1p x) n)) t_1)))))
double code(double x, double n) {
double t_0 = log((1.0 + x));
double t_1 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= 5e-7) {
tmp = (((t_0 - log(x)) / n) + ((((-0.16666666666666666 * pow(log(x), 3.0)) - (-0.16666666666666666 * pow(t_0, 3.0))) / pow(n, 3.0)) + ((0.041666666666666664 * (pow(t_0, 4.0) / pow(n, 4.0))) + (0.5 * (pow(t_0, 2.0) / pow(n, 2.0)))))) - ((0.041666666666666664 * (pow(log(x), 4.0) / pow(n, 4.0))) + (0.5 * (pow(log(x), 2.0) / pow(n, 2.0))));
} else {
tmp = exp((log1p(x) / n)) - t_1;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.log((1.0 + x));
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= 5e-7) {
tmp = (((t_0 - Math.log(x)) / n) + ((((-0.16666666666666666 * Math.pow(Math.log(x), 3.0)) - (-0.16666666666666666 * Math.pow(t_0, 3.0))) / Math.pow(n, 3.0)) + ((0.041666666666666664 * (Math.pow(t_0, 4.0) / Math.pow(n, 4.0))) + (0.5 * (Math.pow(t_0, 2.0) / Math.pow(n, 2.0)))))) - ((0.041666666666666664 * (Math.pow(Math.log(x), 4.0) / Math.pow(n, 4.0))) + (0.5 * (Math.pow(Math.log(x), 2.0) / Math.pow(n, 2.0))));
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_1;
}
return tmp;
}
def code(x, n): t_0 = math.log((1.0 + x)) t_1 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-42: tmp = t_1 / (n * x) elif (1.0 / n) <= 5e-7: tmp = (((t_0 - math.log(x)) / n) + ((((-0.16666666666666666 * math.pow(math.log(x), 3.0)) - (-0.16666666666666666 * math.pow(t_0, 3.0))) / math.pow(n, 3.0)) + ((0.041666666666666664 * (math.pow(t_0, 4.0) / math.pow(n, 4.0))) + (0.5 * (math.pow(t_0, 2.0) / math.pow(n, 2.0)))))) - ((0.041666666666666664 * (math.pow(math.log(x), 4.0) / math.pow(n, 4.0))) + (0.5 * (math.pow(math.log(x), 2.0) / math.pow(n, 2.0)))) else: tmp = math.exp((math.log1p(x) / n)) - t_1 return tmp
function code(x, n) t_0 = log(Float64(1.0 + x)) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-42) tmp = Float64(t_1 / Float64(n * x)); elseif (Float64(1.0 / n) <= 5e-7) tmp = Float64(Float64(Float64(Float64(t_0 - log(x)) / n) + Float64(Float64(Float64(Float64(-0.16666666666666666 * (log(x) ^ 3.0)) - Float64(-0.16666666666666666 * (t_0 ^ 3.0))) / (n ^ 3.0)) + Float64(Float64(0.041666666666666664 * Float64((t_0 ^ 4.0) / (n ^ 4.0))) + Float64(0.5 * Float64((t_0 ^ 2.0) / (n ^ 2.0)))))) - Float64(Float64(0.041666666666666664 * Float64((log(x) ^ 4.0) / (n ^ 4.0))) + Float64(0.5 * Float64((log(x) ^ 2.0) / (n ^ 2.0))))); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_1); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Log[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-42], N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-7], N[(N[(N[(N[(t$95$0 - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(N[(N[(N[(-0.16666666666666666 * N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] - N[(-0.16666666666666666 * N[Power[t$95$0, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[n, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.041666666666666664 * N[(N[Power[t$95$0, 4.0], $MachinePrecision] / N[Power[n, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[Power[t$95$0, 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(0.041666666666666664 * N[(N[Power[N[Log[x], $MachinePrecision], 4.0], $MachinePrecision] / N[Power[n, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(1 + x\right)\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-42}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-7}:\\
\;\;\;\;\left(\frac{t_0 - \log x}{n} + \left(\frac{-0.16666666666666666 \cdot {\log x}^{3} - -0.16666666666666666 \cdot {t_0}^{3}}{{n}^{3}} + \left(0.041666666666666664 \cdot \frac{{t_0}^{4}}{{n}^{4}} + 0.5 \cdot \frac{{t_0}^{2}}{{n}^{2}}\right)\right)\right) - \left(0.041666666666666664 \cdot \frac{{\log x}^{4}}{{n}^{4}} + 0.5 \cdot \frac{{\log x}^{2}}{{n}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_1\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.00000000000000004e-42Initial program 80.3%
Taylor expanded in x around inf 33.2%
mul-1-neg33.2%
log-rec33.2%
mul-1-neg33.2%
distribute-neg-frac33.2%
mul-1-neg33.2%
remove-double-neg33.2%
*-commutative33.2%
associate-/l*33.2%
associate-/r/33.2%
Simplified33.2%
Taylor expanded in n around inf 46.1%
associate-/r*46.1%
Simplified46.1%
Taylor expanded in x around inf 91.4%
mul-1-neg91.4%
log-rec91.4%
distribute-frac-neg91.4%
remove-double-neg91.4%
*-rgt-identity91.4%
associate-*r/91.4%
exp-to-pow91.4%
*-commutative91.4%
Simplified91.4%
if -1.00000000000000004e-42 < (/.f64 1 n) < 4.99999999999999977e-7Initial program 27.5%
Taylor expanded in n around -inf 83.0%
if 4.99999999999999977e-7 < (/.f64 1 n) Initial program 45.5%
Taylor expanded in n around 0 45.5%
log1p-def98.1%
Simplified98.1%
Final simplification88.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (log (+ 1.0 x))) (t_1 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-42)
(/ t_1 (* n x))
(if (<= (/ 1.0 n) 2e-11)
(-
(+ (* 0.5 (/ (pow t_0 2.0) (pow n 2.0))) (/ t_0 n))
(+ (* 0.5 (/ (pow (log x) 2.0) (pow n 2.0))) (/ (log x) n)))
(log (exp (- (exp (/ (log1p x) n)) t_1)))))))
double code(double x, double n) {
double t_0 = log((1.0 + x));
double t_1 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = ((0.5 * (pow(t_0, 2.0) / pow(n, 2.0))) + (t_0 / n)) - ((0.5 * (pow(log(x), 2.0) / pow(n, 2.0))) + (log(x) / n));
} else {
tmp = log(exp((exp((log1p(x) / n)) - t_1)));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.log((1.0 + x));
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = ((0.5 * (Math.pow(t_0, 2.0) / Math.pow(n, 2.0))) + (t_0 / n)) - ((0.5 * (Math.pow(Math.log(x), 2.0) / Math.pow(n, 2.0))) + (Math.log(x) / n));
} else {
tmp = Math.log(Math.exp((Math.exp((Math.log1p(x) / n)) - t_1)));
}
return tmp;
}
def code(x, n): t_0 = math.log((1.0 + x)) t_1 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-42: tmp = t_1 / (n * x) elif (1.0 / n) <= 2e-11: tmp = ((0.5 * (math.pow(t_0, 2.0) / math.pow(n, 2.0))) + (t_0 / n)) - ((0.5 * (math.pow(math.log(x), 2.0) / math.pow(n, 2.0))) + (math.log(x) / n)) else: tmp = math.log(math.exp((math.exp((math.log1p(x) / n)) - t_1))) return tmp
function code(x, n) t_0 = log(Float64(1.0 + x)) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-42) tmp = Float64(t_1 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-11) tmp = Float64(Float64(Float64(0.5 * Float64((t_0 ^ 2.0) / (n ^ 2.0))) + Float64(t_0 / n)) - Float64(Float64(0.5 * Float64((log(x) ^ 2.0) / (n ^ 2.0))) + Float64(log(x) / n))); else tmp = log(exp(Float64(exp(Float64(log1p(x) / n)) - t_1))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Log[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-42], N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-11], N[(N[(N[(0.5 * N[(N[Power[t$95$0, 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 / n), $MachinePrecision]), $MachinePrecision] - N[(N[(0.5 * N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[N[Exp[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(1 + x\right)\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-42}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\left(0.5 \cdot \frac{{t_0}^{2}}{{n}^{2}} + \frac{t_0}{n}\right) - \left(0.5 \cdot \frac{{\log x}^{2}}{{n}^{2}} + \frac{\log x}{n}\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_1}\right)\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.00000000000000004e-42Initial program 80.3%
Taylor expanded in x around inf 33.2%
mul-1-neg33.2%
log-rec33.2%
mul-1-neg33.2%
distribute-neg-frac33.2%
mul-1-neg33.2%
remove-double-neg33.2%
*-commutative33.2%
associate-/l*33.2%
associate-/r/33.2%
Simplified33.2%
Taylor expanded in n around inf 46.1%
associate-/r*46.1%
Simplified46.1%
Taylor expanded in x around inf 91.4%
mul-1-neg91.4%
log-rec91.4%
distribute-frac-neg91.4%
remove-double-neg91.4%
*-rgt-identity91.4%
associate-*r/91.4%
exp-to-pow91.4%
*-commutative91.4%
Simplified91.4%
if -1.00000000000000004e-42 < (/.f64 1 n) < 1.99999999999999988e-11Initial program 27.1%
Taylor expanded in n around inf 82.9%
if 1.99999999999999988e-11 < (/.f64 1 n) Initial program 46.3%
add-log-exp46.3%
add-exp-log46.3%
log-pow46.3%
+-commutative46.3%
log1p-udef97.8%
*-commutative97.8%
un-div-inv97.8%
Applied egg-rr97.8%
Final simplification88.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-42)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-11)
(+
(*
0.5
(-
(/ (pow (log1p x) 2.0) (pow n 2.0))
(/ (pow (log x) 2.0) (pow n 2.0))))
(/ (- (log1p x) (log x)) n))
(log (exp (- (exp (/ (log1p x) n)) t_0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = (0.5 * ((pow(log1p(x), 2.0) / pow(n, 2.0)) - (pow(log(x), 2.0) / pow(n, 2.0)))) + ((log1p(x) - log(x)) / n);
} else {
tmp = log(exp((exp((log1p(x) / n)) - t_0)));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = (0.5 * ((Math.pow(Math.log1p(x), 2.0) / Math.pow(n, 2.0)) - (Math.pow(Math.log(x), 2.0) / Math.pow(n, 2.0)))) + ((Math.log1p(x) - Math.log(x)) / n);
} else {
tmp = Math.log(Math.exp((Math.exp((Math.log1p(x) / n)) - t_0)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-42: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-11: tmp = (0.5 * ((math.pow(math.log1p(x), 2.0) / math.pow(n, 2.0)) - (math.pow(math.log(x), 2.0) / math.pow(n, 2.0)))) + ((math.log1p(x) - math.log(x)) / n) else: tmp = math.log(math.exp((math.exp((math.log1p(x) / n)) - t_0))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-42) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-11) tmp = Float64(Float64(0.5 * Float64(Float64((log1p(x) ^ 2.0) / (n ^ 2.0)) - Float64((log(x) ^ 2.0) / (n ^ 2.0)))) + Float64(Float64(log1p(x) - log(x)) / n)); else tmp = log(exp(Float64(exp(Float64(log1p(x) / n)) - t_0))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-42], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-11], N[(N[(0.5 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision] - N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[Log[N[Exp[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-42}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;0.5 \cdot \left(\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{{n}^{2}} - \frac{{\log x}^{2}}{{n}^{2}}\right) + \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0}\right)\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.00000000000000004e-42Initial program 80.3%
Taylor expanded in x around inf 33.2%
mul-1-neg33.2%
log-rec33.2%
mul-1-neg33.2%
distribute-neg-frac33.2%
mul-1-neg33.2%
remove-double-neg33.2%
*-commutative33.2%
associate-/l*33.2%
associate-/r/33.2%
Simplified33.2%
Taylor expanded in n around inf 46.1%
associate-/r*46.1%
Simplified46.1%
Taylor expanded in x around inf 91.4%
mul-1-neg91.4%
log-rec91.4%
distribute-frac-neg91.4%
remove-double-neg91.4%
*-rgt-identity91.4%
associate-*r/91.4%
exp-to-pow91.4%
*-commutative91.4%
Simplified91.4%
if -1.00000000000000004e-42 < (/.f64 1 n) < 1.99999999999999988e-11Initial program 27.1%
Taylor expanded in n around inf 82.9%
associate--l+80.1%
+-commutative80.1%
associate--r+82.9%
div-sub82.9%
remove-double-neg82.9%
mul-1-neg82.9%
distribute-lft-out--82.9%
mul-1-neg82.9%
associate-*r/82.9%
Simplified82.9%
if 1.99999999999999988e-11 < (/.f64 1 n) Initial program 46.3%
add-log-exp46.3%
add-exp-log46.3%
log-pow46.3%
+-commutative46.3%
log1p-udef97.8%
*-commutative97.8%
un-div-inv97.8%
Applied egg-rr97.8%
Final simplification88.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-42)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-11)
(+
(/ (- (log1p x) (log x)) n)
(/ (* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0))) (pow n 2.0)))
(log (exp (- (exp (/ (log1p x) n)) t_0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = ((log1p(x) - log(x)) / n) + ((0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0))) / pow(n, 2.0));
} else {
tmp = log(exp((exp((log1p(x) / n)) - t_0)));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = ((Math.log1p(x) - Math.log(x)) / n) + ((0.5 * (Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0))) / Math.pow(n, 2.0));
} else {
tmp = Math.log(Math.exp((Math.exp((Math.log1p(x) / n)) - t_0)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-42: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-11: tmp = ((math.log1p(x) - math.log(x)) / n) + ((0.5 * (math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0))) / math.pow(n, 2.0)) else: tmp = math.log(math.exp((math.exp((math.log1p(x) / n)) - t_0))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-42) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-11) tmp = Float64(Float64(Float64(log1p(x) - log(x)) / n) + Float64(Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) / (n ^ 2.0))); else tmp = log(exp(Float64(exp(Float64(log1p(x) / n)) - t_0))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-42], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-11], N[(N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + 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[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[N[Exp[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-42}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n} + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right)}{{n}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0}\right)\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.00000000000000004e-42Initial program 80.3%
Taylor expanded in x around inf 33.2%
mul-1-neg33.2%
log-rec33.2%
mul-1-neg33.2%
distribute-neg-frac33.2%
mul-1-neg33.2%
remove-double-neg33.2%
*-commutative33.2%
associate-/l*33.2%
associate-/r/33.2%
Simplified33.2%
Taylor expanded in n around inf 46.1%
associate-/r*46.1%
Simplified46.1%
Taylor expanded in x around inf 91.4%
mul-1-neg91.4%
log-rec91.4%
distribute-frac-neg91.4%
remove-double-neg91.4%
*-rgt-identity91.4%
associate-*r/91.4%
exp-to-pow91.4%
*-commutative91.4%
Simplified91.4%
if -1.00000000000000004e-42 < (/.f64 1 n) < 1.99999999999999988e-11Initial program 27.1%
Taylor expanded in n around 0 27.1%
log1p-def27.1%
Simplified27.1%
Taylor expanded in n around -inf 82.9%
associate--l+82.9%
Simplified82.9%
if 1.99999999999999988e-11 < (/.f64 1 n) Initial program 46.3%
add-log-exp46.3%
add-exp-log46.3%
log-pow46.3%
+-commutative46.3%
log1p-udef97.8%
*-commutative97.8%
un-div-inv97.8%
Applied egg-rr97.8%
Final simplification88.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-42)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-11)
(/ (log (/ (+ 1.0 x) x)) n)
(log (exp (- (exp (/ (log1p x) n)) t_0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = log(((1.0 + x) / x)) / n;
} else {
tmp = log(exp((exp((log1p(x) / n)) - t_0)));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else {
tmp = Math.log(Math.exp((Math.exp((Math.log1p(x) / n)) - t_0)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-42: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-11: tmp = math.log(((1.0 + x) / x)) / n else: tmp = math.log(math.exp((math.exp((math.log1p(x) / n)) - t_0))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-42) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-11) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); else tmp = log(exp(Float64(exp(Float64(log1p(x) / n)) - t_0))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-42], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-11], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[Log[N[Exp[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-42}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0}\right)\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.00000000000000004e-42Initial program 80.3%
Taylor expanded in x around inf 33.2%
mul-1-neg33.2%
log-rec33.2%
mul-1-neg33.2%
distribute-neg-frac33.2%
mul-1-neg33.2%
remove-double-neg33.2%
*-commutative33.2%
associate-/l*33.2%
associate-/r/33.2%
Simplified33.2%
Taylor expanded in n around inf 46.1%
associate-/r*46.1%
Simplified46.1%
Taylor expanded in x around inf 91.4%
mul-1-neg91.4%
log-rec91.4%
distribute-frac-neg91.4%
remove-double-neg91.4%
*-rgt-identity91.4%
associate-*r/91.4%
exp-to-pow91.4%
*-commutative91.4%
Simplified91.4%
if -1.00000000000000004e-42 < (/.f64 1 n) < 1.99999999999999988e-11Initial program 27.1%
Taylor expanded in n around inf 82.7%
diff-log82.8%
Applied egg-rr82.8%
if 1.99999999999999988e-11 < (/.f64 1 n) Initial program 46.3%
add-log-exp46.3%
add-exp-log46.3%
log-pow46.3%
+-commutative46.3%
log1p-udef97.8%
*-commutative97.8%
un-div-inv97.8%
Applied egg-rr97.8%
Final simplification88.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-42)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-11)
(/ (log (/ (+ 1.0 x) x)) n)
(- (exp (/ (log1p x) n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = log(((1.0 + x) / x)) / n;
} else {
tmp = exp((log1p(x) / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-42: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-11: tmp = math.log(((1.0 + x) / x)) / n else: tmp = math.exp((math.log1p(x) / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-42) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-11) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-42], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-11], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-42}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.00000000000000004e-42Initial program 80.3%
Taylor expanded in x around inf 33.2%
mul-1-neg33.2%
log-rec33.2%
mul-1-neg33.2%
distribute-neg-frac33.2%
mul-1-neg33.2%
remove-double-neg33.2%
*-commutative33.2%
associate-/l*33.2%
associate-/r/33.2%
Simplified33.2%
Taylor expanded in n around inf 46.1%
associate-/r*46.1%
Simplified46.1%
Taylor expanded in x around inf 91.4%
mul-1-neg91.4%
log-rec91.4%
distribute-frac-neg91.4%
remove-double-neg91.4%
*-rgt-identity91.4%
associate-*r/91.4%
exp-to-pow91.4%
*-commutative91.4%
Simplified91.4%
if -1.00000000000000004e-42 < (/.f64 1 n) < 1.99999999999999988e-11Initial program 27.1%
Taylor expanded in n around inf 82.7%
diff-log82.8%
Applied egg-rr82.8%
if 1.99999999999999988e-11 < (/.f64 1 n) Initial program 46.3%
Taylor expanded in n around 0 46.3%
log1p-def97.8%
Simplified97.8%
Final simplification88.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-42)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-11)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 1e+173)
(- (+ 1.0 (/ x n)) t_0)
(sqrt (pow (* n x) -2.0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 1e+173) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = sqrt(pow((n * x), -2.0));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1d-42)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 2d-11) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 1d+173) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = sqrt(((n * x) ** (-2.0d0)))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 1e+173) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = Math.sqrt(Math.pow((n * x), -2.0));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-42: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-11: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 1e+173: tmp = (1.0 + (x / n)) - t_0 else: tmp = math.sqrt(math.pow((n * x), -2.0)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-42) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-11) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 1e+173) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = sqrt((Float64(n * x) ^ -2.0)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-42) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 2e-11) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 1e+173) tmp = (1.0 + (x / n)) - t_0; else tmp = sqrt(((n * x) ^ -2.0)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-42], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-11], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+173], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[Sqrt[N[Power[N[(n * x), $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-42}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+173}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{\left(n \cdot x\right)}^{-2}}\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.00000000000000004e-42Initial program 80.3%
Taylor expanded in x around inf 33.2%
mul-1-neg33.2%
log-rec33.2%
mul-1-neg33.2%
distribute-neg-frac33.2%
mul-1-neg33.2%
remove-double-neg33.2%
*-commutative33.2%
associate-/l*33.2%
associate-/r/33.2%
Simplified33.2%
Taylor expanded in n around inf 46.1%
associate-/r*46.1%
Simplified46.1%
Taylor expanded in x around inf 91.4%
mul-1-neg91.4%
log-rec91.4%
distribute-frac-neg91.4%
remove-double-neg91.4%
*-rgt-identity91.4%
associate-*r/91.4%
exp-to-pow91.4%
*-commutative91.4%
Simplified91.4%
if -1.00000000000000004e-42 < (/.f64 1 n) < 1.99999999999999988e-11Initial program 27.1%
Taylor expanded in n around inf 82.7%
diff-log82.8%
Applied egg-rr82.8%
if 1.99999999999999988e-11 < (/.f64 1 n) < 1e173Initial program 65.7%
Taylor expanded in x around 0 60.8%
if 1e173 < (/.f64 1 n) Initial program 18.6%
Taylor expanded in n around inf 6.2%
Taylor expanded in x around inf 55.7%
*-commutative55.7%
Simplified55.7%
add-sqr-sqrt55.7%
sqrt-unprod86.2%
inv-pow86.2%
inv-pow86.2%
pow-prod-up86.2%
metadata-eval86.2%
Applied egg-rr86.2%
Final simplification82.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-42)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-11)
(/ (log (/ (+ 1.0 x) x)) n)
(- (exp (/ x n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = log(((1.0 + x) / x)) / n;
} else {
tmp = exp((x / n)) - t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1d-42)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 2d-11) then
tmp = log(((1.0d0 + x) / x)) / n
else
tmp = exp((x / n)) - t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-42: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-11: tmp = math.log(((1.0 + x) / x)) / n else: tmp = math.exp((x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-42) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-11) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-42) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 2e-11) tmp = log(((1.0 + x) / x)) / n; else tmp = exp((x / n)) - t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-42], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-11], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-42}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.00000000000000004e-42Initial program 80.3%
Taylor expanded in x around inf 33.2%
mul-1-neg33.2%
log-rec33.2%
mul-1-neg33.2%
distribute-neg-frac33.2%
mul-1-neg33.2%
remove-double-neg33.2%
*-commutative33.2%
associate-/l*33.2%
associate-/r/33.2%
Simplified33.2%
Taylor expanded in n around inf 46.1%
associate-/r*46.1%
Simplified46.1%
Taylor expanded in x around inf 91.4%
mul-1-neg91.4%
log-rec91.4%
distribute-frac-neg91.4%
remove-double-neg91.4%
*-rgt-identity91.4%
associate-*r/91.4%
exp-to-pow91.4%
*-commutative91.4%
Simplified91.4%
if -1.00000000000000004e-42 < (/.f64 1 n) < 1.99999999999999988e-11Initial program 27.1%
Taylor expanded in n around inf 82.7%
diff-log82.8%
Applied egg-rr82.8%
if 1.99999999999999988e-11 < (/.f64 1 n) Initial program 46.3%
Taylor expanded in n around 0 46.3%
log1p-def97.8%
Simplified97.8%
Taylor expanded in x around 0 97.8%
Final simplification88.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-42)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-11)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 1e+173) (- (+ 1.0 (/ x n)) t_0) (/ 1.0 (* n x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 1e+173) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1d-42)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 2d-11) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 1d+173) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 1e+173) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-42: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-11: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 1e+173: tmp = (1.0 + (x / n)) - t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-42) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-11) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 1e+173) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-42) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 2e-11) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 1e+173) tmp = (1.0 + (x / n)) - t_0; else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-42], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-11], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+173], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-42}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+173}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.00000000000000004e-42Initial program 80.3%
Taylor expanded in x around inf 33.2%
mul-1-neg33.2%
log-rec33.2%
mul-1-neg33.2%
distribute-neg-frac33.2%
mul-1-neg33.2%
remove-double-neg33.2%
*-commutative33.2%
associate-/l*33.2%
associate-/r/33.2%
Simplified33.2%
Taylor expanded in n around inf 46.1%
associate-/r*46.1%
Simplified46.1%
Taylor expanded in x around inf 91.4%
mul-1-neg91.4%
log-rec91.4%
distribute-frac-neg91.4%
remove-double-neg91.4%
*-rgt-identity91.4%
associate-*r/91.4%
exp-to-pow91.4%
*-commutative91.4%
Simplified91.4%
if -1.00000000000000004e-42 < (/.f64 1 n) < 1.99999999999999988e-11Initial program 27.1%
Taylor expanded in n around inf 82.7%
diff-log82.8%
Applied egg-rr82.8%
if 1.99999999999999988e-11 < (/.f64 1 n) < 1e173Initial program 65.7%
Taylor expanded in x around 0 60.8%
if 1e173 < (/.f64 1 n) Initial program 18.6%
Taylor expanded in n around inf 6.2%
Taylor expanded in x around inf 55.7%
*-commutative55.7%
Simplified55.7%
Final simplification80.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) -5e+43)
t_0
(if (<= (/ 1.0 n) 2e-11)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 1e+173) t_0 (/ 1.0 (* n x)))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e+43) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-11) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 1e+173) {
tmp = t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
if ((1.0d0 / n) <= (-5d+43)) then
tmp = t_0
else if ((1.0d0 / n) <= 2d-11) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 1d+173) then
tmp = t_0
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e+43) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-11) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 1e+173) {
tmp = t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e+43: tmp = t_0 elif (1.0 / n) <= 2e-11: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 1e+173: tmp = t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (Float64(1.0 / n) <= -5e+43) tmp = t_0; elseif (Float64(1.0 / n) <= 2e-11) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 1e+173) tmp = t_0; else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if ((1.0 / n) <= -5e+43) tmp = t_0; elseif ((1.0 / n) <= 2e-11) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 1e+173) tmp = t_0; else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e+43], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-11], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+173], t$95$0, N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{+43}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+173}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.0000000000000004e43 or 1.99999999999999988e-11 < (/.f64 1 n) < 1e173Initial program 87.3%
Taylor expanded in x around 0 59.8%
if -5.0000000000000004e43 < (/.f64 1 n) < 1.99999999999999988e-11Initial program 27.9%
Taylor expanded in n around inf 77.7%
diff-log77.1%
Applied egg-rr77.1%
if 1e173 < (/.f64 1 n) Initial program 18.6%
Taylor expanded in n around inf 6.2%
Taylor expanded in x around inf 55.7%
*-commutative55.7%
Simplified55.7%
Final simplification69.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-42)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-11)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 1e+173) (- 1.0 t_0) (/ 1.0 (* n x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 1e+173) {
tmp = 1.0 - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1d-42)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 2d-11) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 1d+173) then
tmp = 1.0d0 - t_0
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-42) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 1e+173) {
tmp = 1.0 - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-42: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-11: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 1e+173: tmp = 1.0 - t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-42) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-11) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 1e+173) tmp = Float64(1.0 - t_0); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-42) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 2e-11) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 1e+173) tmp = 1.0 - t_0; else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-42], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-11], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+173], N[(1.0 - t$95$0), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-42}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+173}:\\
\;\;\;\;1 - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.00000000000000004e-42Initial program 80.3%
Taylor expanded in x around inf 33.2%
mul-1-neg33.2%
log-rec33.2%
mul-1-neg33.2%
distribute-neg-frac33.2%
mul-1-neg33.2%
remove-double-neg33.2%
*-commutative33.2%
associate-/l*33.2%
associate-/r/33.2%
Simplified33.2%
Taylor expanded in n around inf 46.1%
associate-/r*46.1%
Simplified46.1%
Taylor expanded in x around inf 91.4%
mul-1-neg91.4%
log-rec91.4%
distribute-frac-neg91.4%
remove-double-neg91.4%
*-rgt-identity91.4%
associate-*r/91.4%
exp-to-pow91.4%
*-commutative91.4%
Simplified91.4%
if -1.00000000000000004e-42 < (/.f64 1 n) < 1.99999999999999988e-11Initial program 27.1%
Taylor expanded in n around inf 82.7%
diff-log82.8%
Applied egg-rr82.8%
if 1.99999999999999988e-11 < (/.f64 1 n) < 1e173Initial program 65.7%
Taylor expanded in x around 0 59.2%
if 1e173 < (/.f64 1 n) Initial program 18.6%
Taylor expanded in n around inf 6.2%
Taylor expanded in x around inf 55.7%
*-commutative55.7%
Simplified55.7%
Final simplification80.2%
(FPCore (x n)
:precision binary64
(if (<= x 6.8e-236)
(/ 1.0 (/ (- n) (log x)))
(if (<= x 4.6e-217)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.0132) (- (/ x n) (/ (log x) n)) (/ (/ 1.0 n) x)))))
double code(double x, double n) {
double tmp;
if (x <= 6.8e-236) {
tmp = 1.0 / (-n / log(x));
} else if (x <= 4.6e-217) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.0132) {
tmp = (x / n) - (log(x) / n);
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 6.8d-236) then
tmp = 1.0d0 / (-n / log(x))
else if (x <= 4.6d-217) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.0132d0) then
tmp = (x / n) - (log(x) / n)
else
tmp = (1.0d0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 6.8e-236) {
tmp = 1.0 / (-n / Math.log(x));
} else if (x <= 4.6e-217) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.0132) {
tmp = (x / n) - (Math.log(x) / n);
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 6.8e-236: tmp = 1.0 / (-n / math.log(x)) elif x <= 4.6e-217: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.0132: tmp = (x / n) - (math.log(x) / n) else: tmp = (1.0 / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 6.8e-236) tmp = Float64(1.0 / Float64(Float64(-n) / log(x))); elseif (x <= 4.6e-217) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.0132) tmp = Float64(Float64(x / n) - Float64(log(x) / n)); else tmp = Float64(Float64(1.0 / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 6.8e-236) tmp = 1.0 / (-n / log(x)); elseif (x <= 4.6e-217) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.0132) tmp = (x / n) - (log(x) / n); else tmp = (1.0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 6.8e-236], N[(1.0 / N[((-n) / N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.6e-217], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.0132], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.8 \cdot 10^{-236}:\\
\;\;\;\;\frac{1}{\frac{-n}{\log x}}\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{-217}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.0132:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\end{array}
\end{array}
if x < 6.79999999999999961e-236Initial program 45.9%
Taylor expanded in n around inf 57.6%
clear-num57.6%
inv-pow57.6%
log1p-udef57.6%
Applied egg-rr57.6%
unpow-157.6%
Simplified57.6%
Taylor expanded in x around 0 57.6%
associate-*r/57.6%
neg-mul-157.6%
Simplified57.6%
if 6.79999999999999961e-236 < x < 4.6000000000000001e-217Initial program 71.7%
Taylor expanded in x around 0 71.7%
if 4.6000000000000001e-217 < x < 0.0132Initial program 29.5%
Taylor expanded in n around inf 56.1%
Taylor expanded in x around 0 56.1%
neg-mul-156.1%
+-commutative56.1%
unsub-neg56.1%
Simplified56.1%
if 0.0132 < x Initial program 63.1%
Taylor expanded in n around inf 62.7%
Taylor expanded in x around inf 67.1%
*-commutative67.1%
Simplified67.1%
Taylor expanded in x around 0 67.1%
associate-/r*67.4%
Simplified67.4%
Final simplification61.1%
(FPCore (x n)
:precision binary64
(if (<= x 7.1e-236)
(/ (- (log x)) n)
(if (<= x 1.6e-218)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.0132) (/ (- x (log x)) n) (/ (/ 1.0 n) x)))))
double code(double x, double n) {
double tmp;
if (x <= 7.1e-236) {
tmp = -log(x) / n;
} else if (x <= 1.6e-218) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.0132) {
tmp = (x - log(x)) / n;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 7.1d-236) then
tmp = -log(x) / n
else if (x <= 1.6d-218) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.0132d0) then
tmp = (x - log(x)) / n
else
tmp = (1.0d0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 7.1e-236) {
tmp = -Math.log(x) / n;
} else if (x <= 1.6e-218) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.0132) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 7.1e-236: tmp = -math.log(x) / n elif x <= 1.6e-218: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.0132: tmp = (x - math.log(x)) / n else: tmp = (1.0 / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 7.1e-236) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 1.6e-218) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.0132) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(1.0 / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 7.1e-236) tmp = -log(x) / n; elseif (x <= 1.6e-218) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.0132) tmp = (x - log(x)) / n; else tmp = (1.0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 7.1e-236], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 1.6e-218], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.0132], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.1 \cdot 10^{-236}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-218}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.0132:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\end{array}
\end{array}
if x < 7.10000000000000002e-236Initial program 45.9%
Taylor expanded in n around inf 57.6%
Taylor expanded in x around 0 57.6%
neg-mul-157.6%
Simplified57.6%
if 7.10000000000000002e-236 < x < 1.6000000000000001e-218Initial program 71.7%
Taylor expanded in x around 0 71.7%
if 1.6000000000000001e-218 < x < 0.0132Initial program 29.5%
Taylor expanded in n around inf 56.1%
Taylor expanded in x around 0 56.1%
if 0.0132 < x Initial program 63.1%
Taylor expanded in n around inf 62.7%
Taylor expanded in x around inf 67.1%
*-commutative67.1%
Simplified67.1%
Taylor expanded in x around 0 67.1%
associate-/r*67.4%
Simplified67.4%
Final simplification61.1%
(FPCore (x n)
:precision binary64
(if (<= x 2.8e-238)
(/ 1.0 (/ (- n) (log x)))
(if (<= x 4e-220)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.0132) (/ (- x (log x)) n) (/ (/ 1.0 n) x)))))
double code(double x, double n) {
double tmp;
if (x <= 2.8e-238) {
tmp = 1.0 / (-n / log(x));
} else if (x <= 4e-220) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.0132) {
tmp = (x - log(x)) / n;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 2.8d-238) then
tmp = 1.0d0 / (-n / log(x))
else if (x <= 4d-220) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.0132d0) then
tmp = (x - log(x)) / n
else
tmp = (1.0d0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 2.8e-238) {
tmp = 1.0 / (-n / Math.log(x));
} else if (x <= 4e-220) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.0132) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2.8e-238: tmp = 1.0 / (-n / math.log(x)) elif x <= 4e-220: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.0132: tmp = (x - math.log(x)) / n else: tmp = (1.0 / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 2.8e-238) tmp = Float64(1.0 / Float64(Float64(-n) / log(x))); elseif (x <= 4e-220) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.0132) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(1.0 / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 2.8e-238) tmp = 1.0 / (-n / log(x)); elseif (x <= 4e-220) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.0132) tmp = (x - log(x)) / n; else tmp = (1.0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2.8e-238], N[(1.0 / N[((-n) / N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4e-220], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.0132], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.8 \cdot 10^{-238}:\\
\;\;\;\;\frac{1}{\frac{-n}{\log x}}\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-220}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.0132:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\end{array}
\end{array}
if x < 2.80000000000000004e-238Initial program 45.9%
Taylor expanded in n around inf 57.6%
clear-num57.6%
inv-pow57.6%
log1p-udef57.6%
Applied egg-rr57.6%
unpow-157.6%
Simplified57.6%
Taylor expanded in x around 0 57.6%
associate-*r/57.6%
neg-mul-157.6%
Simplified57.6%
if 2.80000000000000004e-238 < x < 3.99999999999999997e-220Initial program 71.7%
Taylor expanded in x around 0 71.7%
if 3.99999999999999997e-220 < x < 0.0132Initial program 29.5%
Taylor expanded in n around inf 56.1%
Taylor expanded in x around 0 56.1%
if 0.0132 < x Initial program 63.1%
Taylor expanded in n around inf 62.7%
Taylor expanded in x around inf 67.1%
*-commutative67.1%
Simplified67.1%
Taylor expanded in x around 0 67.1%
associate-/r*67.4%
Simplified67.4%
Final simplification61.1%
(FPCore (x n) :precision binary64 (if (<= x 0.0132) (/ (- x (log x)) n) (/ (/ 1.0 n) x)))
double code(double x, double n) {
double tmp;
if (x <= 0.0132) {
tmp = (x - log(x)) / n;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.0132d0) then
tmp = (x - log(x)) / n
else
tmp = (1.0d0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.0132) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.0132: tmp = (x - math.log(x)) / n else: tmp = (1.0 / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 0.0132) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(1.0 / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.0132) tmp = (x - log(x)) / n; else tmp = (1.0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.0132], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.0132:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\end{array}
\end{array}
if x < 0.0132Initial program 36.4%
Taylor expanded in n around inf 53.7%
Taylor expanded in x around 0 53.7%
if 0.0132 < x Initial program 63.1%
Taylor expanded in n around inf 62.7%
Taylor expanded in x around inf 67.1%
*-commutative67.1%
Simplified67.1%
Taylor expanded in x around 0 67.1%
associate-/r*67.4%
Simplified67.4%
Final simplification58.6%
(FPCore (x n) :precision binary64 (if (<= x 0.0132) (/ (- (log x)) n) (/ (/ 1.0 n) x)))
double code(double x, double n) {
double tmp;
if (x <= 0.0132) {
tmp = -log(x) / n;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.0132d0) then
tmp = -log(x) / n
else
tmp = (1.0d0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.0132) {
tmp = -Math.log(x) / n;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.0132: tmp = -math.log(x) / n else: tmp = (1.0 / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 0.0132) tmp = Float64(Float64(-log(x)) / n); else tmp = Float64(Float64(1.0 / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.0132) tmp = -log(x) / n; else tmp = (1.0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.0132], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.0132:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\end{array}
\end{array}
if x < 0.0132Initial program 36.4%
Taylor expanded in n around inf 53.7%
Taylor expanded in x around 0 53.4%
neg-mul-153.4%
Simplified53.4%
if 0.0132 < x Initial program 63.1%
Taylor expanded in n around inf 62.7%
Taylor expanded in x around inf 67.1%
*-commutative67.1%
Simplified67.1%
Taylor expanded in x around 0 67.1%
associate-/r*67.4%
Simplified67.4%
Final simplification58.4%
(FPCore (x n) :precision binary64 (if (<= n -400.0) (/ 1.0 (* n (+ x 0.5))) (/ (/ 1.0 x) n)))
double code(double x, double n) {
double tmp;
if (n <= -400.0) {
tmp = 1.0 / (n * (x + 0.5));
} 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 (n <= (-400.0d0)) then
tmp = 1.0d0 / (n * (x + 0.5d0))
else
tmp = (1.0d0 / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (n <= -400.0) {
tmp = 1.0 / (n * (x + 0.5));
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -400.0: tmp = 1.0 / (n * (x + 0.5)) else: tmp = (1.0 / x) / n return tmp
function code(x, n) tmp = 0.0 if (n <= -400.0) tmp = Float64(1.0 / Float64(n * Float64(x + 0.5))); else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (n <= -400.0) tmp = 1.0 / (n * (x + 0.5)); else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[n, -400.0], N[(1.0 / N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -400:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if n < -400Initial program 28.3%
Taylor expanded in n around inf 77.8%
clear-num77.8%
inv-pow77.8%
log1p-udef77.8%
Applied egg-rr77.8%
unpow-177.8%
Simplified77.8%
Taylor expanded in x around inf 48.6%
+-commutative48.6%
*-commutative48.6%
distribute-lft-out48.6%
Simplified48.6%
if -400 < n Initial program 54.7%
Taylor expanded in n around inf 46.5%
Taylor expanded in x around inf 36.5%
Final simplification40.6%
(FPCore (x n) :precision binary64 (/ 1.0 (* n x)))
double code(double x, double n) {
return 1.0 / (n * x);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 1.0d0 / (n * x)
end function
public static double code(double x, double n) {
return 1.0 / (n * x);
}
def code(x, n): return 1.0 / (n * x)
function code(x, n) return Float64(1.0 / Float64(n * x)) end
function tmp = code(x, n) tmp = 1.0 / (n * x); end
code[x_, n_] := N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{n \cdot x}
\end{array}
Initial program 45.9%
Taylor expanded in n around inf 56.9%
Taylor expanded in x around inf 38.7%
*-commutative38.7%
Simplified38.7%
Final simplification38.7%
(FPCore (x n) :precision binary64 (/ (/ 1.0 n) x))
double code(double x, double n) {
return (1.0 / n) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / n) / x
end function
public static double code(double x, double n) {
return (1.0 / n) / x;
}
def code(x, n): return (1.0 / n) / x
function code(x, n) return Float64(Float64(1.0 / n) / x) end
function tmp = code(x, n) tmp = (1.0 / n) / x; end
code[x_, n_] := N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n}}{x}
\end{array}
Initial program 45.9%
Taylor expanded in n around inf 56.9%
Taylor expanded in x around inf 38.7%
*-commutative38.7%
Simplified38.7%
Taylor expanded in x around 0 38.7%
associate-/r*38.8%
Simplified38.8%
Final simplification38.8%
(FPCore (x n) :precision binary64 (* n x))
double code(double x, double n) {
return n * x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = n * x
end function
public static double code(double x, double n) {
return n * x;
}
def code(x, n): return n * x
function code(x, n) return Float64(n * x) end
function tmp = code(x, n) tmp = n * x; end
code[x_, n_] := N[(n * x), $MachinePrecision]
\begin{array}{l}
\\
n \cdot x
\end{array}
Initial program 45.9%
Taylor expanded in n around inf 56.9%
Taylor expanded in x around inf 38.7%
*-commutative38.7%
Simplified38.7%
Taylor expanded in x around 0 38.7%
associate-/r*38.8%
Simplified38.8%
associate-/l/38.7%
add-exp-log15.2%
exp-neg15.2%
add-sqr-sqrt5.3%
sqrt-unprod5.8%
sqr-neg5.8%
sqrt-unprod0.5%
add-sqr-sqrt1.6%
*-un-lft-identity1.6%
add-exp-log3.3%
*-commutative3.3%
Applied egg-rr3.3%
Final simplification3.3%
herbie shell --seed 2024022
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))