
(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 23 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-94)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 10.0)
(/
(-
(+
(log1p x)
(/
(-
(* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0)))
(/
(+
(*
-0.16666666666666666
(- (pow (log1p x) 3.0) (pow (log x) 3.0)))
(*
-0.041666666666666664
(/ (- (pow (log1p x) 4.0) (pow (log x) 4.0)) n)))
n))
n))
(log 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) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 10.0) {
tmp = ((log1p(x) + (((0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0))) - (((-0.16666666666666666 * (pow(log1p(x), 3.0) - pow(log(x), 3.0))) + (-0.041666666666666664 * ((pow(log1p(x), 4.0) - pow(log(x), 4.0)) / n))) / n)) / n)) - log(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) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 10.0) {
tmp = ((Math.log1p(x) + (((0.5 * (Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0))) - (((-0.16666666666666666 * (Math.pow(Math.log1p(x), 3.0) - Math.pow(Math.log(x), 3.0))) + (-0.041666666666666664 * ((Math.pow(Math.log1p(x), 4.0) - Math.pow(Math.log(x), 4.0)) / n))) / n)) / n)) - Math.log(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) <= -4e-94: tmp = t_0 / (n * x) elif (1.0 / n) <= 10.0: tmp = ((math.log1p(x) + (((0.5 * (math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0))) - (((-0.16666666666666666 * (math.pow(math.log1p(x), 3.0) - math.pow(math.log(x), 3.0))) + (-0.041666666666666664 * ((math.pow(math.log1p(x), 4.0) - math.pow(math.log(x), 4.0)) / n))) / n)) / n)) - math.log(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) <= -4e-94) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 10.0) tmp = Float64(Float64(Float64(log1p(x) + Float64(Float64(Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) - Float64(Float64(Float64(-0.16666666666666666 * Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0))) + Float64(-0.041666666666666664 * Float64(Float64((log1p(x) ^ 4.0) - (log(x) ^ 4.0)) / n))) / n)) / n)) - log(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], -4e-94], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 10.0], N[(N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(-0.16666666666666666 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.041666666666666664 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 4.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[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 -4 \cdot 10^{-94}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10:\\
\;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right) + -0.041666666666666664 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{4} - {\log x}^{4}}{n}}{n}}{n}\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.9999999999999998e-94Initial program 81.3%
Taylor expanded in x around inf 93.4%
mul-1-neg93.4%
log-rec93.4%
mul-1-neg93.4%
distribute-neg-frac93.4%
mul-1-neg93.4%
remove-double-neg93.4%
*-rgt-identity93.4%
associate-/l*93.4%
exp-to-pow93.4%
*-commutative93.4%
Simplified93.4%
if -3.9999999999999998e-94 < (/.f64 #s(literal 1 binary64) n) < 10Initial program 36.0%
Taylor expanded in n around -inf 83.1%
Simplified83.1%
if 10 < (/.f64 #s(literal 1 binary64) n) Initial program 63.0%
Taylor expanded in n around 0 63.0%
log1p-define100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
Simplified100.0%
Final simplification88.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-94)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 10.0)
(/
(-
(+
(log1p x)
(/
(+
(* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0)))
(*
0.16666666666666666
(/ (- (pow (log1p x) 3.0) (pow (log x) 3.0)) n)))
n))
(log x))
n)
(- (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) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 10.0) {
tmp = ((log1p(x) + (((0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0))) + (0.16666666666666666 * ((pow(log1p(x), 3.0) - pow(log(x), 3.0)) / n))) / n)) - log(x)) / n;
} else {
tmp = 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) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 10.0) {
tmp = ((Math.log1p(x) + (((0.5 * (Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0))) + (0.16666666666666666 * ((Math.pow(Math.log1p(x), 3.0) - Math.pow(Math.log(x), 3.0)) / n))) / n)) - Math.log(x)) / n;
} else {
tmp = Math.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) <= -4e-94: tmp = t_0 / (n * x) elif (1.0 / n) <= 10.0: tmp = ((math.log1p(x) + (((0.5 * (math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0))) + (0.16666666666666666 * ((math.pow(math.log1p(x), 3.0) - math.pow(math.log(x), 3.0)) / n))) / n)) - math.log(x)) / n else: tmp = math.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) <= -4e-94) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 10.0) tmp = Float64(Float64(Float64(log1p(x) + Float64(Float64(Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) + Float64(0.16666666666666666 * Float64(Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0)) / n))) / n)) - log(x)) / n); else tmp = Float64(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], -4e-94], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 10.0], N[(N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[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 -4 \cdot 10^{-94}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10:\\
\;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + 0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}}{n}\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.9999999999999998e-94Initial program 81.3%
Taylor expanded in x around inf 93.4%
mul-1-neg93.4%
log-rec93.4%
mul-1-neg93.4%
distribute-neg-frac93.4%
mul-1-neg93.4%
remove-double-neg93.4%
*-rgt-identity93.4%
associate-/l*93.4%
exp-to-pow93.4%
*-commutative93.4%
Simplified93.4%
if -3.9999999999999998e-94 < (/.f64 #s(literal 1 binary64) n) < 10Initial program 36.0%
Taylor expanded in n around -inf 83.0%
Simplified83.0%
if 10 < (/.f64 #s(literal 1 binary64) n) Initial program 63.0%
Taylor expanded in n around 0 63.0%
log1p-define100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
Simplified100.0%
Final simplification88.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-94)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 5e-10)
(/
(log
(/
(*
(sqrt (exp (/ (- (pow (log1p x) 2.0) (pow (log x) 2.0)) n)))
(+ 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) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-10) {
tmp = log(((sqrt(exp(((pow(log1p(x), 2.0) - pow(log(x), 2.0)) / n))) * (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) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-10) {
tmp = Math.log(((Math.sqrt(Math.exp(((Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0)) / n))) * (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) <= -4e-94: tmp = t_0 / (n * x) elif (1.0 / n) <= 5e-10: tmp = math.log(((math.sqrt(math.exp(((math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0)) / n))) * (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) <= -4e-94) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 5e-10) tmp = Float64(log(Float64(Float64(sqrt(exp(Float64(Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)) / n))) * 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], -4e-94], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-10], N[(N[Log[N[(N[(N[Sqrt[N[Exp[N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(1.0 + x), $MachinePrecision]), $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 -4 \cdot 10^{-94}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-10}:\\
\;\;\;\;\frac{\log \left(\frac{\sqrt{e^{\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n}}} \cdot \left(1 + x\right)}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.9999999999999998e-94Initial program 81.3%
Taylor expanded in x around inf 93.4%
mul-1-neg93.4%
log-rec93.4%
mul-1-neg93.4%
distribute-neg-frac93.4%
mul-1-neg93.4%
remove-double-neg93.4%
*-rgt-identity93.4%
associate-/l*93.4%
exp-to-pow93.4%
*-commutative93.4%
Simplified93.4%
if -3.9999999999999998e-94 < (/.f64 #s(literal 1 binary64) n) < 5.00000000000000031e-10Initial program 35.9%
Taylor expanded in n around inf 83.9%
Simplified83.9%
associate-+r-83.9%
add-log-exp83.9%
exp-diff83.9%
add-exp-log58.1%
Applied egg-rr58.1%
+-commutative58.1%
exp-sum58.1%
*-commutative58.1%
exp-prod58.1%
unpow1/258.1%
log1p-define58.1%
rem-exp-log84.1%
Simplified84.1%
if 5.00000000000000031e-10 < (/.f64 #s(literal 1 binary64) n) Initial program 61.0%
Taylor expanded in n around 0 61.0%
log1p-define94.5%
*-rgt-identity94.5%
associate-/l*94.5%
exp-to-pow94.5%
Simplified94.5%
Final simplification88.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-94)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 5e-10)
(/
(-
(log1p x)
(+ (log x) (* 0.5 (/ (- (pow (log x) 2.0) (pow (log1p x) 2.0)) n))))
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) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-10) {
tmp = (log1p(x) - (log(x) + (0.5 * ((pow(log(x), 2.0) - pow(log1p(x), 2.0)) / n)))) / 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) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-10) {
tmp = (Math.log1p(x) - (Math.log(x) + (0.5 * ((Math.pow(Math.log(x), 2.0) - Math.pow(Math.log1p(x), 2.0)) / n)))) / 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) <= -4e-94: tmp = t_0 / (n * x) elif (1.0 / n) <= 5e-10: tmp = (math.log1p(x) - (math.log(x) + (0.5 * ((math.pow(math.log(x), 2.0) - math.pow(math.log1p(x), 2.0)) / n)))) / 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) <= -4e-94) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 5e-10) tmp = Float64(Float64(log1p(x) - Float64(log(x) + Float64(0.5 * Float64(Float64((log(x) ^ 2.0) - (log1p(x) ^ 2.0)) / n)))) / 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], -4e-94], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-10], N[(N[(N[Log[1 + x], $MachinePrecision] - N[(N[Log[x], $MachinePrecision] + N[(0.5 * N[(N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-94}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-10}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \left(\log x + 0.5 \cdot \frac{{\log x}^{2} - {\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.9999999999999998e-94Initial program 81.3%
Taylor expanded in x around inf 93.4%
mul-1-neg93.4%
log-rec93.4%
mul-1-neg93.4%
distribute-neg-frac93.4%
mul-1-neg93.4%
remove-double-neg93.4%
*-rgt-identity93.4%
associate-/l*93.4%
exp-to-pow93.4%
*-commutative93.4%
Simplified93.4%
if -3.9999999999999998e-94 < (/.f64 #s(literal 1 binary64) n) < 5.00000000000000031e-10Initial program 35.9%
Taylor expanded in n around inf 83.9%
Simplified83.9%
if 5.00000000000000031e-10 < (/.f64 #s(literal 1 binary64) n) Initial program 61.0%
Taylor expanded in n around 0 61.0%
log1p-define94.5%
*-rgt-identity94.5%
associate-/l*94.5%
exp-to-pow94.5%
Simplified94.5%
Final simplification88.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-94)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-12)
(/ (log (/ x (+ 1.0 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) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-12) {
tmp = log((x / (1.0 + 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) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-12) {
tmp = Math.log((x / (1.0 + 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) <= -4e-94: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-12: tmp = math.log((x / (1.0 + 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) <= -4e-94) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-12) tmp = Float64(log(Float64(x / Float64(1.0 + x))) / Float64(-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], -4e-94], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-12], N[(N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-94}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;\frac{\log \left(\frac{x}{1 + x}\right)}{-n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.9999999999999998e-94Initial program 81.3%
Taylor expanded in x around inf 93.4%
mul-1-neg93.4%
log-rec93.4%
mul-1-neg93.4%
distribute-neg-frac93.4%
mul-1-neg93.4%
remove-double-neg93.4%
*-rgt-identity93.4%
associate-/l*93.4%
exp-to-pow93.4%
*-commutative93.4%
Simplified93.4%
if -3.9999999999999998e-94 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12Initial program 35.7%
Taylor expanded in n around inf 83.8%
Simplified83.8%
associate-+r-83.8%
add-log-exp83.8%
exp-diff83.8%
add-exp-log57.9%
Applied egg-rr57.9%
+-commutative57.9%
exp-sum57.9%
*-commutative57.9%
exp-prod57.9%
unpow1/257.9%
log1p-define57.9%
rem-exp-log84.1%
Simplified84.1%
Taylor expanded in n around inf 83.6%
+-commutative83.6%
Simplified83.6%
clear-num83.6%
log-div83.6%
metadata-eval83.6%
Applied egg-rr83.6%
neg-sub083.6%
Simplified83.6%
if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) Initial program 61.2%
Taylor expanded in n around 0 61.2%
log1p-define94.0%
*-rgt-identity94.0%
associate-/l*94.0%
exp-to-pow94.0%
Simplified94.0%
Final simplification87.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-94)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-12)
(/ (log (/ x (+ 1.0 x))) (- n))
(-
(+
1.0
(*
x
(+
(/ 1.0 n)
(* x (+ (* 0.5 (/ 1.0 (pow n 2.0))) (* 0.5 (/ -1.0 n)))))))
t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-12) {
tmp = log((x / (1.0 + x))) / -n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / pow(n, 2.0))) + (0.5 * (-1.0 / 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) <= (-4d-94)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 2d-12) then
tmp = log((x / (1.0d0 + x))) / -n
else
tmp = (1.0d0 + (x * ((1.0d0 / n) + (x * ((0.5d0 * (1.0d0 / (n ** 2.0d0))) + (0.5d0 * ((-1.0d0) / 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) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-12) {
tmp = Math.log((x / (1.0 + x))) / -n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / Math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))))) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -4e-94: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-12: tmp = math.log((x / (1.0 + x))) / -n else: tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))))) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-94) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-12) tmp = Float64(log(Float64(x / Float64(1.0 + x))) / Float64(-n)); 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))))))) - 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) <= -4e-94) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 2e-12) tmp = log((x / (1.0 + x))) / -n; else tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / (n ^ 2.0))) + (0.5 * (-1.0 / 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], -4e-94], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-12], N[(N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], 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] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-94}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;\frac{\log \left(\frac{x}{1 + x}\right)}{-n}\\
\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) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.9999999999999998e-94Initial program 81.3%
Taylor expanded in x around inf 93.4%
mul-1-neg93.4%
log-rec93.4%
mul-1-neg93.4%
distribute-neg-frac93.4%
mul-1-neg93.4%
remove-double-neg93.4%
*-rgt-identity93.4%
associate-/l*93.4%
exp-to-pow93.4%
*-commutative93.4%
Simplified93.4%
if -3.9999999999999998e-94 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12Initial program 35.7%
Taylor expanded in n around inf 83.8%
Simplified83.8%
associate-+r-83.8%
add-log-exp83.8%
exp-diff83.8%
add-exp-log57.9%
Applied egg-rr57.9%
+-commutative57.9%
exp-sum57.9%
*-commutative57.9%
exp-prod57.9%
unpow1/257.9%
log1p-define57.9%
rem-exp-log84.1%
Simplified84.1%
Taylor expanded in n around inf 83.6%
+-commutative83.6%
Simplified83.6%
clear-num83.6%
log-div83.6%
metadata-eval83.6%
Applied egg-rr83.6%
neg-sub083.6%
Simplified83.6%
if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) Initial program 61.2%
Taylor expanded in x around 0 74.6%
Final simplification84.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-94)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-12)
(/ (log (/ x (+ 1.0 x))) (- n))
(if (<= (/ 1.0 n) 2e+161)
(- (pow (+ 1.0 x) (/ 1.0 n)) t_0)
(log1p (expm1 (/ x n))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-12) {
tmp = log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 2e+161) {
tmp = pow((1.0 + x), (1.0 / n)) - t_0;
} else {
tmp = log1p(expm1((x / n)));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-12) {
tmp = Math.log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 2e+161) {
tmp = Math.pow((1.0 + x), (1.0 / n)) - t_0;
} else {
tmp = Math.log1p(Math.expm1((x / n)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -4e-94: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-12: tmp = math.log((x / (1.0 + x))) / -n elif (1.0 / n) <= 2e+161: tmp = math.pow((1.0 + x), (1.0 / n)) - t_0 else: tmp = math.log1p(math.expm1((x / n))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-94) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-12) tmp = Float64(log(Float64(x / Float64(1.0 + x))) / Float64(-n)); elseif (Float64(1.0 / n) <= 2e+161) tmp = Float64((Float64(1.0 + x) ^ Float64(1.0 / n)) - t_0); else tmp = log1p(expm1(Float64(x / n))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-94], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-12], N[(N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+161], N[(N[Power[N[(1.0 + x), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], N[Log[1 + N[(Exp[N[(x / n), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-94}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;\frac{\log \left(\frac{x}{1 + x}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+161}:\\
\;\;\;\;{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{n}\right)\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.9999999999999998e-94Initial program 81.3%
Taylor expanded in x around inf 93.4%
mul-1-neg93.4%
log-rec93.4%
mul-1-neg93.4%
distribute-neg-frac93.4%
mul-1-neg93.4%
remove-double-neg93.4%
*-rgt-identity93.4%
associate-/l*93.4%
exp-to-pow93.4%
*-commutative93.4%
Simplified93.4%
if -3.9999999999999998e-94 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12Initial program 35.7%
Taylor expanded in n around inf 83.8%
Simplified83.8%
associate-+r-83.8%
add-log-exp83.8%
exp-diff83.8%
add-exp-log57.9%
Applied egg-rr57.9%
+-commutative57.9%
exp-sum57.9%
*-commutative57.9%
exp-prod57.9%
unpow1/257.9%
log1p-define57.9%
rem-exp-log84.1%
Simplified84.1%
Taylor expanded in n around inf 83.6%
+-commutative83.6%
Simplified83.6%
clear-num83.6%
log-div83.6%
metadata-eval83.6%
Applied egg-rr83.6%
neg-sub083.6%
Simplified83.6%
if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e161Initial program 79.9%
if 2.0000000000000001e161 < (/.f64 #s(literal 1 binary64) n) Initial program 31.6%
Taylor expanded in n around inf 5.6%
log1p-define5.6%
Simplified5.6%
Taylor expanded in x around 0 5.6%
Taylor expanded in x around inf 5.3%
log1p-expm1-u78.4%
Applied egg-rr78.4%
Final simplification85.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-94)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-12)
(/ (log (/ x (+ 1.0 x))) (- n))
(if (<= (/ 1.0 n) 2e+161)
(- (+ 1.0 (/ x n)) t_0)
(log1p (expm1 (/ x n))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-12) {
tmp = log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 2e+161) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = log1p(expm1((x / n)));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-12) {
tmp = Math.log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 2e+161) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = Math.log1p(Math.expm1((x / n)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -4e-94: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-12: tmp = math.log((x / (1.0 + x))) / -n elif (1.0 / n) <= 2e+161: tmp = (1.0 + (x / n)) - t_0 else: tmp = math.log1p(math.expm1((x / n))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-94) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-12) tmp = Float64(log(Float64(x / Float64(1.0 + x))) / Float64(-n)); elseif (Float64(1.0 / n) <= 2e+161) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = log1p(expm1(Float64(x / n))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-94], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-12], N[(N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+161], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[Log[1 + N[(Exp[N[(x / n), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-94}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;\frac{\log \left(\frac{x}{1 + x}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+161}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{n}\right)\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.9999999999999998e-94Initial program 81.3%
Taylor expanded in x around inf 93.4%
mul-1-neg93.4%
log-rec93.4%
mul-1-neg93.4%
distribute-neg-frac93.4%
mul-1-neg93.4%
remove-double-neg93.4%
*-rgt-identity93.4%
associate-/l*93.4%
exp-to-pow93.4%
*-commutative93.4%
Simplified93.4%
if -3.9999999999999998e-94 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12Initial program 35.7%
Taylor expanded in n around inf 83.8%
Simplified83.8%
associate-+r-83.8%
add-log-exp83.8%
exp-diff83.8%
add-exp-log57.9%
Applied egg-rr57.9%
+-commutative57.9%
exp-sum57.9%
*-commutative57.9%
exp-prod57.9%
unpow1/257.9%
log1p-define57.9%
rem-exp-log84.1%
Simplified84.1%
Taylor expanded in n around inf 83.6%
+-commutative83.6%
Simplified83.6%
clear-num83.6%
log-div83.6%
metadata-eval83.6%
Applied egg-rr83.6%
neg-sub083.6%
Simplified83.6%
if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e161Initial program 79.9%
Taylor expanded in x around 0 76.5%
if 2.0000000000000001e161 < (/.f64 #s(literal 1 binary64) n) Initial program 31.6%
Taylor expanded in n around inf 5.6%
log1p-define5.6%
Simplified5.6%
Taylor expanded in x around 0 5.6%
Taylor expanded in x around inf 5.3%
log1p-expm1-u78.4%
Applied egg-rr78.4%
Final simplification85.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-94)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-12)
(/ (log (/ x (+ 1.0 x))) (- n))
(if (<= (/ 1.0 n) 2e+161)
(- (+ 1.0 (/ x n)) t_0)
(/ (- x (log1p (+ x -1.0))) n))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-12) {
tmp = log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 2e+161) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = (x - log1p((x + -1.0))) / n;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-12) {
tmp = Math.log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 2e+161) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = (x - Math.log1p((x + -1.0))) / n;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -4e-94: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-12: tmp = math.log((x / (1.0 + x))) / -n elif (1.0 / n) <= 2e+161: tmp = (1.0 + (x / n)) - t_0 else: tmp = (x - math.log1p((x + -1.0))) / n return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-94) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-12) tmp = Float64(log(Float64(x / Float64(1.0 + x))) / Float64(-n)); elseif (Float64(1.0 / n) <= 2e+161) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(Float64(x - log1p(Float64(x + -1.0))) / n); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-94], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-12], N[(N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+161], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(x - N[Log[1 + N[(x + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-94}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;\frac{\log \left(\frac{x}{1 + x}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+161}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \mathsf{log1p}\left(x + -1\right)}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.9999999999999998e-94Initial program 81.3%
Taylor expanded in x around inf 93.4%
mul-1-neg93.4%
log-rec93.4%
mul-1-neg93.4%
distribute-neg-frac93.4%
mul-1-neg93.4%
remove-double-neg93.4%
*-rgt-identity93.4%
associate-/l*93.4%
exp-to-pow93.4%
*-commutative93.4%
Simplified93.4%
if -3.9999999999999998e-94 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12Initial program 35.7%
Taylor expanded in n around inf 83.8%
Simplified83.8%
associate-+r-83.8%
add-log-exp83.8%
exp-diff83.8%
add-exp-log57.9%
Applied egg-rr57.9%
+-commutative57.9%
exp-sum57.9%
*-commutative57.9%
exp-prod57.9%
unpow1/257.9%
log1p-define57.9%
rem-exp-log84.1%
Simplified84.1%
Taylor expanded in n around inf 83.6%
+-commutative83.6%
Simplified83.6%
clear-num83.6%
log-div83.6%
metadata-eval83.6%
Applied egg-rr83.6%
neg-sub083.6%
Simplified83.6%
if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e161Initial program 79.9%
Taylor expanded in x around 0 76.5%
if 2.0000000000000001e161 < (/.f64 #s(literal 1 binary64) n) Initial program 31.6%
Taylor expanded in n around inf 5.6%
log1p-define5.6%
Simplified5.6%
Taylor expanded in x around 0 5.6%
log1p-expm1-u71.6%
expm1-undefine71.6%
add-exp-log71.6%
Applied egg-rr71.6%
Final simplification84.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-94)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-12)
(/ (log (/ x (+ 1.0 x))) (- n))
(if (<= (/ 1.0 n) 2e+161)
(- 1.0 t_0)
(/ (- x (log1p (+ x -1.0))) n))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-12) {
tmp = log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 2e+161) {
tmp = 1.0 - t_0;
} else {
tmp = (x - log1p((x + -1.0))) / n;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-94) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-12) {
tmp = Math.log((x / (1.0 + x))) / -n;
} else if ((1.0 / n) <= 2e+161) {
tmp = 1.0 - t_0;
} else {
tmp = (x - Math.log1p((x + -1.0))) / n;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -4e-94: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-12: tmp = math.log((x / (1.0 + x))) / -n elif (1.0 / n) <= 2e+161: tmp = 1.0 - t_0 else: tmp = (x - math.log1p((x + -1.0))) / n return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-94) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-12) tmp = Float64(log(Float64(x / Float64(1.0 + x))) / Float64(-n)); elseif (Float64(1.0 / n) <= 2e+161) tmp = Float64(1.0 - t_0); else tmp = Float64(Float64(x - log1p(Float64(x + -1.0))) / n); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-94], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-12], N[(N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+161], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(x - N[Log[1 + N[(x + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-94}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;\frac{\log \left(\frac{x}{1 + x}\right)}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+161}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \mathsf{log1p}\left(x + -1\right)}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.9999999999999998e-94Initial program 81.3%
Taylor expanded in x around inf 93.4%
mul-1-neg93.4%
log-rec93.4%
mul-1-neg93.4%
distribute-neg-frac93.4%
mul-1-neg93.4%
remove-double-neg93.4%
*-rgt-identity93.4%
associate-/l*93.4%
exp-to-pow93.4%
*-commutative93.4%
Simplified93.4%
if -3.9999999999999998e-94 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12Initial program 35.7%
Taylor expanded in n around inf 83.8%
Simplified83.8%
associate-+r-83.8%
add-log-exp83.8%
exp-diff83.8%
add-exp-log57.9%
Applied egg-rr57.9%
+-commutative57.9%
exp-sum57.9%
*-commutative57.9%
exp-prod57.9%
unpow1/257.9%
log1p-define57.9%
rem-exp-log84.1%
Simplified84.1%
Taylor expanded in n around inf 83.6%
+-commutative83.6%
Simplified83.6%
clear-num83.6%
log-div83.6%
metadata-eval83.6%
Applied egg-rr83.6%
neg-sub083.6%
Simplified83.6%
if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e161Initial program 79.9%
Taylor expanded in x around 0 76.2%
*-rgt-identity76.2%
associate-/l*76.2%
exp-to-pow76.2%
Simplified76.2%
if 2.0000000000000001e161 < (/.f64 #s(literal 1 binary64) n) Initial program 31.6%
Taylor expanded in n around inf 5.6%
log1p-define5.6%
Simplified5.6%
Taylor expanded in x around 0 5.6%
log1p-expm1-u71.6%
expm1-undefine71.6%
add-exp-log71.6%
Applied egg-rr71.6%
Final simplification84.5%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) 2e-12)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 2e+161)
(- 1.0 (pow x (/ 1.0 n)))
(/ (- x (log1p (+ x -1.0))) n))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 2e-12) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e+161) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = (x - log1p((x + -1.0))) / n;
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 2e-12) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e+161) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = (x - Math.log1p((x + -1.0))) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= 2e-12: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 2e+161: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = (x - math.log1p((x + -1.0))) / n return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= 2e-12) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 2e+161) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(Float64(x - log1p(Float64(x + -1.0))) / n); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-12], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+161], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(x - N[Log[1 + N[(x + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+161}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \mathsf{log1p}\left(x + -1\right)}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12Initial program 49.7%
Taylor expanded in n around inf 73.8%
log1p-define73.8%
Simplified73.8%
log1p-undefine73.8%
diff-log73.9%
Applied egg-rr73.9%
if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e161Initial program 79.9%
Taylor expanded in x around 0 76.2%
*-rgt-identity76.2%
associate-/l*76.2%
exp-to-pow76.2%
Simplified76.2%
if 2.0000000000000001e161 < (/.f64 #s(literal 1 binary64) n) Initial program 31.6%
Taylor expanded in n around inf 5.6%
log1p-define5.6%
Simplified5.6%
Taylor expanded in x around 0 5.6%
log1p-expm1-u71.6%
expm1-undefine71.6%
add-exp-log71.6%
Applied egg-rr71.6%
Final simplification74.0%
(FPCore (x n)
:precision binary64
(if (<= x 2.8e-204)
(/ -1.0 (/ n (log x)))
(if (<= x 1.8e-143)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.92)
(/ (- x (log x)) n)
(if (<= x 1.46e+94)
(/
(/ (- 1.0 (/ (- 0.5 (/ (- 0.3333333333333333 (/ 0.25 x)) x)) x)) x)
n)
(/ 0.0 n))))))
double code(double x, double n) {
double tmp;
if (x <= 2.8e-204) {
tmp = -1.0 / (n / log(x));
} else if (x <= 1.8e-143) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.92) {
tmp = (x - log(x)) / n;
} else if (x <= 1.46e+94) {
tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 2.8d-204) then
tmp = (-1.0d0) / (n / log(x))
else if (x <= 1.8d-143) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.92d0) then
tmp = (x - log(x)) / n
else if (x <= 1.46d+94) then
tmp = ((1.0d0 - ((0.5d0 - ((0.3333333333333333d0 - (0.25d0 / x)) / x)) / x)) / x) / n
else
tmp = 0.0d0 / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 2.8e-204) {
tmp = -1.0 / (n / Math.log(x));
} else if (x <= 1.8e-143) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.92) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 1.46e+94) {
tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2.8e-204: tmp = -1.0 / (n / math.log(x)) elif x <= 1.8e-143: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.92: tmp = (x - math.log(x)) / n elif x <= 1.46e+94: tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 2.8e-204) tmp = Float64(-1.0 / Float64(n / log(x))); elseif (x <= 1.8e-143) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.92) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 1.46e+94) tmp = Float64(Float64(Float64(1.0 - Float64(Float64(0.5 - Float64(Float64(0.3333333333333333 - Float64(0.25 / x)) / x)) / x)) / x) / n); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 2.8e-204) tmp = -1.0 / (n / log(x)); elseif (x <= 1.8e-143) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.92) tmp = (x - log(x)) / n; elseif (x <= 1.46e+94) tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2.8e-204], N[(-1.0 / N[(n / N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.8e-143], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.92], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 1.46e+94], N[(N[(N[(1.0 - N[(N[(0.5 - N[(N[(0.3333333333333333 - N[(0.25 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.8 \cdot 10^{-204}:\\
\;\;\;\;\frac{-1}{\frac{n}{\log x}}\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-143}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.92:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 1.46 \cdot 10^{+94}:\\
\;\;\;\;\frac{\frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \frac{0.25}{x}}{x}}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 2.8e-204Initial program 45.9%
Taylor expanded in n around inf 58.9%
log1p-define58.9%
Simplified58.9%
clear-num58.9%
inv-pow58.9%
Applied egg-rr58.9%
unpow-158.9%
Simplified58.9%
Taylor expanded in x around 0 58.9%
associate-*r/58.9%
neg-mul-158.9%
Simplified58.9%
if 2.8e-204 < x < 1.7999999999999999e-143Initial program 66.6%
Taylor expanded in x around 0 66.6%
*-rgt-identity66.6%
associate-/l*66.6%
exp-to-pow66.6%
Simplified66.6%
if 1.7999999999999999e-143 < x < 0.92000000000000004Initial program 21.1%
Taylor expanded in n around inf 69.9%
log1p-define69.9%
Simplified69.9%
Taylor expanded in x around 0 69.1%
if 0.92000000000000004 < x < 1.46000000000000005e94Initial program 38.2%
Taylor expanded in n around inf 39.1%
log1p-define39.1%
Simplified39.1%
Taylor expanded in x around -inf 68.8%
Taylor expanded in x around -inf 68.8%
mul-1-neg68.8%
distribute-neg-frac268.8%
mul-1-neg68.8%
unsub-neg68.8%
mul-1-neg68.8%
unsub-neg68.8%
associate-*r/68.8%
metadata-eval68.8%
Simplified68.8%
if 1.46000000000000005e94 < x Initial program 81.7%
Taylor expanded in n around inf 81.7%
Simplified81.7%
associate-+r-81.7%
add-log-exp81.7%
exp-diff81.7%
add-exp-log8.7%
Applied egg-rr8.7%
+-commutative8.7%
exp-sum8.7%
*-commutative8.7%
exp-prod8.7%
unpow1/28.7%
log1p-define8.7%
rem-exp-log81.7%
Simplified81.7%
Taylor expanded in x around inf 81.7%
Final simplification70.8%
(FPCore (x n)
:precision binary64
(if (<= x 2.3e-204)
(/ (log x) (- n))
(if (<= x 3.6e-143)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.88)
(/ (- x (log x)) n)
(if (<= x 1.6e+94)
(/
(/ (- 1.0 (/ (- 0.5 (/ (- 0.3333333333333333 (/ 0.25 x)) x)) x)) x)
n)
(/ 0.0 n))))))
double code(double x, double n) {
double tmp;
if (x <= 2.3e-204) {
tmp = log(x) / -n;
} else if (x <= 3.6e-143) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.88) {
tmp = (x - log(x)) / n;
} else if (x <= 1.6e+94) {
tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 2.3d-204) then
tmp = log(x) / -n
else if (x <= 3.6d-143) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.88d0) then
tmp = (x - log(x)) / n
else if (x <= 1.6d+94) then
tmp = ((1.0d0 - ((0.5d0 - ((0.3333333333333333d0 - (0.25d0 / x)) / x)) / x)) / x) / n
else
tmp = 0.0d0 / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 2.3e-204) {
tmp = Math.log(x) / -n;
} else if (x <= 3.6e-143) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.88) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 1.6e+94) {
tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2.3e-204: tmp = math.log(x) / -n elif x <= 3.6e-143: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.88: tmp = (x - math.log(x)) / n elif x <= 1.6e+94: tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 2.3e-204) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 3.6e-143) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.88) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 1.6e+94) tmp = Float64(Float64(Float64(1.0 - Float64(Float64(0.5 - Float64(Float64(0.3333333333333333 - Float64(0.25 / x)) / x)) / x)) / x) / n); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 2.3e-204) tmp = log(x) / -n; elseif (x <= 3.6e-143) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.88) tmp = (x - log(x)) / n; elseif (x <= 1.6e+94) tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2.3e-204], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 3.6e-143], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.88], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 1.6e+94], N[(N[(N[(1.0 - N[(N[(0.5 - N[(N[(0.3333333333333333 - N[(0.25 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.3 \cdot 10^{-204}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-143}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.88:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{+94}:\\
\;\;\;\;\frac{\frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \frac{0.25}{x}}{x}}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 2.2999999999999999e-204Initial program 45.9%
Taylor expanded in n around inf 58.9%
log1p-define58.9%
Simplified58.9%
Taylor expanded in x around 0 58.9%
neg-mul-158.9%
Simplified58.9%
if 2.2999999999999999e-204 < x < 3.5999999999999998e-143Initial program 66.6%
Taylor expanded in x around 0 66.6%
*-rgt-identity66.6%
associate-/l*66.6%
exp-to-pow66.6%
Simplified66.6%
if 3.5999999999999998e-143 < x < 0.880000000000000004Initial program 21.1%
Taylor expanded in n around inf 69.9%
log1p-define69.9%
Simplified69.9%
Taylor expanded in x around 0 69.1%
if 0.880000000000000004 < x < 1.60000000000000007e94Initial program 38.2%
Taylor expanded in n around inf 39.1%
log1p-define39.1%
Simplified39.1%
Taylor expanded in x around -inf 68.8%
Taylor expanded in x around -inf 68.8%
mul-1-neg68.8%
distribute-neg-frac268.8%
mul-1-neg68.8%
unsub-neg68.8%
mul-1-neg68.8%
unsub-neg68.8%
associate-*r/68.8%
metadata-eval68.8%
Simplified68.8%
if 1.60000000000000007e94 < x Initial program 81.7%
Taylor expanded in n around inf 81.7%
Simplified81.7%
associate-+r-81.7%
add-log-exp81.7%
exp-diff81.7%
add-exp-log8.7%
Applied egg-rr8.7%
+-commutative8.7%
exp-sum8.7%
*-commutative8.7%
exp-prod8.7%
unpow1/28.7%
log1p-define8.7%
rem-exp-log81.7%
Simplified81.7%
Taylor expanded in x around inf 81.7%
Final simplification70.8%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) 2e-12)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 2e+161)
(- 1.0 (pow x (/ 1.0 n)))
(/ (/ (+ (/ (+ 0.5 (/ -0.3333333333333333 x)) x) -1.0) (- x)) n))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 2e-12) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e+161) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((1.0d0 / n) <= 2d-12) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 2d+161) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = ((((0.5d0 + ((-0.3333333333333333d0) / x)) / x) + (-1.0d0)) / -x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 2e-12) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e+161) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= 2e-12: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 2e+161: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= 2e-12) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 2e+161) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(Float64(Float64(Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x) + -1.0) / Float64(-x)) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= 2e-12) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 2e+161) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-12], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+161], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + -1.0), $MachinePrecision] / (-x)), $MachinePrecision] / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+161}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{0.5 + \frac{-0.3333333333333333}{x}}{x} + -1}{-x}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < 1.99999999999999996e-12Initial program 49.7%
Taylor expanded in n around inf 73.8%
log1p-define73.8%
Simplified73.8%
log1p-undefine73.8%
diff-log73.9%
Applied egg-rr73.9%
if 1.99999999999999996e-12 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e161Initial program 79.9%
Taylor expanded in x around 0 76.2%
*-rgt-identity76.2%
associate-/l*76.2%
exp-to-pow76.2%
Simplified76.2%
if 2.0000000000000001e161 < (/.f64 #s(literal 1 binary64) n) Initial program 31.6%
Taylor expanded in n around inf 0.2%
Simplified0.2%
associate-+r-0.2%
add-log-exp0.2%
exp-diff0.2%
add-exp-log0.2%
Applied egg-rr0.2%
+-commutative0.2%
exp-sum0.2%
*-commutative0.2%
exp-prod0.2%
unpow1/20.2%
log1p-define0.2%
rem-exp-log0.2%
Simplified0.2%
Taylor expanded in n around inf 5.6%
+-commutative5.6%
Simplified5.6%
Taylor expanded in x around -inf 66.5%
mul-1-neg66.5%
distribute-neg-frac266.5%
sub-neg66.5%
associate-*r/66.5%
sub-neg66.5%
metadata-eval66.5%
distribute-lft-in66.5%
neg-mul-166.5%
associate-*r/66.5%
metadata-eval66.5%
distribute-neg-frac66.5%
metadata-eval66.5%
metadata-eval66.5%
metadata-eval66.5%
Simplified66.5%
Final simplification73.7%
(FPCore (x n)
:precision binary64
(if (<= x 0.89)
(/ (- x (log x)) n)
(if (<= x 1.6e+94)
(/ (/ (- 1.0 (/ (- 0.5 (/ (- 0.3333333333333333 (/ 0.25 x)) x)) x)) x) n)
(/ 0.0 n))))
double code(double x, double n) {
double tmp;
if (x <= 0.89) {
tmp = (x - log(x)) / n;
} else if (x <= 1.6e+94) {
tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.89d0) then
tmp = (x - log(x)) / n
else if (x <= 1.6d+94) then
tmp = ((1.0d0 - ((0.5d0 - ((0.3333333333333333d0 - (0.25d0 / x)) / x)) / x)) / x) / n
else
tmp = 0.0d0 / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.89) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 1.6e+94) {
tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.89: tmp = (x - math.log(x)) / n elif x <= 1.6e+94: tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.89) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 1.6e+94) tmp = Float64(Float64(Float64(1.0 - Float64(Float64(0.5 - Float64(Float64(0.3333333333333333 - Float64(0.25 / x)) / x)) / x)) / x) / n); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.89) tmp = (x - log(x)) / n; elseif (x <= 1.6e+94) tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.89], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 1.6e+94], N[(N[(N[(1.0 - N[(N[(0.5 - N[(N[(0.3333333333333333 - N[(0.25 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.89:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{+94}:\\
\;\;\;\;\frac{\frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \frac{0.25}{x}}{x}}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 0.890000000000000013Initial program 38.6%
Taylor expanded in n around inf 57.9%
log1p-define57.9%
Simplified57.9%
Taylor expanded in x around 0 57.5%
if 0.890000000000000013 < x < 1.60000000000000007e94Initial program 38.2%
Taylor expanded in n around inf 39.1%
log1p-define39.1%
Simplified39.1%
Taylor expanded in x around -inf 68.8%
Taylor expanded in x around -inf 68.8%
mul-1-neg68.8%
distribute-neg-frac268.8%
mul-1-neg68.8%
unsub-neg68.8%
mul-1-neg68.8%
unsub-neg68.8%
associate-*r/68.8%
metadata-eval68.8%
Simplified68.8%
if 1.60000000000000007e94 < x Initial program 81.7%
Taylor expanded in n around inf 81.7%
Simplified81.7%
associate-+r-81.7%
add-log-exp81.7%
exp-diff81.7%
add-exp-log8.7%
Applied egg-rr8.7%
+-commutative8.7%
exp-sum8.7%
*-commutative8.7%
exp-prod8.7%
unpow1/28.7%
log1p-define8.7%
rem-exp-log81.7%
Simplified81.7%
Taylor expanded in x around inf 81.7%
Final simplification66.4%
(FPCore (x n)
:precision binary64
(if (<= x 0.7)
(/ (log x) (- n))
(if (<= x 1.46e+94)
(/ (/ (- 1.0 (/ (- 0.5 (/ (- 0.3333333333333333 (/ 0.25 x)) x)) x)) x) n)
(/ 0.0 n))))
double code(double x, double n) {
double tmp;
if (x <= 0.7) {
tmp = log(x) / -n;
} else if (x <= 1.46e+94) {
tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.7d0) then
tmp = log(x) / -n
else if (x <= 1.46d+94) then
tmp = ((1.0d0 - ((0.5d0 - ((0.3333333333333333d0 - (0.25d0 / x)) / x)) / x)) / x) / n
else
tmp = 0.0d0 / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.7) {
tmp = Math.log(x) / -n;
} else if (x <= 1.46e+94) {
tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.7: tmp = math.log(x) / -n elif x <= 1.46e+94: tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.7) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 1.46e+94) tmp = Float64(Float64(Float64(1.0 - Float64(Float64(0.5 - Float64(Float64(0.3333333333333333 - Float64(0.25 / x)) / x)) / x)) / x) / n); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.7) tmp = log(x) / -n; elseif (x <= 1.46e+94) tmp = ((1.0 - ((0.5 - ((0.3333333333333333 - (0.25 / x)) / x)) / x)) / x) / n; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.7], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 1.46e+94], N[(N[(N[(1.0 - N[(N[(0.5 - N[(N[(0.3333333333333333 - N[(0.25 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.7:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 1.46 \cdot 10^{+94}:\\
\;\;\;\;\frac{\frac{1 - \frac{0.5 - \frac{0.3333333333333333 - \frac{0.25}{x}}{x}}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 0.69999999999999996Initial program 38.6%
Taylor expanded in n around inf 57.9%
log1p-define57.9%
Simplified57.9%
Taylor expanded in x around 0 56.7%
neg-mul-156.7%
Simplified56.7%
if 0.69999999999999996 < x < 1.46000000000000005e94Initial program 38.2%
Taylor expanded in n around inf 39.1%
log1p-define39.1%
Simplified39.1%
Taylor expanded in x around -inf 68.8%
Taylor expanded in x around -inf 68.8%
mul-1-neg68.8%
distribute-neg-frac268.8%
mul-1-neg68.8%
unsub-neg68.8%
mul-1-neg68.8%
unsub-neg68.8%
associate-*r/68.8%
metadata-eval68.8%
Simplified68.8%
if 1.46000000000000005e94 < x Initial program 81.7%
Taylor expanded in n around inf 81.7%
Simplified81.7%
associate-+r-81.7%
add-log-exp81.7%
exp-diff81.7%
add-exp-log8.7%
Applied egg-rr8.7%
+-commutative8.7%
exp-sum8.7%
*-commutative8.7%
exp-prod8.7%
unpow1/28.7%
log1p-define8.7%
rem-exp-log81.7%
Simplified81.7%
Taylor expanded in x around inf 81.7%
Final simplification66.0%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -1e+62) (/ 0.0 n) (/ (- (/ 1.0 n) (/ (- (/ 0.5 n) (/ 0.3333333333333333 (* n x))) x)) x)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1e+62) {
tmp = 0.0 / n;
} else {
tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / 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+62)) then
tmp = 0.0d0 / n
else
tmp = ((1.0d0 / n) - (((0.5d0 / n) - (0.3333333333333333d0 / (n * x))) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1e+62) {
tmp = 0.0 / n;
} else {
tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / x)) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1e+62: tmp = 0.0 / n else: tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / x)) / x return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1e+62) tmp = Float64(0.0 / n); else tmp = Float64(Float64(Float64(1.0 / n) - Float64(Float64(Float64(0.5 / n) - Float64(0.3333333333333333 / Float64(n * x))) / x)) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -1e+62) tmp = 0.0 / n; else tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+62], N[(0.0 / n), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] - N[(N[(N[(0.5 / n), $MachinePrecision] - N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+62}:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} - \frac{\frac{0.5}{n} - \frac{0.3333333333333333}{n \cdot x}}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.00000000000000004e62Initial program 100.0%
Taylor expanded in n around inf 82.9%
Simplified82.9%
associate-+r-82.9%
add-log-exp95.0%
exp-diff95.0%
add-exp-log37.3%
Applied egg-rr37.3%
+-commutative37.3%
exp-sum37.3%
*-commutative37.3%
exp-prod37.3%
unpow1/237.3%
log1p-define37.3%
rem-exp-log95.0%
Simplified95.0%
Taylor expanded in x around inf 64.7%
if -1.00000000000000004e62 < (/.f64 #s(literal 1 binary64) n) Initial program 43.0%
Taylor expanded in n around inf 62.8%
log1p-define62.8%
Simplified62.8%
Taylor expanded in x around -inf 46.1%
mul-1-neg46.1%
mul-1-neg46.1%
associate-*r/46.1%
metadata-eval46.1%
*-commutative46.1%
associate-*r/46.1%
metadata-eval46.1%
Simplified46.1%
Final simplification48.9%
(FPCore (x n) :precision binary64 (/ (- (/ 1.0 n) (/ (- (/ 0.5 n) (/ 0.3333333333333333 (* n x))) x)) x))
double code(double x, double n) {
return ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / x)) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((1.0d0 / n) - (((0.5d0 / n) - (0.3333333333333333d0 / (n * x))) / x)) / x
end function
public static double code(double x, double n) {
return ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / x)) / x;
}
def code(x, n): return ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / x)) / x
function code(x, n) return Float64(Float64(Float64(1.0 / n) - Float64(Float64(Float64(0.5 / n) - Float64(0.3333333333333333 / Float64(n * x))) / x)) / x) end
function tmp = code(x, n) tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (n * x))) / x)) / x; end
code[x_, n_] := N[(N[(N[(1.0 / n), $MachinePrecision] - N[(N[(N[(0.5 / n), $MachinePrecision] - N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n} - \frac{\frac{0.5}{n} - \frac{0.3333333333333333}{n \cdot x}}{x}}{x}
\end{array}
Initial program 51.6%
Taylor expanded in n around inf 62.5%
log1p-define62.5%
Simplified62.5%
Taylor expanded in x around -inf 44.8%
mul-1-neg44.8%
mul-1-neg44.8%
associate-*r/44.8%
metadata-eval44.8%
*-commutative44.8%
associate-*r/44.8%
metadata-eval44.8%
Simplified44.8%
Final simplification44.8%
(FPCore (x n) :precision binary64 (/ (/ (+ (/ (+ 0.5 (/ -0.3333333333333333 x)) x) -1.0) (- x)) n))
double code(double x, double n) {
return ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((((0.5d0 + ((-0.3333333333333333d0) / x)) / x) + (-1.0d0)) / -x) / n
end function
public static double code(double x, double n) {
return ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n;
}
def code(x, n): return ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n
function code(x, n) return Float64(Float64(Float64(Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x) + -1.0) / Float64(-x)) / n) end
function tmp = code(x, n) tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n; end
code[x_, n_] := N[(N[(N[(N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + -1.0), $MachinePrecision] / (-x)), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\frac{0.5 + \frac{-0.3333333333333333}{x}}{x} + -1}{-x}}{n}
\end{array}
Initial program 51.6%
Taylor expanded in n around inf 65.7%
Simplified65.7%
associate-+r-65.7%
add-log-exp70.5%
exp-diff70.5%
add-exp-log44.8%
Applied egg-rr44.8%
+-commutative44.8%
exp-sum44.8%
*-commutative44.8%
exp-prod44.8%
unpow1/244.8%
log1p-define44.8%
rem-exp-log70.7%
Simplified70.7%
Taylor expanded in n around inf 62.7%
+-commutative62.7%
Simplified62.7%
Taylor expanded in x around -inf 44.8%
mul-1-neg44.8%
distribute-neg-frac244.8%
sub-neg44.8%
associate-*r/44.8%
sub-neg44.8%
metadata-eval44.8%
distribute-lft-in44.8%
neg-mul-144.8%
associate-*r/44.8%
metadata-eval44.8%
distribute-neg-frac44.8%
metadata-eval44.8%
metadata-eval44.8%
metadata-eval44.8%
Simplified44.8%
Final simplification44.8%
(FPCore (x n) :precision binary64 (* (/ 1.0 n) (/ 1.0 x)))
double code(double x, double n) {
return (1.0 / n) * (1.0 / x);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / n) * (1.0d0 / x)
end function
public static double code(double x, double n) {
return (1.0 / n) * (1.0 / x);
}
def code(x, n): return (1.0 / n) * (1.0 / x)
function code(x, n) return Float64(Float64(1.0 / n) * Float64(1.0 / x)) end
function tmp = code(x, n) tmp = (1.0 / n) * (1.0 / x); end
code[x_, n_] := N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{n} \cdot \frac{1}{x}
\end{array}
Initial program 51.6%
Taylor expanded in n around inf 62.5%
log1p-define62.5%
Simplified62.5%
Taylor expanded in x around inf 38.9%
*-commutative38.9%
Simplified38.9%
associate-/r*39.6%
div-inv39.6%
Applied egg-rr39.6%
Final simplification39.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(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 51.6%
Taylor expanded in n around inf 65.7%
Simplified65.7%
associate-+r-65.7%
add-log-exp70.5%
exp-diff70.5%
add-exp-log44.8%
Applied egg-rr44.8%
+-commutative44.8%
exp-sum44.8%
*-commutative44.8%
exp-prod44.8%
unpow1/244.8%
log1p-define44.8%
rem-exp-log70.7%
Simplified70.7%
Taylor expanded in n around inf 62.7%
+-commutative62.7%
Simplified62.7%
Taylor expanded in x around inf 38.9%
associate-/r*39.6%
Simplified39.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 51.6%
Taylor expanded in n around inf 62.5%
log1p-define62.5%
Simplified62.5%
Taylor expanded in x around inf 38.9%
*-commutative38.9%
Simplified38.9%
Final simplification38.9%
(FPCore (x n) :precision binary64 (/ x n))
double code(double x, double n) {
return x / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = x / n
end function
public static double code(double x, double n) {
return x / n;
}
def code(x, n): return x / n
function code(x, n) return Float64(x / n) end
function tmp = code(x, n) tmp = x / n; end
code[x_, n_] := N[(x / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{n}
\end{array}
Initial program 51.6%
Taylor expanded in n around inf 62.5%
log1p-define62.5%
Simplified62.5%
Taylor expanded in x around 0 33.7%
Taylor expanded in x around inf 4.9%
herbie shell --seed 2024146
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))