
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log (/ x (+ 1.0 x)))) n)))
(if (<= (/ 1.0 n) -2e-11)
(/ (exp (/ (log x) n)) (* n x))
(if (<= (/ 1.0 n) -4e-64)
t_0
(if (<= (/ 1.0 n) -2e-116)
(/ 1.0 (* n (+ x 0.5)))
(if (<= (/ 1.0 n) 2e-20)
t_0
(- (exp (/ (log1p x) n)) (pow x (/ 1.0 n)))))))))
double code(double x, double n) {
double t_0 = -log((x / (1.0 + x))) / n;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = exp((log(x) / n)) / (n * x);
} else if ((1.0 / n) <= -4e-64) {
tmp = t_0;
} else if ((1.0 / n) <= -2e-116) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 2e-20) {
tmp = t_0;
} else {
tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = -Math.log((x / (1.0 + x))) / n;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = Math.exp((Math.log(x) / n)) / (n * x);
} else if ((1.0 / n) <= -4e-64) {
tmp = t_0;
} else if ((1.0 / n) <= -2e-116) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 2e-20) {
tmp = t_0;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): t_0 = -math.log((x / (1.0 + x))) / n tmp = 0 if (1.0 / n) <= -2e-11: tmp = math.exp((math.log(x) / n)) / (n * x) elif (1.0 / n) <= -4e-64: tmp = t_0 elif (1.0 / n) <= -2e-116: tmp = 1.0 / (n * (x + 0.5)) elif (1.0 / n) <= 2e-20: tmp = t_0 else: tmp = math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) t_0 = Float64(Float64(-log(Float64(x / Float64(1.0 + x)))) / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = Float64(exp(Float64(log(x) / n)) / Float64(n * x)); elseif (Float64(1.0 / n) <= -4e-64) tmp = t_0; elseif (Float64(1.0 / n) <= -2e-116) tmp = Float64(1.0 / Float64(n * Float64(x + 0.5))); elseif (Float64(1.0 / n) <= 2e-20) tmp = t_0; else tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-64], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-116], N[(1.0 / N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-20], t$95$0, N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log \left(\frac{x}{1 + x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq -4 \cdot 10^{-64}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-116}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-20}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (- (log (/ x (+ 1.0 x)))) n)))
(if (<= (/ 1.0 n) -2e-11)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) -4e-64)
t_1
(if (<= (/ 1.0 n) -2e-116)
(/ 1.0 (* n (+ x 0.5)))
(if (<= (/ 1.0 n) 5e-11)
t_1
(if (<= (/ 1.0 n) 2e+174)
(- (+ 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 t_1 = -log((x / (1.0 + x))) / n;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= -4e-64) {
tmp = t_1;
} else if ((1.0 / n) <= -2e-116) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-11) {
tmp = t_1;
} else if ((1.0 / n) <= 2e+174) {
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) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = -log((x / (1.0d0 + x))) / n
if ((1.0d0 / n) <= (-2d-11)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= (-4d-64)) then
tmp = t_1
else if ((1.0d0 / n) <= (-2d-116)) then
tmp = 1.0d0 / (n * (x + 0.5d0))
else if ((1.0d0 / n) <= 5d-11) then
tmp = t_1
else if ((1.0d0 / n) <= 2d+174) 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 t_1 = -Math.log((x / (1.0 + x))) / n;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= -4e-64) {
tmp = t_1;
} else if ((1.0 / n) <= -2e-116) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-11) {
tmp = t_1;
} else if ((1.0 / n) <= 2e+174) {
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)) t_1 = -math.log((x / (1.0 + x))) / n tmp = 0 if (1.0 / n) <= -2e-11: tmp = t_0 / (n * x) elif (1.0 / n) <= -4e-64: tmp = t_1 elif (1.0 / n) <= -2e-116: tmp = 1.0 / (n * (x + 0.5)) elif (1.0 / n) <= 5e-11: tmp = t_1 elif (1.0 / n) <= 2e+174: 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) t_1 = Float64(Float64(-log(Float64(x / Float64(1.0 + x)))) / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= -4e-64) tmp = t_1; elseif (Float64(1.0 / n) <= -2e-116) tmp = Float64(1.0 / Float64(n * Float64(x + 0.5))); elseif (Float64(1.0 / n) <= 5e-11) tmp = t_1; elseif (Float64(1.0 / n) <= 2e+174) 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); t_1 = -log((x / (1.0 + x))) / n; tmp = 0.0; if ((1.0 / n) <= -2e-11) tmp = t_0 / (n * x); elseif ((1.0 / n) <= -4e-64) tmp = t_1; elseif ((1.0 / n) <= -2e-116) tmp = 1.0 / (n * (x + 0.5)); elseif ((1.0 / n) <= 5e-11) tmp = t_1; elseif ((1.0 / n) <= 2e+174) 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]}, Block[{t$95$1 = N[((-N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-64], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-116], N[(1.0 / N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-11], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+174], 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)}\\
t_1 := \frac{-\log \left(\frac{x}{1 + x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq -4 \cdot 10^{-64}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-116}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-11}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+174}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{\left(n \cdot x\right)}^{-2}}\\
\end{array}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log (/ x (+ 1.0 x)))) n)))
(if (<= (/ 1.0 n) -2e-11)
(/ (exp (/ (log x) n)) (* n x))
(if (<= (/ 1.0 n) -4e-64)
t_0
(if (<= (/ 1.0 n) -2e-116)
(/ 1.0 (* n (+ x 0.5)))
(if (<= (/ 1.0 n) 5e-11)
t_0
(if (<= (/ 1.0 n) 2e+174)
(- (+ 1.0 (/ x n)) (pow x (/ 1.0 n)))
(sqrt (pow (* n x) -2.0)))))))))
double code(double x, double n) {
double t_0 = -log((x / (1.0 + x))) / n;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = exp((log(x) / n)) / (n * x);
} else if ((1.0 / n) <= -4e-64) {
tmp = t_0;
} else if ((1.0 / n) <= -2e-116) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-11) {
tmp = t_0;
} else if ((1.0 / n) <= 2e+174) {
tmp = (1.0 + (x / n)) - pow(x, (1.0 / n));
} 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 = -log((x / (1.0d0 + x))) / n
if ((1.0d0 / n) <= (-2d-11)) then
tmp = exp((log(x) / n)) / (n * x)
else if ((1.0d0 / n) <= (-4d-64)) then
tmp = t_0
else if ((1.0d0 / n) <= (-2d-116)) then
tmp = 1.0d0 / (n * (x + 0.5d0))
else if ((1.0d0 / n) <= 5d-11) then
tmp = t_0
else if ((1.0d0 / n) <= 2d+174) then
tmp = (1.0d0 + (x / n)) - (x ** (1.0d0 / n))
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.log((x / (1.0 + x))) / n;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = Math.exp((Math.log(x) / n)) / (n * x);
} else if ((1.0 / n) <= -4e-64) {
tmp = t_0;
} else if ((1.0 / n) <= -2e-116) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-11) {
tmp = t_0;
} else if ((1.0 / n) <= 2e+174) {
tmp = (1.0 + (x / n)) - Math.pow(x, (1.0 / n));
} else {
tmp = Math.sqrt(Math.pow((n * x), -2.0));
}
return tmp;
}
def code(x, n): t_0 = -math.log((x / (1.0 + x))) / n tmp = 0 if (1.0 / n) <= -2e-11: tmp = math.exp((math.log(x) / n)) / (n * x) elif (1.0 / n) <= -4e-64: tmp = t_0 elif (1.0 / n) <= -2e-116: tmp = 1.0 / (n * (x + 0.5)) elif (1.0 / n) <= 5e-11: tmp = t_0 elif (1.0 / n) <= 2e+174: tmp = (1.0 + (x / n)) - math.pow(x, (1.0 / n)) else: tmp = math.sqrt(math.pow((n * x), -2.0)) return tmp
function code(x, n) t_0 = Float64(Float64(-log(Float64(x / Float64(1.0 + x)))) / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = Float64(exp(Float64(log(x) / n)) / Float64(n * x)); elseif (Float64(1.0 / n) <= -4e-64) tmp = t_0; elseif (Float64(1.0 / n) <= -2e-116) tmp = Float64(1.0 / Float64(n * Float64(x + 0.5))); elseif (Float64(1.0 / n) <= 5e-11) tmp = t_0; elseif (Float64(1.0 / n) <= 2e+174) tmp = Float64(Float64(1.0 + Float64(x / n)) - (x ^ Float64(1.0 / n))); else tmp = sqrt((Float64(n * x) ^ -2.0)); end return tmp end
function tmp_2 = code(x, n) t_0 = -log((x / (1.0 + x))) / n; tmp = 0.0; if ((1.0 / n) <= -2e-11) tmp = exp((log(x) / n)) / (n * x); elseif ((1.0 / n) <= -4e-64) tmp = t_0; elseif ((1.0 / n) <= -2e-116) tmp = 1.0 / (n * (x + 0.5)); elseif ((1.0 / n) <= 5e-11) tmp = t_0; elseif ((1.0 / n) <= 2e+174) tmp = (1.0 + (x / n)) - (x ^ (1.0 / n)); else tmp = sqrt(((n * x) ^ -2.0)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-64], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-116], N[(1.0 / N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-11], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+174], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[Power[N[(n * x), $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log \left(\frac{x}{1 + x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq -4 \cdot 10^{-64}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-116}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-11}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+174}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{\left(n \cdot x\right)}^{-2}}\\
\end{array}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log (/ x (+ 1.0 x)))) n)))
(if (<= (/ 1.0 n) -2e-11)
(/ (exp (/ (log x) n)) (* n x))
(if (<= (/ 1.0 n) -4e-64)
t_0
(if (<= (/ 1.0 n) -2e-116)
(/ 1.0 (* n (+ x 0.5)))
(if (<= (/ 1.0 n) 5e-11) t_0 (- (exp (/ x n)) (pow x (/ 1.0 n)))))))))
double code(double x, double n) {
double t_0 = -log((x / (1.0 + x))) / n;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = exp((log(x) / n)) / (n * x);
} else if ((1.0 / n) <= -4e-64) {
tmp = t_0;
} else if ((1.0 / n) <= -2e-116) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-11) {
tmp = t_0;
} else {
tmp = exp((x / n)) - pow(x, (1.0 / n));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = -log((x / (1.0d0 + x))) / n
if ((1.0d0 / n) <= (-2d-11)) then
tmp = exp((log(x) / n)) / (n * x)
else if ((1.0d0 / n) <= (-4d-64)) then
tmp = t_0
else if ((1.0d0 / n) <= (-2d-116)) then
tmp = 1.0d0 / (n * (x + 0.5d0))
else if ((1.0d0 / n) <= 5d-11) then
tmp = t_0
else
tmp = exp((x / n)) - (x ** (1.0d0 / n))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = -Math.log((x / (1.0 + x))) / n;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = Math.exp((Math.log(x) / n)) / (n * x);
} else if ((1.0 / n) <= -4e-64) {
tmp = t_0;
} else if ((1.0 / n) <= -2e-116) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-11) {
tmp = t_0;
} else {
tmp = Math.exp((x / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): t_0 = -math.log((x / (1.0 + x))) / n tmp = 0 if (1.0 / n) <= -2e-11: tmp = math.exp((math.log(x) / n)) / (n * x) elif (1.0 / n) <= -4e-64: tmp = t_0 elif (1.0 / n) <= -2e-116: tmp = 1.0 / (n * (x + 0.5)) elif (1.0 / n) <= 5e-11: tmp = t_0 else: tmp = math.exp((x / n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) t_0 = Float64(Float64(-log(Float64(x / Float64(1.0 + x)))) / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = Float64(exp(Float64(log(x) / n)) / Float64(n * x)); elseif (Float64(1.0 / n) <= -4e-64) tmp = t_0; elseif (Float64(1.0 / n) <= -2e-116) tmp = Float64(1.0 / Float64(n * Float64(x + 0.5))); elseif (Float64(1.0 / n) <= 5e-11) tmp = t_0; else tmp = Float64(exp(Float64(x / n)) - (x ^ Float64(1.0 / n))); end return tmp end
function tmp_2 = code(x, n) t_0 = -log((x / (1.0 + x))) / n; tmp = 0.0; if ((1.0 / n) <= -2e-11) tmp = exp((log(x) / n)) / (n * x); elseif ((1.0 / n) <= -4e-64) tmp = t_0; elseif ((1.0 / n) <= -2e-116) tmp = 1.0 / (n * (x + 0.5)); elseif ((1.0 / n) <= 5e-11) tmp = t_0; else tmp = exp((x / n)) - (x ^ (1.0 / n)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-64], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-116], N[(1.0 / N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-11], t$95$0, N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log \left(\frac{x}{1 + x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq -4 \cdot 10^{-64}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-116}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-11}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (- (log (/ x (+ 1.0 x)))) n)))
(if (<= (/ 1.0 n) -2e-11)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) -4e-64)
t_1
(if (<= (/ 1.0 n) -2e-116)
(/ 1.0 (* n (+ x 0.5)))
(if (<= (/ 1.0 n) 5e-11)
t_1
(if (<= (/ 1.0 n) 1e+265)
(- (+ 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 t_1 = -log((x / (1.0 + x))) / n;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= -4e-64) {
tmp = t_1;
} else if ((1.0 / n) <= -2e-116) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-11) {
tmp = t_1;
} else if ((1.0 / n) <= 1e+265) {
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) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = -log((x / (1.0d0 + x))) / n
if ((1.0d0 / n) <= (-2d-11)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= (-4d-64)) then
tmp = t_1
else if ((1.0d0 / n) <= (-2d-116)) then
tmp = 1.0d0 / (n * (x + 0.5d0))
else if ((1.0d0 / n) <= 5d-11) then
tmp = t_1
else if ((1.0d0 / n) <= 1d+265) 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 t_1 = -Math.log((x / (1.0 + x))) / n;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= -4e-64) {
tmp = t_1;
} else if ((1.0 / n) <= -2e-116) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-11) {
tmp = t_1;
} else if ((1.0 / n) <= 1e+265) {
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)) t_1 = -math.log((x / (1.0 + x))) / n tmp = 0 if (1.0 / n) <= -2e-11: tmp = t_0 / (n * x) elif (1.0 / n) <= -4e-64: tmp = t_1 elif (1.0 / n) <= -2e-116: tmp = 1.0 / (n * (x + 0.5)) elif (1.0 / n) <= 5e-11: tmp = t_1 elif (1.0 / n) <= 1e+265: 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) t_1 = Float64(Float64(-log(Float64(x / Float64(1.0 + x)))) / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= -4e-64) tmp = t_1; elseif (Float64(1.0 / n) <= -2e-116) tmp = Float64(1.0 / Float64(n * Float64(x + 0.5))); elseif (Float64(1.0 / n) <= 5e-11) tmp = t_1; elseif (Float64(1.0 / n) <= 1e+265) 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); t_1 = -log((x / (1.0 + x))) / n; tmp = 0.0; if ((1.0 / n) <= -2e-11) tmp = t_0 / (n * x); elseif ((1.0 / n) <= -4e-64) tmp = t_1; elseif ((1.0 / n) <= -2e-116) tmp = 1.0 / (n * (x + 0.5)); elseif ((1.0 / n) <= 5e-11) tmp = t_1; elseif ((1.0 / n) <= 1e+265) 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]}, Block[{t$95$1 = N[((-N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-64], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-116], N[(1.0 / N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-11], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+265], 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)}\\
t_1 := \frac{-\log \left(\frac{x}{1 + x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq -4 \cdot 10^{-64}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-116}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-11}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+265}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ x (+ 1.0 x)))
(t_1 (pow x (/ 1.0 n)))
(t_2 (/ (- (log t_0)) n)))
(if (<= (/ 1.0 n) -2e-11)
(/ t_1 (* n x))
(if (<= (/ 1.0 n) -4e-64)
t_2
(if (<= (/ 1.0 n) -2e-116)
(/ 1.0 (* n (+ x 0.5)))
(if (<= (/ 1.0 n) 5e-11)
t_2
(if (<= (/ 1.0 n) 2e+174)
(- (+ 1.0 (/ x n)) t_1)
(/ (- (log1p (+ t_0 -1.0))) n))))))))
double code(double x, double n) {
double t_0 = x / (1.0 + x);
double t_1 = pow(x, (1.0 / n));
double t_2 = -log(t_0) / n;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= -4e-64) {
tmp = t_2;
} else if ((1.0 / n) <= -2e-116) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-11) {
tmp = t_2;
} else if ((1.0 / n) <= 2e+174) {
tmp = (1.0 + (x / n)) - t_1;
} else {
tmp = -log1p((t_0 + -1.0)) / n;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = x / (1.0 + x);
double t_1 = Math.pow(x, (1.0 / n));
double t_2 = -Math.log(t_0) / n;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= -4e-64) {
tmp = t_2;
} else if ((1.0 / n) <= -2e-116) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-11) {
tmp = t_2;
} else if ((1.0 / n) <= 2e+174) {
tmp = (1.0 + (x / n)) - t_1;
} else {
tmp = -Math.log1p((t_0 + -1.0)) / n;
}
return tmp;
}
def code(x, n): t_0 = x / (1.0 + x) t_1 = math.pow(x, (1.0 / n)) t_2 = -math.log(t_0) / n tmp = 0 if (1.0 / n) <= -2e-11: tmp = t_1 / (n * x) elif (1.0 / n) <= -4e-64: tmp = t_2 elif (1.0 / n) <= -2e-116: tmp = 1.0 / (n * (x + 0.5)) elif (1.0 / n) <= 5e-11: tmp = t_2 elif (1.0 / n) <= 2e+174: tmp = (1.0 + (x / n)) - t_1 else: tmp = -math.log1p((t_0 + -1.0)) / n return tmp
function code(x, n) t_0 = Float64(x / Float64(1.0 + x)) t_1 = x ^ Float64(1.0 / n) t_2 = Float64(Float64(-log(t_0)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = Float64(t_1 / Float64(n * x)); elseif (Float64(1.0 / n) <= -4e-64) tmp = t_2; elseif (Float64(1.0 / n) <= -2e-116) tmp = Float64(1.0 / Float64(n * Float64(x + 0.5))); elseif (Float64(1.0 / n) <= 5e-11) tmp = t_2; elseif (Float64(1.0 / n) <= 2e+174) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_1); else tmp = Float64(Float64(-log1p(Float64(t_0 + -1.0))) / n); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[((-N[Log[t$95$0], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-64], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-116], N[(1.0 / N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-11], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+174], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], N[((-N[Log[1 + N[(t$95$0 + -1.0), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{1 + x}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
t_2 := \frac{-\log t_0}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq -4 \cdot 10^{-64}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-116}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-11}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+174}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{-\mathsf{log1p}\left(t_0 + -1\right)}{n}\\
\end{array}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log (/ x (+ 1.0 x)))) n)))
(if (<= (/ 1.0 n) -2e-11)
(/ (pow x (+ (/ 1.0 n) -1.0)) n)
(if (<= (/ 1.0 n) -4e-64)
t_0
(if (<= (/ 1.0 n) -2e-116)
(/ 1.0 (* n (+ x 0.5)))
(if (<= (/ 1.0 n) 5e-11)
t_0
(if (<= (/ 1.0 n) 2e+193)
(- 1.0 (pow x (/ 1.0 n)))
(/ 1.0 (* n x)))))))))
double code(double x, double n) {
double t_0 = -log((x / (1.0 + x))) / n;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= -4e-64) {
tmp = t_0;
} else if ((1.0 / n) <= -2e-116) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-11) {
tmp = t_0;
} else if ((1.0 / n) <= 2e+193) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = -log((x / (1.0d0 + x))) / n
if ((1.0d0 / n) <= (-2d-11)) then
tmp = (x ** ((1.0d0 / n) + (-1.0d0))) / n
else if ((1.0d0 / n) <= (-4d-64)) then
tmp = t_0
else if ((1.0d0 / n) <= (-2d-116)) then
tmp = 1.0d0 / (n * (x + 0.5d0))
else if ((1.0d0 / n) <= 5d-11) then
tmp = t_0
else if ((1.0d0 / n) <= 2d+193) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = -Math.log((x / (1.0 + x))) / n;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= -4e-64) {
tmp = t_0;
} else if ((1.0 / n) <= -2e-116) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-11) {
tmp = t_0;
} else if ((1.0 / n) <= 2e+193) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = -math.log((x / (1.0 + x))) / n tmp = 0 if (1.0 / n) <= -2e-11: tmp = math.pow(x, ((1.0 / n) + -1.0)) / n elif (1.0 / n) <= -4e-64: tmp = t_0 elif (1.0 / n) <= -2e-116: tmp = 1.0 / (n * (x + 0.5)) elif (1.0 / n) <= 5e-11: tmp = t_0 elif (1.0 / n) <= 2e+193: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = Float64(Float64(-log(Float64(x / Float64(1.0 + x)))) / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n); elseif (Float64(1.0 / n) <= -4e-64) tmp = t_0; elseif (Float64(1.0 / n) <= -2e-116) tmp = Float64(1.0 / Float64(n * Float64(x + 0.5))); elseif (Float64(1.0 / n) <= 5e-11) tmp = t_0; elseif (Float64(1.0 / n) <= 2e+193) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = -log((x / (1.0 + x))) / n; tmp = 0.0; if ((1.0 / n) <= -2e-11) tmp = (x ^ ((1.0 / n) + -1.0)) / n; elseif ((1.0 / n) <= -4e-64) tmp = t_0; elseif ((1.0 / n) <= -2e-116) tmp = 1.0 / (n * (x + 0.5)); elseif ((1.0 / n) <= 5e-11) tmp = t_0; elseif ((1.0 / n) <= 2e+193) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-64], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-116], N[(1.0 / N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-11], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+193], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log \left(\frac{x}{1 + x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -4 \cdot 10^{-64}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-116}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-11}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+193}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (- (log (/ x (+ 1.0 x)))) n)))
(if (<= (/ 1.0 n) -2e-11)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) -4e-64)
t_1
(if (<= (/ 1.0 n) -2e-116)
(/ 1.0 (* n (+ x 0.5)))
(if (<= (/ 1.0 n) 5e-11)
t_1
(if (<= (/ 1.0 n) 2e+193) (- 1.0 t_0) (/ 1.0 (* n x)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = -log((x / (1.0 + x))) / n;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= -4e-64) {
tmp = t_1;
} else if ((1.0 / n) <= -2e-116) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-11) {
tmp = t_1;
} else if ((1.0 / n) <= 2e+193) {
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) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = -log((x / (1.0d0 + x))) / n
if ((1.0d0 / n) <= (-2d-11)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= (-4d-64)) then
tmp = t_1
else if ((1.0d0 / n) <= (-2d-116)) then
tmp = 1.0d0 / (n * (x + 0.5d0))
else if ((1.0d0 / n) <= 5d-11) then
tmp = t_1
else if ((1.0d0 / n) <= 2d+193) 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 t_1 = -Math.log((x / (1.0 + x))) / n;
double tmp;
if ((1.0 / n) <= -2e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= -4e-64) {
tmp = t_1;
} else if ((1.0 / n) <= -2e-116) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-11) {
tmp = t_1;
} else if ((1.0 / n) <= 2e+193) {
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)) t_1 = -math.log((x / (1.0 + x))) / n tmp = 0 if (1.0 / n) <= -2e-11: tmp = t_0 / (n * x) elif (1.0 / n) <= -4e-64: tmp = t_1 elif (1.0 / n) <= -2e-116: tmp = 1.0 / (n * (x + 0.5)) elif (1.0 / n) <= 5e-11: tmp = t_1 elif (1.0 / n) <= 2e+193: tmp = 1.0 - t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(-log(Float64(x / Float64(1.0 + x)))) / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-11) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= -4e-64) tmp = t_1; elseif (Float64(1.0 / n) <= -2e-116) tmp = Float64(1.0 / Float64(n * Float64(x + 0.5))); elseif (Float64(1.0 / n) <= 5e-11) tmp = t_1; elseif (Float64(1.0 / n) <= 2e+193) 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); t_1 = -log((x / (1.0 + x))) / n; tmp = 0.0; if ((1.0 / n) <= -2e-11) tmp = t_0 / (n * x); elseif ((1.0 / n) <= -4e-64) tmp = t_1; elseif ((1.0 / n) <= -2e-116) tmp = 1.0 / (n * (x + 0.5)); elseif ((1.0 / n) <= 5e-11) tmp = t_1; elseif ((1.0 / n) <= 2e+193) 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]}, Block[{t$95$1 = N[((-N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-11], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-64], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-116], N[(1.0 / N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-11], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+193], 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)}\\
t_1 := \frac{-\log \left(\frac{x}{1 + x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-11}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq -4 \cdot 10^{-64}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-116}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-11}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+193}:\\
\;\;\;\;1 - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
(FPCore (x n)
:precision binary64
(if (<= x 7.6e-280)
(/ (- (log x)) n)
(if (<= x 4.2e-176)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 120000000.0)
(/ (- (log (/ x (+ 1.0 x)))) n)
(if (<= x 1.55e+65) (* (/ 1.0 n) (/ 1.0 x)) (/ 0.0 n))))))
double code(double x, double n) {
double tmp;
if (x <= 7.6e-280) {
tmp = -log(x) / n;
} else if (x <= 4.2e-176) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 120000000.0) {
tmp = -log((x / (1.0 + x))) / n;
} else if (x <= 1.55e+65) {
tmp = (1.0 / n) * (1.0 / x);
} else {
tmp = 0.0 / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 7.6d-280) then
tmp = -log(x) / n
else if (x <= 4.2d-176) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 120000000.0d0) then
tmp = -log((x / (1.0d0 + x))) / n
else if (x <= 1.55d+65) then
tmp = (1.0d0 / n) * (1.0d0 / x)
else
tmp = 0.0d0 / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 7.6e-280) {
tmp = -Math.log(x) / n;
} else if (x <= 4.2e-176) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 120000000.0) {
tmp = -Math.log((x / (1.0 + x))) / n;
} else if (x <= 1.55e+65) {
tmp = (1.0 / n) * (1.0 / x);
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 7.6e-280: tmp = -math.log(x) / n elif x <= 4.2e-176: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 120000000.0: tmp = -math.log((x / (1.0 + x))) / n elif x <= 1.55e+65: tmp = (1.0 / n) * (1.0 / x) else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 7.6e-280) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 4.2e-176) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 120000000.0) tmp = Float64(Float64(-log(Float64(x / Float64(1.0 + x)))) / n); elseif (x <= 1.55e+65) tmp = Float64(Float64(1.0 / n) * Float64(1.0 / x)); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 7.6e-280) tmp = -log(x) / n; elseif (x <= 4.2e-176) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 120000000.0) tmp = -log((x / (1.0 + x))) / n; elseif (x <= 1.55e+65) tmp = (1.0 / n) * (1.0 / x); else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 7.6e-280], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 4.2e-176], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 120000000.0], N[((-N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 1.55e+65], N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.6 \cdot 10^{-280}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-176}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 120000000:\\
\;\;\;\;\frac{-\log \left(\frac{x}{1 + x}\right)}{n}\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{+65}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
(FPCore (x n)
:precision binary64
(if (<= x 8.5e-280)
(/ (- (log x)) n)
(if (<= x 1.05e-175)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.5)
(/ 1.0 (/ n (- x (log x))))
(if (<= x 5.8e+64)
(/ 1.0 (- (* n (+ x 0.5)) (/ (* n 0.08333333333333333) x)))
(/ 0.0 n))))))
double code(double x, double n) {
double tmp;
if (x <= 8.5e-280) {
tmp = -log(x) / n;
} else if (x <= 1.05e-175) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.5) {
tmp = 1.0 / (n / (x - log(x)));
} else if (x <= 5.8e+64) {
tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x));
} else {
tmp = 0.0 / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 8.5d-280) then
tmp = -log(x) / n
else if (x <= 1.05d-175) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.5d0) then
tmp = 1.0d0 / (n / (x - log(x)))
else if (x <= 5.8d+64) then
tmp = 1.0d0 / ((n * (x + 0.5d0)) - ((n * 0.08333333333333333d0) / x))
else
tmp = 0.0d0 / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 8.5e-280) {
tmp = -Math.log(x) / n;
} else if (x <= 1.05e-175) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.5) {
tmp = 1.0 / (n / (x - Math.log(x)));
} else if (x <= 5.8e+64) {
tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x));
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 8.5e-280: tmp = -math.log(x) / n elif x <= 1.05e-175: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.5: tmp = 1.0 / (n / (x - math.log(x))) elif x <= 5.8e+64: tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x)) else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 8.5e-280) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 1.05e-175) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.5) tmp = Float64(1.0 / Float64(n / Float64(x - log(x)))); elseif (x <= 5.8e+64) tmp = Float64(1.0 / Float64(Float64(n * Float64(x + 0.5)) - Float64(Float64(n * 0.08333333333333333) / x))); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 8.5e-280) tmp = -log(x) / n; elseif (x <= 1.05e-175) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.5) tmp = 1.0 / (n / (x - log(x))); elseif (x <= 5.8e+64) tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x)); else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 8.5e-280], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 1.05e-175], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.5], N[(1.0 / N[(n / N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.8e+64], N[(1.0 / N[(N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[(n * 0.08333333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.5 \cdot 10^{-280}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{-175}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.5:\\
\;\;\;\;\frac{1}{\frac{n}{x - \log x}}\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{+64}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right) - \frac{n \cdot 0.08333333333333333}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
(FPCore (x n)
:precision binary64
(if (<= x 1.75e-276)
(/ (- (log x)) n)
(if (<= x 6.8e-177)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 6400.0)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= x 3.4e+60)
(/ 1.0 (- (* n (+ x 0.5)) (/ (* n 0.08333333333333333) x)))
(/ 0.0 n))))))
double code(double x, double n) {
double tmp;
if (x <= 1.75e-276) {
tmp = -log(x) / n;
} else if (x <= 6.8e-177) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 6400.0) {
tmp = log(((1.0 + x) / x)) / n;
} else if (x <= 3.4e+60) {
tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x));
} else {
tmp = 0.0 / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.75d-276) then
tmp = -log(x) / n
else if (x <= 6.8d-177) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 6400.0d0) then
tmp = log(((1.0d0 + x) / x)) / n
else if (x <= 3.4d+60) then
tmp = 1.0d0 / ((n * (x + 0.5d0)) - ((n * 0.08333333333333333d0) / x))
else
tmp = 0.0d0 / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.75e-276) {
tmp = -Math.log(x) / n;
} else if (x <= 6.8e-177) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 6400.0) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if (x <= 3.4e+60) {
tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x));
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.75e-276: tmp = -math.log(x) / n elif x <= 6.8e-177: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 6400.0: tmp = math.log(((1.0 + x) / x)) / n elif x <= 3.4e+60: tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x)) else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.75e-276) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 6.8e-177) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 6400.0) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (x <= 3.4e+60) tmp = Float64(1.0 / Float64(Float64(n * Float64(x + 0.5)) - Float64(Float64(n * 0.08333333333333333) / x))); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.75e-276) tmp = -log(x) / n; elseif (x <= 6.8e-177) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 6400.0) tmp = log(((1.0 + x) / x)) / n; elseif (x <= 3.4e+60) tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x)); else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.75e-276], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 6.8e-177], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6400.0], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 3.4e+60], N[(1.0 / N[(N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[(n * 0.08333333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.75 \cdot 10^{-276}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-177}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 6400:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{+60}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right) - \frac{n \cdot 0.08333333333333333}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
(FPCore (x n)
:precision binary64
(if (<= x 1.3e-238)
(/ (- (log x)) n)
(if (<= x 7.5e-210)
(/ 1.0 (* n x))
(if (<= x 0.5)
(/ (- x (log x)) n)
(if (<= x 3.2e+62)
(/ 1.0 (- (* n (+ x 0.5)) (/ (* n 0.08333333333333333) x)))
(/ 0.0 n))))))
double code(double x, double n) {
double tmp;
if (x <= 1.3e-238) {
tmp = -log(x) / n;
} else if (x <= 7.5e-210) {
tmp = 1.0 / (n * x);
} else if (x <= 0.5) {
tmp = (x - log(x)) / n;
} else if (x <= 3.2e+62) {
tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x));
} else {
tmp = 0.0 / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.3d-238) then
tmp = -log(x) / n
else if (x <= 7.5d-210) then
tmp = 1.0d0 / (n * x)
else if (x <= 0.5d0) then
tmp = (x - log(x)) / n
else if (x <= 3.2d+62) then
tmp = 1.0d0 / ((n * (x + 0.5d0)) - ((n * 0.08333333333333333d0) / x))
else
tmp = 0.0d0 / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.3e-238) {
tmp = -Math.log(x) / n;
} else if (x <= 7.5e-210) {
tmp = 1.0 / (n * x);
} else if (x <= 0.5) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 3.2e+62) {
tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x));
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.3e-238: tmp = -math.log(x) / n elif x <= 7.5e-210: tmp = 1.0 / (n * x) elif x <= 0.5: tmp = (x - math.log(x)) / n elif x <= 3.2e+62: tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x)) else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.3e-238) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 7.5e-210) tmp = Float64(1.0 / Float64(n * x)); elseif (x <= 0.5) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 3.2e+62) tmp = Float64(1.0 / Float64(Float64(n * Float64(x + 0.5)) - Float64(Float64(n * 0.08333333333333333) / x))); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.3e-238) tmp = -log(x) / n; elseif (x <= 7.5e-210) tmp = 1.0 / (n * x); elseif (x <= 0.5) tmp = (x - log(x)) / n; elseif (x <= 3.2e+62) tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x)); else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.3e-238], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 7.5e-210], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.5], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 3.2e+62], N[(1.0 / N[(N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[(n * 0.08333333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.3 \cdot 10^{-238}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-210}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;x \leq 0.5:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{+62}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right) - \frac{n \cdot 0.08333333333333333}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
(FPCore (x n)
:precision binary64
(if (<= x 1.95e-280)
(/ (- (log x)) n)
(if (<= x 1.1e-176)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.5)
(/ (- x (log x)) n)
(if (<= x 1.05e+62)
(/ 1.0 (- (* n (+ x 0.5)) (/ (* n 0.08333333333333333) x)))
(/ 0.0 n))))))
double code(double x, double n) {
double tmp;
if (x <= 1.95e-280) {
tmp = -log(x) / n;
} else if (x <= 1.1e-176) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.5) {
tmp = (x - log(x)) / n;
} else if (x <= 1.05e+62) {
tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x));
} else {
tmp = 0.0 / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.95d-280) then
tmp = -log(x) / n
else if (x <= 1.1d-176) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.5d0) then
tmp = (x - log(x)) / n
else if (x <= 1.05d+62) then
tmp = 1.0d0 / ((n * (x + 0.5d0)) - ((n * 0.08333333333333333d0) / x))
else
tmp = 0.0d0 / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.95e-280) {
tmp = -Math.log(x) / n;
} else if (x <= 1.1e-176) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.5) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 1.05e+62) {
tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x));
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.95e-280: tmp = -math.log(x) / n elif x <= 1.1e-176: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.5: tmp = (x - math.log(x)) / n elif x <= 1.05e+62: tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x)) else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.95e-280) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 1.1e-176) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.5) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 1.05e+62) tmp = Float64(1.0 / Float64(Float64(n * Float64(x + 0.5)) - Float64(Float64(n * 0.08333333333333333) / x))); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.95e-280) tmp = -log(x) / n; elseif (x <= 1.1e-176) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.5) tmp = (x - log(x)) / n; elseif (x <= 1.05e+62) tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x)); else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.95e-280], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 1.1e-176], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.5], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 1.05e+62], N[(1.0 / N[(N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[(n * 0.08333333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.95 \cdot 10^{-280}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-176}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.5:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{+62}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right) - \frac{n \cdot 0.08333333333333333}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log x)) n)))
(if (<= x 1.3e-238)
t_0
(if (<= x 7.5e-210)
(/ 1.0 (* n x))
(if (<= x 0.32)
t_0
(if (<= x 1.95e+62)
(/ 1.0 (- (* n (+ x 0.5)) (/ (* n 0.08333333333333333) x)))
(/ 0.0 n)))))))
double code(double x, double n) {
double t_0 = -log(x) / n;
double tmp;
if (x <= 1.3e-238) {
tmp = t_0;
} else if (x <= 7.5e-210) {
tmp = 1.0 / (n * x);
} else if (x <= 0.32) {
tmp = t_0;
} else if (x <= 1.95e+62) {
tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x));
} else {
tmp = 0.0 / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = -log(x) / n
if (x <= 1.3d-238) then
tmp = t_0
else if (x <= 7.5d-210) then
tmp = 1.0d0 / (n * x)
else if (x <= 0.32d0) then
tmp = t_0
else if (x <= 1.95d+62) then
tmp = 1.0d0 / ((n * (x + 0.5d0)) - ((n * 0.08333333333333333d0) / x))
else
tmp = 0.0d0 / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = -Math.log(x) / n;
double tmp;
if (x <= 1.3e-238) {
tmp = t_0;
} else if (x <= 7.5e-210) {
tmp = 1.0 / (n * x);
} else if (x <= 0.32) {
tmp = t_0;
} else if (x <= 1.95e+62) {
tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x));
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): t_0 = -math.log(x) / n tmp = 0 if x <= 1.3e-238: tmp = t_0 elif x <= 7.5e-210: tmp = 1.0 / (n * x) elif x <= 0.32: tmp = t_0 elif x <= 1.95e+62: tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x)) else: tmp = 0.0 / n return tmp
function code(x, n) t_0 = Float64(Float64(-log(x)) / n) tmp = 0.0 if (x <= 1.3e-238) tmp = t_0; elseif (x <= 7.5e-210) tmp = Float64(1.0 / Float64(n * x)); elseif (x <= 0.32) tmp = t_0; elseif (x <= 1.95e+62) tmp = Float64(1.0 / Float64(Float64(n * Float64(x + 0.5)) - Float64(Float64(n * 0.08333333333333333) / x))); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) t_0 = -log(x) / n; tmp = 0.0; if (x <= 1.3e-238) tmp = t_0; elseif (x <= 7.5e-210) tmp = 1.0 / (n * x); elseif (x <= 0.32) tmp = t_0; elseif (x <= 1.95e+62) tmp = 1.0 / ((n * (x + 0.5)) - ((n * 0.08333333333333333) / x)); else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[x, 1.3e-238], t$95$0, If[LessEqual[x, 7.5e-210], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.32], t$95$0, If[LessEqual[x, 1.95e+62], N[(1.0 / N[(N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[(n * 0.08333333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log x}{n}\\
\mathbf{if}\;x \leq 1.3 \cdot 10^{-238}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-210}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;x \leq 0.32:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{+62}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right) - \frac{n \cdot 0.08333333333333333}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -4.0) (/ 0.0 n) (if (<= (/ 1.0 n) 2e+174) (/ 1.0 (* n (+ x 0.5))) (/ 1.0 (* n x)))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -4.0) {
tmp = 0.0 / n;
} else if ((1.0 / n) <= 2e+174) {
tmp = 1.0 / (n * (x + 0.5));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((1.0d0 / n) <= (-4.0d0)) then
tmp = 0.0d0 / n
else if ((1.0d0 / n) <= 2d+174) then
tmp = 1.0d0 / (n * (x + 0.5d0))
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -4.0) {
tmp = 0.0 / n;
} else if ((1.0 / n) <= 2e+174) {
tmp = 1.0 / (n * (x + 0.5));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -4.0: tmp = 0.0 / n elif (1.0 / n) <= 2e+174: tmp = 1.0 / (n * (x + 0.5)) else: tmp = 1.0 / (n * x) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -4.0) tmp = Float64(0.0 / n); elseif (Float64(1.0 / n) <= 2e+174) tmp = Float64(1.0 / Float64(n * Float64(x + 0.5))); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -4.0) tmp = 0.0 / n; elseif ((1.0 / n) <= 2e+174) tmp = 1.0 / (n * (x + 0.5)); else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -4.0], N[(0.0 / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+174], N[(1.0 / N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -4:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+174}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
(FPCore (x n) :precision binary64 (if (<= n -2.0) (/ 1.0 (* n (+ x 0.5))) (/ (/ 1.0 x) n)))
double code(double x, double n) {
double tmp;
if (n <= -2.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 <= (-2.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 <= -2.0) {
tmp = 1.0 / (n * (x + 0.5));
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -2.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 <= -2.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 <= -2.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, -2.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 -2:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
(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}
(FPCore (x n) :precision binary64 (/ (/ 1.0 x) n))
double code(double x, double n) {
return (1.0 / x) / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / x) / n
end function
public static double code(double x, double n) {
return (1.0 / x) / n;
}
def code(x, n): return (1.0 / x) / n
function code(x, n) return Float64(Float64(1.0 / x) / n) end
function tmp = code(x, n) tmp = (1.0 / x) / n; end
code[x_, n_] := N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{n}
\end{array}
herbie shell --seed 2023343
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))