
(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 16 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 (log1p x) 2.0))
(t_1 (pow (log x) 2.0))
(t_2 (pow x (/ 1.0 n)))
(t_3 (/ (log1p x) n))
(t_4 (fma 0.5 (* t_0 (pow n -2.0)) t_3))
(t_5 (fma 0.5 (* t_1 (pow n -2.0)) (/ (log x) n))))
(if (<= (/ 1.0 n) -1e-105)
(/ t_2 (* n x))
(if (<= (/ 1.0 n) 1e-165)
(+ (/ (* 0.5 (- t_0 t_1)) (* n n)) (/ (- (log1p x) (log x)) n))
(if (<= (/ 1.0 n) 2e-139)
(/ 1.0 (* n x))
(if (<= (/ 1.0 n) 2e-96)
(/ 1.0 (/ (+ t_4 t_5) (- (pow t_4 2.0) (pow t_5 2.0))))
(if (<= (/ 1.0 n) 2e-8)
(+
(* (pow n -1.0) (/ (pow x (pow n -1.0)) x))
(+
(* (/ t_2 (* x x)) (+ (/ 0.5 (* n n)) (/ -0.5 n)))
(/ (/ 0.3333333333333333 n) (pow x 3.0))))
(- (exp t_3) t_2))))))))
double code(double x, double n) {
double t_0 = pow(log1p(x), 2.0);
double t_1 = pow(log(x), 2.0);
double t_2 = pow(x, (1.0 / n));
double t_3 = log1p(x) / n;
double t_4 = fma(0.5, (t_0 * pow(n, -2.0)), t_3);
double t_5 = fma(0.5, (t_1 * pow(n, -2.0)), (log(x) / n));
double tmp;
if ((1.0 / n) <= -1e-105) {
tmp = t_2 / (n * x);
} else if ((1.0 / n) <= 1e-165) {
tmp = ((0.5 * (t_0 - t_1)) / (n * n)) + ((log1p(x) - log(x)) / n);
} else if ((1.0 / n) <= 2e-139) {
tmp = 1.0 / (n * x);
} else if ((1.0 / n) <= 2e-96) {
tmp = 1.0 / ((t_4 + t_5) / (pow(t_4, 2.0) - pow(t_5, 2.0)));
} else if ((1.0 / n) <= 2e-8) {
tmp = (pow(n, -1.0) * (pow(x, pow(n, -1.0)) / x)) + (((t_2 / (x * x)) * ((0.5 / (n * n)) + (-0.5 / n))) + ((0.3333333333333333 / n) / pow(x, 3.0)));
} else {
tmp = exp(t_3) - t_2;
}
return tmp;
}
function code(x, n) t_0 = log1p(x) ^ 2.0 t_1 = log(x) ^ 2.0 t_2 = x ^ Float64(1.0 / n) t_3 = Float64(log1p(x) / n) t_4 = fma(0.5, Float64(t_0 * (n ^ -2.0)), t_3) t_5 = fma(0.5, Float64(t_1 * (n ^ -2.0)), Float64(log(x) / n)) tmp = 0.0 if (Float64(1.0 / n) <= -1e-105) tmp = Float64(t_2 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-165) tmp = Float64(Float64(Float64(0.5 * Float64(t_0 - t_1)) / Float64(n * n)) + Float64(Float64(log1p(x) - log(x)) / n)); elseif (Float64(1.0 / n) <= 2e-139) tmp = Float64(1.0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-96) tmp = Float64(1.0 / Float64(Float64(t_4 + t_5) / Float64((t_4 ^ 2.0) - (t_5 ^ 2.0)))); elseif (Float64(1.0 / n) <= 2e-8) tmp = Float64(Float64((n ^ -1.0) * Float64((x ^ (n ^ -1.0)) / x)) + Float64(Float64(Float64(t_2 / Float64(x * x)) * Float64(Float64(0.5 / Float64(n * n)) + Float64(-0.5 / n))) + Float64(Float64(0.3333333333333333 / n) / (x ^ 3.0)))); else tmp = Float64(exp(t_3) - t_2); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$4 = N[(0.5 * N[(t$95$0 * N[Power[n, -2.0], $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(0.5 * N[(t$95$1 * N[Power[n, -2.0], $MachinePrecision]), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-105], N[(t$95$2 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-165], N[(N[(N[(0.5 * N[(t$95$0 - t$95$1), $MachinePrecision]), $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-139], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-96], N[(1.0 / N[(N[(t$95$4 + t$95$5), $MachinePrecision] / N[(N[Power[t$95$4, 2.0], $MachinePrecision] - N[Power[t$95$5, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-8], N[(N[(N[Power[n, -1.0], $MachinePrecision] * N[(N[Power[x, N[Power[n, -1.0], $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$2 / N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.3333333333333333 / n), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[t$95$3], $MachinePrecision] - t$95$2), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{log1p}\left(x\right)\right)}^{2}\\
t_1 := {\log x}^{2}\\
t_2 := {x}^{\left(\frac{1}{n}\right)}\\
t_3 := \frac{\mathsf{log1p}\left(x\right)}{n}\\
t_4 := \mathsf{fma}\left(0.5, t_0 \cdot {n}^{-2}, t_3\right)\\
t_5 := \mathsf{fma}\left(0.5, t_1 \cdot {n}^{-2}, \frac{\log x}{n}\right)\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-105}:\\
\;\;\;\;\frac{t_2}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-165}:\\
\;\;\;\;\frac{0.5 \cdot \left(t_0 - t_1\right)}{n \cdot n} + \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-139}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-96}:\\
\;\;\;\;\frac{1}{\frac{t_4 + t_5}{{t_4}^{2} - {t_5}^{2}}}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;{n}^{-1} \cdot \frac{{x}^{\left({n}^{-1}\right)}}{x} + \left(\frac{t_2}{x \cdot x} \cdot \left(\frac{0.5}{n \cdot n} + \frac{-0.5}{n}\right) + \frac{\frac{0.3333333333333333}{n}}{{x}^{3}}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{t_3} - t_2\\
\end{array}
\end{array}
if (/.f64 1 n) < -9.99999999999999965e-106Initial program 81.4%
Taylor expanded in x around inf 93.7%
log-rec93.7%
mul-1-neg93.7%
associate-*r/93.7%
neg-mul-193.7%
mul-1-neg93.7%
remove-double-neg93.7%
*-lft-identity93.7%
associate-*l/93.7%
log-pow93.7%
rem-exp-log93.7%
*-commutative93.7%
Simplified93.7%
if -9.99999999999999965e-106 < (/.f64 1 n) < 1e-165Initial program 36.6%
Taylor expanded in n around 0 36.6%
log1p-def36.6%
*-lft-identity36.6%
associate-*l/36.6%
log-pow36.6%
rem-exp-log36.6%
Simplified36.6%
Taylor expanded in n around -inf 85.0%
associate--l+85.0%
Simplified85.0%
if 1e-165 < (/.f64 1 n) < 2.00000000000000006e-139Initial program 30.3%
Taylor expanded in x around inf 99.6%
log-rec99.6%
mul-1-neg99.6%
associate-*r/99.6%
neg-mul-199.6%
mul-1-neg99.6%
remove-double-neg99.6%
*-lft-identity99.6%
associate-*l/99.6%
log-pow99.6%
rem-exp-log99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in n around inf 99.6%
*-commutative99.6%
Simplified99.6%
if 2.00000000000000006e-139 < (/.f64 1 n) < 1.9999999999999998e-96Initial program 24.9%
Taylor expanded in n around inf 86.2%
fma-def86.2%
log1p-def86.2%
unpow286.2%
log1p-def86.2%
fma-def86.2%
unpow286.2%
Simplified86.2%
flip--86.3%
clear-num86.4%
Applied egg-rr86.4%
if 1.9999999999999998e-96 < (/.f64 1 n) < 2e-8Initial program 17.5%
Taylor expanded in x around inf 79.9%
Simplified79.9%
associate-/r*80.1%
div-inv80.0%
inv-pow80.0%
inv-pow80.0%
Applied egg-rr80.0%
Taylor expanded in n around inf 80.0%
associate-/r*80.0%
Simplified80.0%
if 2e-8 < (/.f64 1 n) Initial program 57.0%
Taylor expanded in n around 0 57.0%
log1p-def93.3%
*-lft-identity93.3%
associate-*l/93.3%
log-pow93.3%
rem-exp-log93.3%
Simplified93.3%
Final simplification89.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow (log1p x) 2.0))
(t_1 (pow (log x) 2.0))
(t_2 (pow x (/ 1.0 n)))
(t_3 (/ (log1p x) n))
(t_4 (fma (* 0.5 t_0) (pow n -2.0) t_3))
(t_5 (fma 0.5 (* t_1 (pow n -2.0)) (/ (log x) n))))
(if (<= (/ 1.0 n) -1e-105)
(/ t_2 (* n x))
(if (<= (/ 1.0 n) 1e-165)
(+ (/ (* 0.5 (- t_0 t_1)) (* n n)) (/ (- (log1p x) (log x)) n))
(if (<= (/ 1.0 n) 2e-139)
(/ 1.0 (* n x))
(if (<= (/ 1.0 n) 2e-96)
(/ (- (pow t_4 2.0) (pow t_5 2.0)) (+ t_5 t_4))
(if (<= (/ 1.0 n) 2e-8)
(+
(* (pow n -1.0) (/ (pow x (pow n -1.0)) x))
(+
(* (/ t_2 (* x x)) (+ (/ 0.5 (* n n)) (/ -0.5 n)))
(/ (/ 0.3333333333333333 n) (pow x 3.0))))
(- (exp t_3) t_2))))))))
double code(double x, double n) {
double t_0 = pow(log1p(x), 2.0);
double t_1 = pow(log(x), 2.0);
double t_2 = pow(x, (1.0 / n));
double t_3 = log1p(x) / n;
double t_4 = fma((0.5 * t_0), pow(n, -2.0), t_3);
double t_5 = fma(0.5, (t_1 * pow(n, -2.0)), (log(x) / n));
double tmp;
if ((1.0 / n) <= -1e-105) {
tmp = t_2 / (n * x);
} else if ((1.0 / n) <= 1e-165) {
tmp = ((0.5 * (t_0 - t_1)) / (n * n)) + ((log1p(x) - log(x)) / n);
} else if ((1.0 / n) <= 2e-139) {
tmp = 1.0 / (n * x);
} else if ((1.0 / n) <= 2e-96) {
tmp = (pow(t_4, 2.0) - pow(t_5, 2.0)) / (t_5 + t_4);
} else if ((1.0 / n) <= 2e-8) {
tmp = (pow(n, -1.0) * (pow(x, pow(n, -1.0)) / x)) + (((t_2 / (x * x)) * ((0.5 / (n * n)) + (-0.5 / n))) + ((0.3333333333333333 / n) / pow(x, 3.0)));
} else {
tmp = exp(t_3) - t_2;
}
return tmp;
}
function code(x, n) t_0 = log1p(x) ^ 2.0 t_1 = log(x) ^ 2.0 t_2 = x ^ Float64(1.0 / n) t_3 = Float64(log1p(x) / n) t_4 = fma(Float64(0.5 * t_0), (n ^ -2.0), t_3) t_5 = fma(0.5, Float64(t_1 * (n ^ -2.0)), Float64(log(x) / n)) tmp = 0.0 if (Float64(1.0 / n) <= -1e-105) tmp = Float64(t_2 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-165) tmp = Float64(Float64(Float64(0.5 * Float64(t_0 - t_1)) / Float64(n * n)) + Float64(Float64(log1p(x) - log(x)) / n)); elseif (Float64(1.0 / n) <= 2e-139) tmp = Float64(1.0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-96) tmp = Float64(Float64((t_4 ^ 2.0) - (t_5 ^ 2.0)) / Float64(t_5 + t_4)); elseif (Float64(1.0 / n) <= 2e-8) tmp = Float64(Float64((n ^ -1.0) * Float64((x ^ (n ^ -1.0)) / x)) + Float64(Float64(Float64(t_2 / Float64(x * x)) * Float64(Float64(0.5 / Float64(n * n)) + Float64(-0.5 / n))) + Float64(Float64(0.3333333333333333 / n) / (x ^ 3.0)))); else tmp = Float64(exp(t_3) - t_2); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$4 = N[(N[(0.5 * t$95$0), $MachinePrecision] * N[Power[n, -2.0], $MachinePrecision] + t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(0.5 * N[(t$95$1 * N[Power[n, -2.0], $MachinePrecision]), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-105], N[(t$95$2 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-165], N[(N[(N[(0.5 * N[(t$95$0 - t$95$1), $MachinePrecision]), $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-139], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-96], N[(N[(N[Power[t$95$4, 2.0], $MachinePrecision] - N[Power[t$95$5, 2.0], $MachinePrecision]), $MachinePrecision] / N[(t$95$5 + t$95$4), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-8], N[(N[(N[Power[n, -1.0], $MachinePrecision] * N[(N[Power[x, N[Power[n, -1.0], $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$2 / N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.3333333333333333 / n), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[t$95$3], $MachinePrecision] - t$95$2), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{log1p}\left(x\right)\right)}^{2}\\
t_1 := {\log x}^{2}\\
t_2 := {x}^{\left(\frac{1}{n}\right)}\\
t_3 := \frac{\mathsf{log1p}\left(x\right)}{n}\\
t_4 := \mathsf{fma}\left(0.5 \cdot t_0, {n}^{-2}, t_3\right)\\
t_5 := \mathsf{fma}\left(0.5, t_1 \cdot {n}^{-2}, \frac{\log x}{n}\right)\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-105}:\\
\;\;\;\;\frac{t_2}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-165}:\\
\;\;\;\;\frac{0.5 \cdot \left(t_0 - t_1\right)}{n \cdot n} + \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-139}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-96}:\\
\;\;\;\;\frac{{t_4}^{2} - {t_5}^{2}}{t_5 + t_4}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;{n}^{-1} \cdot \frac{{x}^{\left({n}^{-1}\right)}}{x} + \left(\frac{t_2}{x \cdot x} \cdot \left(\frac{0.5}{n \cdot n} + \frac{-0.5}{n}\right) + \frac{\frac{0.3333333333333333}{n}}{{x}^{3}}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{t_3} - t_2\\
\end{array}
\end{array}
if (/.f64 1 n) < -9.99999999999999965e-106Initial program 81.4%
Taylor expanded in x around inf 93.7%
log-rec93.7%
mul-1-neg93.7%
associate-*r/93.7%
neg-mul-193.7%
mul-1-neg93.7%
remove-double-neg93.7%
*-lft-identity93.7%
associate-*l/93.7%
log-pow93.7%
rem-exp-log93.7%
*-commutative93.7%
Simplified93.7%
if -9.99999999999999965e-106 < (/.f64 1 n) < 1e-165Initial program 36.6%
Taylor expanded in n around 0 36.6%
log1p-def36.6%
*-lft-identity36.6%
associate-*l/36.6%
log-pow36.6%
rem-exp-log36.6%
Simplified36.6%
Taylor expanded in n around -inf 85.0%
associate--l+85.0%
Simplified85.0%
if 1e-165 < (/.f64 1 n) < 2.00000000000000006e-139Initial program 30.3%
Taylor expanded in x around inf 99.6%
log-rec99.6%
mul-1-neg99.6%
associate-*r/99.6%
neg-mul-199.6%
mul-1-neg99.6%
remove-double-neg99.6%
*-lft-identity99.6%
associate-*l/99.6%
log-pow99.6%
rem-exp-log99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in n around inf 99.6%
*-commutative99.6%
Simplified99.6%
if 2.00000000000000006e-139 < (/.f64 1 n) < 1.9999999999999998e-96Initial program 24.9%
Taylor expanded in n around inf 86.2%
fma-def86.2%
log1p-def86.2%
unpow286.2%
log1p-def86.2%
fma-def86.2%
unpow286.2%
Simplified86.2%
flip--86.3%
div-sub86.3%
sub-neg86.3%
Applied egg-rr86.3%
unsub-neg86.3%
div-sub86.3%
Simplified86.3%
if 1.9999999999999998e-96 < (/.f64 1 n) < 2e-8Initial program 17.5%
Taylor expanded in x around inf 79.9%
Simplified79.9%
associate-/r*80.1%
div-inv80.0%
inv-pow80.0%
inv-pow80.0%
Applied egg-rr80.0%
Taylor expanded in n around inf 80.0%
associate-/r*80.0%
Simplified80.0%
if 2e-8 < (/.f64 1 n) Initial program 57.0%
Taylor expanded in n around 0 57.0%
log1p-def93.3%
*-lft-identity93.3%
associate-*l/93.3%
log-pow93.3%
rem-exp-log93.3%
Simplified93.3%
Final simplification89.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (- (log1p x) (log x)) n)))
(if (<= (/ 1.0 n) -1e-105)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 1e-165)
(+ (/ (* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0))) (* n n)) t_1)
(if (<= (/ 1.0 n) 2e-139)
(/ 1.0 (* n x))
(if (<= (/ 1.0 n) 2e-96)
t_1
(if (<= (/ 1.0 n) 2e-8)
(+
(* (pow n -1.0) (/ (pow x (pow n -1.0)) x))
(+
(* (/ t_0 (* x x)) (+ (/ 0.5 (* n n)) (/ -0.5 n)))
(/ (/ 0.3333333333333333 n) (pow x 3.0))))
(- (exp (/ (log1p x) n)) t_0))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = (log1p(x) - log(x)) / n;
double tmp;
if ((1.0 / n) <= -1e-105) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-165) {
tmp = ((0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0))) / (n * n)) + t_1;
} else if ((1.0 / n) <= 2e-139) {
tmp = 1.0 / (n * x);
} else if ((1.0 / n) <= 2e-96) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-8) {
tmp = (pow(n, -1.0) * (pow(x, pow(n, -1.0)) / x)) + (((t_0 / (x * x)) * ((0.5 / (n * n)) + (-0.5 / n))) + ((0.3333333333333333 / n) / pow(x, 3.0)));
} 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 t_1 = (Math.log1p(x) - Math.log(x)) / n;
double tmp;
if ((1.0 / n) <= -1e-105) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-165) {
tmp = ((0.5 * (Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0))) / (n * n)) + t_1;
} else if ((1.0 / n) <= 2e-139) {
tmp = 1.0 / (n * x);
} else if ((1.0 / n) <= 2e-96) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-8) {
tmp = (Math.pow(n, -1.0) * (Math.pow(x, Math.pow(n, -1.0)) / x)) + (((t_0 / (x * x)) * ((0.5 / (n * n)) + (-0.5 / n))) + ((0.3333333333333333 / n) / Math.pow(x, 3.0)));
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = (math.log1p(x) - math.log(x)) / n tmp = 0 if (1.0 / n) <= -1e-105: tmp = t_0 / (n * x) elif (1.0 / n) <= 1e-165: tmp = ((0.5 * (math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0))) / (n * n)) + t_1 elif (1.0 / n) <= 2e-139: tmp = 1.0 / (n * x) elif (1.0 / n) <= 2e-96: tmp = t_1 elif (1.0 / n) <= 2e-8: tmp = (math.pow(n, -1.0) * (math.pow(x, math.pow(n, -1.0)) / x)) + (((t_0 / (x * x)) * ((0.5 / (n * n)) + (-0.5 / n))) + ((0.3333333333333333 / n) / math.pow(x, 3.0))) else: tmp = math.exp((math.log1p(x) / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(log1p(x) - log(x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-105) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-165) tmp = Float64(Float64(Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) / Float64(n * n)) + t_1); elseif (Float64(1.0 / n) <= 2e-139) tmp = Float64(1.0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-96) tmp = t_1; elseif (Float64(1.0 / n) <= 2e-8) tmp = Float64(Float64((n ^ -1.0) * Float64((x ^ (n ^ -1.0)) / x)) + Float64(Float64(Float64(t_0 / Float64(x * x)) * Float64(Float64(0.5 / Float64(n * n)) + Float64(-0.5 / n))) + Float64(Float64(0.3333333333333333 / n) / (x ^ 3.0)))); 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]}, Block[{t$95$1 = N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-105], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-165], 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), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-139], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-96], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-8], N[(N[(N[Power[n, -1.0], $MachinePrecision] * N[(N[Power[x, N[Power[n, -1.0], $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$0 / N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.3333333333333333 / n), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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)}\\
t_1 := \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-105}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-165}:\\
\;\;\;\;\frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right)}{n \cdot n} + t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-139}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-96}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;{n}^{-1} \cdot \frac{{x}^{\left({n}^{-1}\right)}}{x} + \left(\frac{t_0}{x \cdot x} \cdot \left(\frac{0.5}{n \cdot n} + \frac{-0.5}{n}\right) + \frac{\frac{0.3333333333333333}{n}}{{x}^{3}}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -9.99999999999999965e-106Initial program 81.4%
Taylor expanded in x around inf 93.7%
log-rec93.7%
mul-1-neg93.7%
associate-*r/93.7%
neg-mul-193.7%
mul-1-neg93.7%
remove-double-neg93.7%
*-lft-identity93.7%
associate-*l/93.7%
log-pow93.7%
rem-exp-log93.7%
*-commutative93.7%
Simplified93.7%
if -9.99999999999999965e-106 < (/.f64 1 n) < 1e-165Initial program 36.6%
Taylor expanded in n around 0 36.6%
log1p-def36.6%
*-lft-identity36.6%
associate-*l/36.6%
log-pow36.6%
rem-exp-log36.6%
Simplified36.6%
Taylor expanded in n around -inf 85.0%
associate--l+85.0%
Simplified85.0%
if 1e-165 < (/.f64 1 n) < 2.00000000000000006e-139Initial program 30.3%
Taylor expanded in x around inf 99.6%
log-rec99.6%
mul-1-neg99.6%
associate-*r/99.6%
neg-mul-199.6%
mul-1-neg99.6%
remove-double-neg99.6%
*-lft-identity99.6%
associate-*l/99.6%
log-pow99.6%
rem-exp-log99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in n around inf 99.6%
*-commutative99.6%
Simplified99.6%
if 2.00000000000000006e-139 < (/.f64 1 n) < 1.9999999999999998e-96Initial program 24.9%
Taylor expanded in n around inf 86.2%
log1p-def86.2%
Simplified86.2%
if 1.9999999999999998e-96 < (/.f64 1 n) < 2e-8Initial program 17.5%
Taylor expanded in x around inf 79.9%
Simplified79.9%
associate-/r*80.1%
div-inv80.0%
inv-pow80.0%
inv-pow80.0%
Applied egg-rr80.0%
Taylor expanded in n around inf 80.0%
associate-/r*80.0%
Simplified80.0%
if 2e-8 < (/.f64 1 n) Initial program 57.0%
Taylor expanded in n around 0 57.0%
log1p-def93.3%
*-lft-identity93.3%
associate-*l/93.3%
log-pow93.3%
rem-exp-log93.3%
Simplified93.3%
Final simplification89.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (- (log1p x) (log x)) n)))
(if (<= (/ 1.0 n) -1e-105)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 1e-165)
t_1
(if (<= (/ 1.0 n) 2e-139)
(/ 1.0 (* n x))
(if (<= (/ 1.0 n) 2e-96)
t_1
(if (<= (/ 1.0 n) 2e-8)
(+
(* (pow n -1.0) (/ (pow x (pow n -1.0)) x))
(+
(* (/ t_0 (* x x)) (+ (/ 0.5 (* n n)) (/ -0.5 n)))
(/ (/ 0.3333333333333333 n) (pow x 3.0))))
(- (exp (/ (log1p x) n)) t_0))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = (log1p(x) - log(x)) / n;
double tmp;
if ((1.0 / n) <= -1e-105) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-165) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-139) {
tmp = 1.0 / (n * x);
} else if ((1.0 / n) <= 2e-96) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-8) {
tmp = (pow(n, -1.0) * (pow(x, pow(n, -1.0)) / x)) + (((t_0 / (x * x)) * ((0.5 / (n * n)) + (-0.5 / n))) + ((0.3333333333333333 / n) / pow(x, 3.0)));
} 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 t_1 = (Math.log1p(x) - Math.log(x)) / n;
double tmp;
if ((1.0 / n) <= -1e-105) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-165) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-139) {
tmp = 1.0 / (n * x);
} else if ((1.0 / n) <= 2e-96) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-8) {
tmp = (Math.pow(n, -1.0) * (Math.pow(x, Math.pow(n, -1.0)) / x)) + (((t_0 / (x * x)) * ((0.5 / (n * n)) + (-0.5 / n))) + ((0.3333333333333333 / n) / Math.pow(x, 3.0)));
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = (math.log1p(x) - math.log(x)) / n tmp = 0 if (1.0 / n) <= -1e-105: tmp = t_0 / (n * x) elif (1.0 / n) <= 1e-165: tmp = t_1 elif (1.0 / n) <= 2e-139: tmp = 1.0 / (n * x) elif (1.0 / n) <= 2e-96: tmp = t_1 elif (1.0 / n) <= 2e-8: tmp = (math.pow(n, -1.0) * (math.pow(x, math.pow(n, -1.0)) / x)) + (((t_0 / (x * x)) * ((0.5 / (n * n)) + (-0.5 / n))) + ((0.3333333333333333 / n) / math.pow(x, 3.0))) else: tmp = math.exp((math.log1p(x) / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(log1p(x) - log(x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-105) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-165) tmp = t_1; elseif (Float64(1.0 / n) <= 2e-139) tmp = Float64(1.0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-96) tmp = t_1; elseif (Float64(1.0 / n) <= 2e-8) tmp = Float64(Float64((n ^ -1.0) * Float64((x ^ (n ^ -1.0)) / x)) + Float64(Float64(Float64(t_0 / Float64(x * x)) * Float64(Float64(0.5 / Float64(n * n)) + Float64(-0.5 / n))) + Float64(Float64(0.3333333333333333 / n) / (x ^ 3.0)))); 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]}, Block[{t$95$1 = N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-105], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-165], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-139], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-96], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-8], N[(N[(N[Power[n, -1.0], $MachinePrecision] * N[(N[Power[x, N[Power[n, -1.0], $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$0 / N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.3333333333333333 / n), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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)}\\
t_1 := \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-105}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-165}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-139}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-96}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;{n}^{-1} \cdot \frac{{x}^{\left({n}^{-1}\right)}}{x} + \left(\frac{t_0}{x \cdot x} \cdot \left(\frac{0.5}{n \cdot n} + \frac{-0.5}{n}\right) + \frac{\frac{0.3333333333333333}{n}}{{x}^{3}}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -9.99999999999999965e-106Initial program 81.4%
Taylor expanded in x around inf 93.7%
log-rec93.7%
mul-1-neg93.7%
associate-*r/93.7%
neg-mul-193.7%
mul-1-neg93.7%
remove-double-neg93.7%
*-lft-identity93.7%
associate-*l/93.7%
log-pow93.7%
rem-exp-log93.7%
*-commutative93.7%
Simplified93.7%
if -9.99999999999999965e-106 < (/.f64 1 n) < 1e-165 or 2.00000000000000006e-139 < (/.f64 1 n) < 1.9999999999999998e-96Initial program 34.6%
Taylor expanded in n around inf 85.2%
log1p-def85.2%
Simplified85.2%
if 1e-165 < (/.f64 1 n) < 2.00000000000000006e-139Initial program 30.3%
Taylor expanded in x around inf 99.6%
log-rec99.6%
mul-1-neg99.6%
associate-*r/99.6%
neg-mul-199.6%
mul-1-neg99.6%
remove-double-neg99.6%
*-lft-identity99.6%
associate-*l/99.6%
log-pow99.6%
rem-exp-log99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in n around inf 99.6%
*-commutative99.6%
Simplified99.6%
if 1.9999999999999998e-96 < (/.f64 1 n) < 2e-8Initial program 17.5%
Taylor expanded in x around inf 79.9%
Simplified79.9%
associate-/r*80.1%
div-inv80.0%
inv-pow80.0%
inv-pow80.0%
Applied egg-rr80.0%
Taylor expanded in n around inf 80.0%
associate-/r*80.0%
Simplified80.0%
if 2e-8 < (/.f64 1 n) Initial program 57.0%
Taylor expanded in n around 0 57.0%
log1p-def93.3%
*-lft-identity93.3%
associate-*l/93.3%
log-pow93.3%
rem-exp-log93.3%
Simplified93.3%
Final simplification89.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n)))
(t_1 (/ t_0 (* n x)))
(t_2 (/ (- (log1p x) (log x)) n)))
(if (<= (/ 1.0 n) -1e-105)
t_1
(if (<= (/ 1.0 n) 1e-165)
t_2
(if (<= (/ 1.0 n) 2e-139)
(/ 1.0 (* n x))
(if (<= (/ 1.0 n) 2e-96)
t_2
(if (<= (/ 1.0 n) 50000.0)
(+
t_1
(/ (- (/ 0.3333333333333333 (pow x 3.0)) (/ 0.5 (* x x))) n))
(- (exp (/ (log1p x) n)) t_0))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = t_0 / (n * x);
double t_2 = (log1p(x) - log(x)) / n;
double tmp;
if ((1.0 / n) <= -1e-105) {
tmp = t_1;
} else if ((1.0 / n) <= 1e-165) {
tmp = t_2;
} else if ((1.0 / n) <= 2e-139) {
tmp = 1.0 / (n * x);
} else if ((1.0 / n) <= 2e-96) {
tmp = t_2;
} else if ((1.0 / n) <= 50000.0) {
tmp = t_1 + (((0.3333333333333333 / pow(x, 3.0)) - (0.5 / (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 t_1 = t_0 / (n * x);
double t_2 = (Math.log1p(x) - Math.log(x)) / n;
double tmp;
if ((1.0 / n) <= -1e-105) {
tmp = t_1;
} else if ((1.0 / n) <= 1e-165) {
tmp = t_2;
} else if ((1.0 / n) <= 2e-139) {
tmp = 1.0 / (n * x);
} else if ((1.0 / n) <= 2e-96) {
tmp = t_2;
} else if ((1.0 / n) <= 50000.0) {
tmp = t_1 + (((0.3333333333333333 / Math.pow(x, 3.0)) - (0.5 / (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)) t_1 = t_0 / (n * x) t_2 = (math.log1p(x) - math.log(x)) / n tmp = 0 if (1.0 / n) <= -1e-105: tmp = t_1 elif (1.0 / n) <= 1e-165: tmp = t_2 elif (1.0 / n) <= 2e-139: tmp = 1.0 / (n * x) elif (1.0 / n) <= 2e-96: tmp = t_2 elif (1.0 / n) <= 50000.0: tmp = t_1 + (((0.3333333333333333 / math.pow(x, 3.0)) - (0.5 / (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) t_1 = Float64(t_0 / Float64(n * x)) t_2 = Float64(Float64(log1p(x) - log(x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-105) tmp = t_1; elseif (Float64(1.0 / n) <= 1e-165) tmp = t_2; elseif (Float64(1.0 / n) <= 2e-139) tmp = Float64(1.0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-96) tmp = t_2; elseif (Float64(1.0 / n) <= 50000.0) tmp = Float64(t_1 + Float64(Float64(Float64(0.3333333333333333 / (x ^ 3.0)) - Float64(0.5 / Float64(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]}, Block[{t$95$1 = N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-105], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-165], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-139], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-96], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], 50000.0], N[(t$95$1 + N[(N[(N[(0.3333333333333333 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $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)}\\
t_1 := \frac{t_0}{n \cdot x}\\
t_2 := \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-105}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-165}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-139}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-96}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq 50000:\\
\;\;\;\;t_1 + \frac{\frac{0.3333333333333333}{{x}^{3}} - \frac{0.5}{x \cdot x}}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -9.99999999999999965e-106Initial program 81.4%
Taylor expanded in x around inf 93.7%
log-rec93.7%
mul-1-neg93.7%
associate-*r/93.7%
neg-mul-193.7%
mul-1-neg93.7%
remove-double-neg93.7%
*-lft-identity93.7%
associate-*l/93.7%
log-pow93.7%
rem-exp-log93.7%
*-commutative93.7%
Simplified93.7%
if -9.99999999999999965e-106 < (/.f64 1 n) < 1e-165 or 2.00000000000000006e-139 < (/.f64 1 n) < 1.9999999999999998e-96Initial program 34.6%
Taylor expanded in n around inf 85.2%
log1p-def85.2%
Simplified85.2%
if 1e-165 < (/.f64 1 n) < 2.00000000000000006e-139Initial program 30.3%
Taylor expanded in x around inf 99.6%
log-rec99.6%
mul-1-neg99.6%
associate-*r/99.6%
neg-mul-199.6%
mul-1-neg99.6%
remove-double-neg99.6%
*-lft-identity99.6%
associate-*l/99.6%
log-pow99.6%
rem-exp-log99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in n around inf 99.6%
*-commutative99.6%
Simplified99.6%
if 1.9999999999999998e-96 < (/.f64 1 n) < 5e4Initial program 21.0%
Taylor expanded in x around inf 70.3%
Simplified70.3%
Taylor expanded in n around inf 75.9%
associate-*r/75.9%
metadata-eval75.9%
associate-*r/75.9%
metadata-eval75.9%
unpow275.9%
Simplified75.9%
if 5e4 < (/.f64 1 n) Initial program 58.4%
Taylor expanded in n around 0 58.4%
log1p-def100.0%
*-lft-identity100.0%
associate-*l/100.0%
log-pow100.0%
rem-exp-log100.0%
Simplified100.0%
Final simplification89.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ 1.0 (* n x)))
(t_1 (/ (pow x (/ 1.0 n)) (* n x)))
(t_2 (/ (- (log1p x) (log x)) n)))
(if (<= (/ 1.0 n) -1e-105)
t_1
(if (<= (/ 1.0 n) 1e-165)
t_2
(if (<= (/ 1.0 n) 2e-139)
t_0
(if (<= (/ 1.0 n) 2e-96)
t_2
(if (<= (/ 1.0 n) 50000.0)
(+
t_1
(/ (- (/ 0.3333333333333333 (pow x 3.0)) (/ 0.5 (* x x))) n))
(cast
(!
:precision
binary32
(cast (! :precision binary64 t_0)))))))))))
double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double t_1 = pow(x, (1.0 / n)) / (n * x);
double t_2 = (log1p(x) - log(x)) / n;
double tmp;
if ((1.0 / n) <= -1e-105) {
tmp = t_1;
} else if ((1.0 / n) <= 1e-165) {
tmp = t_2;
} else if ((1.0 / n) <= 2e-139) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-96) {
tmp = t_2;
} else if ((1.0 / n) <= 50000.0) {
tmp = t_1 + (((0.3333333333333333 / pow(x, 3.0)) - (0.5 / (x * x))) / n);
} else {
double tmp_3 = t_0;
double tmp_2 = (float) tmp_3;
tmp = (double) tmp_2;
}
return tmp;
}
function code(x, n) t_0 = Float64(1.0 / Float64(n * x)) t_1 = Float64((x ^ Float64(1.0 / n)) / Float64(n * x)) t_2 = Float64(Float64(log1p(x) - log(x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-105) tmp = t_1; elseif (Float64(1.0 / n) <= 1e-165) tmp = t_2; elseif (Float64(1.0 / n) <= 2e-139) tmp = t_0; elseif (Float64(1.0 / n) <= 2e-96) tmp = t_2; elseif (Float64(1.0 / n) <= 50000.0) tmp = Float64(t_1 + Float64(Float64(Float64(0.3333333333333333 / (x ^ 3.0)) - Float64(0.5 / Float64(x * x))) / n)); else tmp_3 = t_0 tmp_2 = Float32(tmp_3) tmp = Float64(tmp_2); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{n \cdot x}\\
t_1 := \frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\
t_2 := \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-105}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-165}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-139}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-96}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq 50000:\\
\;\;\;\;t_1 + \frac{\frac{0.3333333333333333}{{x}^{3}} - \frac{0.5}{x \cdot x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\langle \left( \langle \left( t_0 \right)_{\text{binary64}} \rangle_{\text{binary32}} \right)_{\text{binary32}} \rangle_{\text{binary64}}\\
\end{array}
\end{array}
if (/.f64 1 n) < -9.99999999999999965e-106Initial program 81.4%
Taylor expanded in x around inf 93.7%
log-rec93.7%
mul-1-neg93.7%
associate-*r/93.7%
neg-mul-193.7%
mul-1-neg93.7%
remove-double-neg93.7%
*-lft-identity93.7%
associate-*l/93.7%
log-pow93.7%
rem-exp-log93.7%
*-commutative93.7%
Simplified93.7%
if -9.99999999999999965e-106 < (/.f64 1 n) < 1e-165 or 2.00000000000000006e-139 < (/.f64 1 n) < 1.9999999999999998e-96Initial program 34.6%
Taylor expanded in n around inf 85.2%
log1p-def85.2%
Simplified85.2%
if 1e-165 < (/.f64 1 n) < 2.00000000000000006e-139Initial program 30.3%
Taylor expanded in x around inf 99.6%
log-rec99.6%
mul-1-neg99.6%
associate-*r/99.6%
neg-mul-199.6%
mul-1-neg99.6%
remove-double-neg99.6%
*-lft-identity99.6%
associate-*l/99.6%
log-pow99.6%
rem-exp-log99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in n around inf 99.6%
*-commutative99.6%
Simplified99.6%
if 1.9999999999999998e-96 < (/.f64 1 n) < 5e4Initial program 21.0%
Taylor expanded in x around inf 70.3%
Simplified70.3%
Taylor expanded in n around inf 75.9%
associate-*r/75.9%
metadata-eval75.9%
associate-*r/75.9%
metadata-eval75.9%
unpow275.9%
Simplified75.9%
if 5e4 < (/.f64 1 n) Initial program 58.4%
Taylor expanded in x around inf 1.1%
log-rec1.1%
mul-1-neg1.1%
associate-*r/1.1%
neg-mul-11.1%
mul-1-neg1.1%
remove-double-neg1.1%
*-lft-identity1.1%
associate-*l/1.1%
log-pow1.1%
rem-exp-log1.1%
*-commutative1.1%
Simplified1.1%
Taylor expanded in n around inf 31.8%
*-commutative31.8%
Simplified31.8%
rewrite-binary64/binary32-simplify58.5%
Applied rewrite-once58.5%
Final simplification85.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ 1.0 (* n x)))
(t_1 (/ (- (log1p x) (log x)) n))
(t_2 (pow x (/ (/ 1.0 n) 2.0))))
(if (<= (/ 1.0 n) -1e-105)
(/ (pow x (/ 1.0 n)) (* n x))
(if (<= (/ 1.0 n) 1e-165)
t_1
(if (<= (/ 1.0 n) 2e-139)
t_0
(if (<= (/ 1.0 n) 2e-96)
t_1
(if (<= (/ 1.0 n) 5e+68)
(* (/ t_2 x) (/ t_2 n))
(cast
(!
:precision
binary32
(cast (! :precision binary64 t_0)))))))))))
double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double t_1 = (log1p(x) - log(x)) / n;
double t_2 = pow(x, ((1.0 / n) / 2.0));
double tmp;
if ((1.0 / n) <= -1e-105) {
tmp = pow(x, (1.0 / n)) / (n * x);
} else if ((1.0 / n) <= 1e-165) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-139) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-96) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+68) {
tmp = (t_2 / x) * (t_2 / n);
} else {
double tmp_3 = t_0;
double tmp_2 = (float) tmp_3;
tmp = (double) tmp_2;
}
return tmp;
}
function code(x, n) t_0 = Float64(1.0 / Float64(n * x)) t_1 = Float64(Float64(log1p(x) - log(x)) / n) t_2 = x ^ Float64(Float64(1.0 / n) / 2.0) tmp = 0.0 if (Float64(1.0 / n) <= -1e-105) tmp = Float64((x ^ Float64(1.0 / n)) / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-165) tmp = t_1; elseif (Float64(1.0 / n) <= 2e-139) tmp = t_0; elseif (Float64(1.0 / n) <= 2e-96) tmp = t_1; elseif (Float64(1.0 / n) <= 5e+68) tmp = Float64(Float64(t_2 / x) * Float64(t_2 / n)); else tmp_3 = t_0 tmp_2 = Float32(tmp_3) tmp = Float64(tmp_2); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{n \cdot x}\\
t_1 := \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
t_2 := {x}^{\left(\frac{\frac{1}{n}}{2}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-105}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-165}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-139}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-96}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+68}:\\
\;\;\;\;\frac{t_2}{x} \cdot \frac{t_2}{n}\\
\mathbf{else}:\\
\;\;\;\;\langle \left( \langle \left( t_0 \right)_{\text{binary64}} \rangle_{\text{binary32}} \right)_{\text{binary32}} \rangle_{\text{binary64}}\\
\end{array}
\end{array}
if (/.f64 1 n) < -9.99999999999999965e-106Initial program 81.4%
Taylor expanded in x around inf 93.7%
log-rec93.7%
mul-1-neg93.7%
associate-*r/93.7%
neg-mul-193.7%
mul-1-neg93.7%
remove-double-neg93.7%
*-lft-identity93.7%
associate-*l/93.7%
log-pow93.7%
rem-exp-log93.7%
*-commutative93.7%
Simplified93.7%
if -9.99999999999999965e-106 < (/.f64 1 n) < 1e-165 or 2.00000000000000006e-139 < (/.f64 1 n) < 1.9999999999999998e-96Initial program 34.6%
Taylor expanded in n around inf 85.2%
log1p-def85.2%
Simplified85.2%
if 1e-165 < (/.f64 1 n) < 2.00000000000000006e-139Initial program 30.3%
Taylor expanded in x around inf 99.6%
log-rec99.6%
mul-1-neg99.6%
associate-*r/99.6%
neg-mul-199.6%
mul-1-neg99.6%
remove-double-neg99.6%
*-lft-identity99.6%
associate-*l/99.6%
log-pow99.6%
rem-exp-log99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in n around inf 99.6%
*-commutative99.6%
Simplified99.6%
if 1.9999999999999998e-96 < (/.f64 1 n) < 5.0000000000000004e68Initial program 29.6%
Taylor expanded in x around inf 67.7%
log-rec67.7%
mul-1-neg67.7%
associate-*r/67.7%
neg-mul-167.7%
mul-1-neg67.7%
remove-double-neg67.7%
*-lft-identity67.7%
associate-*l/67.7%
log-pow67.7%
rem-exp-log67.7%
*-commutative67.7%
Simplified67.7%
sqr-pow67.7%
times-frac67.8%
inv-pow67.8%
inv-pow67.8%
Applied egg-rr67.8%
unpow-167.8%
unpow-167.8%
Simplified67.8%
if 5.0000000000000004e68 < (/.f64 1 n) Initial program 51.5%
Taylor expanded in x around inf 0.8%
log-rec0.8%
mul-1-neg0.8%
associate-*r/0.8%
neg-mul-10.8%
mul-1-neg0.8%
remove-double-neg0.8%
*-lft-identity0.8%
associate-*l/0.8%
log-pow0.8%
rem-exp-log0.8%
*-commutative0.8%
Simplified0.8%
Taylor expanded in n around inf 36.4%
*-commutative36.4%
Simplified36.4%
rewrite-binary64/binary32-simplify67.7%
Applied rewrite-once67.7%
Final simplification85.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ 1.0 (* n x)))
(t_1 (pow x (/ 1.0 n)))
(t_2 (/ (- (log1p x) (log x)) n)))
(if (<= (/ 1.0 n) -1e-105)
(/ t_1 (* n x))
(if (<= (/ 1.0 n) 1e-165)
t_2
(if (<= (/ 1.0 n) 2e-139)
t_0
(if (<= (/ 1.0 n) 2e-96)
t_2
(if (<= (/ 1.0 n) 5e+48)
(* t_1 (/ (/ 1.0 n) x))
(cast
(!
:precision
binary32
(cast (! :precision binary64 t_0)))))))))))
double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double t_1 = pow(x, (1.0 / n));
double t_2 = (log1p(x) - log(x)) / n;
double tmp;
if ((1.0 / n) <= -1e-105) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= 1e-165) {
tmp = t_2;
} else if ((1.0 / n) <= 2e-139) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-96) {
tmp = t_2;
} else if ((1.0 / n) <= 5e+48) {
tmp = t_1 * ((1.0 / n) / x);
} else {
double tmp_3 = t_0;
double tmp_2 = (float) tmp_3;
tmp = (double) tmp_2;
}
return tmp;
}
function code(x, n) t_0 = Float64(1.0 / Float64(n * x)) t_1 = x ^ Float64(1.0 / n) t_2 = Float64(Float64(log1p(x) - log(x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-105) tmp = Float64(t_1 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-165) tmp = t_2; elseif (Float64(1.0 / n) <= 2e-139) tmp = t_0; elseif (Float64(1.0 / n) <= 2e-96) tmp = t_2; elseif (Float64(1.0 / n) <= 5e+48) tmp = Float64(t_1 * Float64(Float64(1.0 / n) / x)); else tmp_3 = t_0 tmp_2 = Float32(tmp_3) tmp = Float64(tmp_2); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{n \cdot x}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
t_2 := \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-105}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-165}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-139}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-96}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+48}:\\
\;\;\;\;t_1 \cdot \frac{\frac{1}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;\langle \left( \langle \left( t_0 \right)_{\text{binary64}} \rangle_{\text{binary32}} \right)_{\text{binary32}} \rangle_{\text{binary64}}\\
\end{array}
\end{array}
if (/.f64 1 n) < -9.99999999999999965e-106Initial program 81.4%
Taylor expanded in x around inf 93.7%
log-rec93.7%
mul-1-neg93.7%
associate-*r/93.7%
neg-mul-193.7%
mul-1-neg93.7%
remove-double-neg93.7%
*-lft-identity93.7%
associate-*l/93.7%
log-pow93.7%
rem-exp-log93.7%
*-commutative93.7%
Simplified93.7%
if -9.99999999999999965e-106 < (/.f64 1 n) < 1e-165 or 2.00000000000000006e-139 < (/.f64 1 n) < 1.9999999999999998e-96Initial program 34.6%
Taylor expanded in n around inf 85.2%
log1p-def85.2%
Simplified85.2%
if 1e-165 < (/.f64 1 n) < 2.00000000000000006e-139Initial program 30.3%
Taylor expanded in x around inf 99.6%
log-rec99.6%
mul-1-neg99.6%
associate-*r/99.6%
neg-mul-199.6%
mul-1-neg99.6%
remove-double-neg99.6%
*-lft-identity99.6%
associate-*l/99.6%
log-pow99.6%
rem-exp-log99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in n around inf 99.6%
*-commutative99.6%
Simplified99.6%
if 1.9999999999999998e-96 < (/.f64 1 n) < 4.99999999999999973e48Initial program 27.6%
Taylor expanded in x around inf 69.5%
log-rec69.5%
mul-1-neg69.5%
associate-*r/69.5%
neg-mul-169.5%
mul-1-neg69.5%
remove-double-neg69.5%
*-lft-identity69.5%
associate-*l/69.5%
log-pow69.5%
rem-exp-log69.5%
*-commutative69.5%
Simplified69.5%
div-inv69.5%
inv-pow69.5%
*-commutative69.5%
associate-/r*69.6%
inv-pow69.6%
Applied egg-rr69.6%
*-commutative69.6%
unpow-169.6%
unpow-169.6%
Simplified69.6%
if 4.99999999999999973e48 < (/.f64 1 n) Initial program 53.4%
Taylor expanded in x around inf 0.9%
log-rec0.9%
mul-1-neg0.9%
associate-*r/0.9%
neg-mul-10.9%
mul-1-neg0.9%
remove-double-neg0.9%
*-lft-identity0.9%
associate-*l/0.9%
log-pow0.9%
rem-exp-log0.9%
*-commutative0.9%
Simplified0.9%
Taylor expanded in n around inf 35.1%
*-commutative35.1%
Simplified35.1%
rewrite-binary64/binary32-simplify65.1%
Applied rewrite-once65.1%
Final simplification85.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log x)) n))
(t_1
(cast
(!
:precision
binary32
(cast (! :precision binary64 (/ 1.0 (* n x)))))))
(t_2 (pow x (/ 1.0 n))))
(if (<= x 2.35e-139)
(- (+ 1.0 (/ x n)) t_2)
(if (<= x 7.2e-73)
t_0
(if (<= x 3.1e-30)
t_1
(if (<= x 2.6e-20) t_0 (if (<= x 1.0) t_1 (/ t_2 (* n x)))))))))
double code(double x, double n) {
double t_0 = -log(x) / n;
double tmp_2 = 1.0 / (n * x);
double tmp_1 = (float) tmp_2;
double t_1 = (double) tmp_1;
double t_2 = pow(x, (1.0 / n));
double tmp_3;
if (x <= 2.35e-139) {
tmp_3 = (1.0 + (x / n)) - t_2;
} else if (x <= 7.2e-73) {
tmp_3 = t_0;
} else if (x <= 3.1e-30) {
tmp_3 = t_1;
} else if (x <= 2.6e-20) {
tmp_3 = t_0;
} else if (x <= 1.0) {
tmp_3 = t_1;
} else {
tmp_3 = t_2 / (n * x);
}
return tmp_3;
}
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) :: t_2
real(8) :: tmp
real(8) :: tmp_1
real(8) :: tmp_2
real(8) :: tmp_3
t_0 = -log(x) / n
tmp_2 = 1.0d0 / (n * x)
tmp_1 = real(tmp_2, 4)
t_1 = real(tmp_1, 8)
t_2 = x ** (1.0d0 / n)
if (x <= 2.35d-139) then
tmp_3 = (1.0d0 + (x / n)) - t_2
else if (x <= 7.2d-73) then
tmp_3 = t_0
else if (x <= 3.1d-30) then
tmp_3 = t_1
else if (x <= 2.6d-20) then
tmp_3 = t_0
else if (x <= 1.0d0) then
tmp_3 = t_1
else
tmp_3 = t_2 / (n * x)
end if
code = tmp_3
end function
function code(x, n) t_0 = Float64(Float64(-log(x)) / n) tmp_2 = Float64(1.0 / Float64(n * x)) tmp_1 = Float32(tmp_2) t_1 = Float64(tmp_1) t_2 = x ^ Float64(1.0 / n) tmp_3 = 0.0 if (x <= 2.35e-139) tmp_3 = Float64(Float64(1.0 + Float64(x / n)) - t_2); elseif (x <= 7.2e-73) tmp_3 = t_0; elseif (x <= 3.1e-30) tmp_3 = t_1; elseif (x <= 2.6e-20) tmp_3 = t_0; elseif (x <= 1.0) tmp_3 = t_1; else tmp_3 = Float64(t_2 / Float64(n * x)); end return tmp_3 end
function tmp_5 = code(x, n) t_0 = -log(x) / n; tmp_3 = 1.0 / (n * x); tmp_2 = single(tmp_3); t_1 = double(tmp_2); t_2 = x ^ (1.0 / n); tmp_4 = 0.0; if (x <= 2.35e-139) tmp_4 = (1.0 + (x / n)) - t_2; elseif (x <= 7.2e-73) tmp_4 = t_0; elseif (x <= 3.1e-30) tmp_4 = t_1; elseif (x <= 2.6e-20) tmp_4 = t_0; elseif (x <= 1.0) tmp_4 = t_1; else tmp_4 = t_2 / (n * x); end tmp_5 = tmp_4; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log x}{n}\\
t_1 := \langle \left( \langle \left( \frac{1}{n \cdot x} \right)_{\text{binary64}} \rangle_{\text{binary32}} \right)_{\text{binary32}} \rangle_{\text{binary64}}\\
t_2 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 2.35 \cdot 10^{-139}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_2\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{-73}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{-30}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-20}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{t_2}{n \cdot x}\\
\end{array}
\end{array}
if x < 2.35000000000000014e-139Initial program 61.5%
Taylor expanded in x around 0 61.5%
if 2.35000000000000014e-139 < x < 7.1999999999999999e-73 or 3.09999999999999991e-30 < x < 2.59999999999999995e-20Initial program 28.7%
Taylor expanded in x around 0 28.7%
*-lft-identity28.7%
associate-*l/28.8%
log-pow28.8%
rem-exp-log28.7%
Simplified28.7%
Taylor expanded in n around inf 69.2%
mul-1-neg69.2%
Simplified69.2%
if 7.1999999999999999e-73 < x < 3.09999999999999991e-30 or 2.59999999999999995e-20 < x < 1Initial program 53.0%
Taylor expanded in x around inf 40.7%
log-rec40.7%
mul-1-neg40.7%
associate-*r/40.7%
neg-mul-140.7%
mul-1-neg40.7%
remove-double-neg40.7%
*-lft-identity40.7%
associate-*l/40.7%
log-pow40.7%
rem-exp-log40.7%
*-commutative40.7%
Simplified40.7%
Taylor expanded in n around inf 13.4%
*-commutative13.4%
Simplified13.4%
rewrite-binary64/binary32-simplify66.1%
Applied rewrite-once66.1%
if 1 < x Initial program 57.9%
Taylor expanded in x around inf 99.3%
log-rec99.3%
mul-1-neg99.3%
associate-*r/99.3%
neg-mul-199.3%
mul-1-neg99.3%
remove-double-neg99.3%
*-lft-identity99.3%
associate-*l/99.3%
log-pow99.3%
rem-exp-log99.3%
*-commutative99.3%
Simplified99.3%
Final simplification81.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log x)) n)) (t_1 (/ 1.0 (* n x))) (t_2 (pow x (/ 1.0 n))))
(if (<= x 3.1e-139)
(- (+ 1.0 (/ x n)) t_2)
(if (<= x 9e-73)
t_0
(if (<= x 2.8e-31)
(cbrt (* t_1 (/ t_1 (* n x))))
(if (<= x 0.56) t_0 (/ t_2 (* n x))))))))
double code(double x, double n) {
double t_0 = -log(x) / n;
double t_1 = 1.0 / (n * x);
double t_2 = pow(x, (1.0 / n));
double tmp;
if (x <= 3.1e-139) {
tmp = (1.0 + (x / n)) - t_2;
} else if (x <= 9e-73) {
tmp = t_0;
} else if (x <= 2.8e-31) {
tmp = cbrt((t_1 * (t_1 / (n * x))));
} else if (x <= 0.56) {
tmp = t_0;
} else {
tmp = t_2 / (n * x);
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = -Math.log(x) / n;
double t_1 = 1.0 / (n * x);
double t_2 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 3.1e-139) {
tmp = (1.0 + (x / n)) - t_2;
} else if (x <= 9e-73) {
tmp = t_0;
} else if (x <= 2.8e-31) {
tmp = Math.cbrt((t_1 * (t_1 / (n * x))));
} else if (x <= 0.56) {
tmp = t_0;
} else {
tmp = t_2 / (n * x);
}
return tmp;
}
function code(x, n) t_0 = Float64(Float64(-log(x)) / n) t_1 = Float64(1.0 / Float64(n * x)) t_2 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 3.1e-139) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_2); elseif (x <= 9e-73) tmp = t_0; elseif (x <= 2.8e-31) tmp = cbrt(Float64(t_1 * Float64(t_1 / Float64(n * x)))); elseif (x <= 0.56) tmp = t_0; else tmp = Float64(t_2 / Float64(n * x)); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 3.1e-139], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision], If[LessEqual[x, 9e-73], t$95$0, If[LessEqual[x, 2.8e-31], N[Power[N[(t$95$1 * N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], If[LessEqual[x, 0.56], t$95$0, N[(t$95$2 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log x}{n}\\
t_1 := \frac{1}{n \cdot x}\\
t_2 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 3.1 \cdot 10^{-139}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_2\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-73}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-31}:\\
\;\;\;\;\sqrt[3]{t_1 \cdot \frac{t_1}{n \cdot x}}\\
\mathbf{elif}\;x \leq 0.56:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{t_2}{n \cdot x}\\
\end{array}
\end{array}
if x < 3.0999999999999999e-139Initial program 61.5%
Taylor expanded in x around 0 61.5%
if 3.0999999999999999e-139 < x < 9e-73 or 2.7999999999999999e-31 < x < 0.56000000000000005Initial program 36.4%
Taylor expanded in x around 0 27.4%
*-lft-identity27.4%
associate-*l/27.5%
log-pow27.5%
rem-exp-log27.4%
Simplified27.4%
Taylor expanded in n around inf 58.8%
mul-1-neg58.8%
Simplified58.8%
if 9e-73 < x < 2.7999999999999999e-31Initial program 49.4%
Taylor expanded in x around inf 49.9%
log-rec49.9%
mul-1-neg49.9%
associate-*r/49.9%
neg-mul-149.9%
mul-1-neg49.9%
remove-double-neg49.9%
*-lft-identity49.9%
associate-*l/49.9%
log-pow49.9%
rem-exp-log49.9%
*-commutative49.9%
Simplified49.9%
Taylor expanded in n around inf 15.7%
*-commutative15.7%
Simplified15.7%
add-cbrt-cube_binary6460.5%
Applied rewrite-once60.5%
*-commutative60.5%
associate-*l/60.5%
*-lft-identity60.5%
Simplified60.5%
if 0.56000000000000005 < x Initial program 57.9%
Taylor expanded in x around inf 99.3%
log-rec99.3%
mul-1-neg99.3%
associate-*r/99.3%
neg-mul-199.3%
mul-1-neg99.3%
remove-double-neg99.3%
*-lft-identity99.3%
associate-*l/99.3%
log-pow99.3%
rem-exp-log99.3%
*-commutative99.3%
Simplified99.3%
Final simplification79.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x 8.5e-140)
(- 1.0 t_0)
(if (<= x 0.56) (/ (- (log x)) n) (/ t_0 (* n x))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= 8.5e-140) {
tmp = 1.0 - t_0;
} else if (x <= 0.56) {
tmp = -log(x) / n;
} else {
tmp = t_0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (x <= 8.5d-140) then
tmp = 1.0d0 - t_0
else if (x <= 0.56d0) then
tmp = -log(x) / n
else
tmp = t_0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 8.5e-140) {
tmp = 1.0 - t_0;
} else if (x <= 0.56) {
tmp = -Math.log(x) / n;
} else {
tmp = t_0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if x <= 8.5e-140: tmp = 1.0 - t_0 elif x <= 0.56: tmp = -math.log(x) / n else: tmp = t_0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 8.5e-140) tmp = Float64(1.0 - t_0); elseif (x <= 0.56) tmp = Float64(Float64(-log(x)) / n); else tmp = Float64(t_0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (x <= 8.5e-140) tmp = 1.0 - t_0; elseif (x <= 0.56) tmp = -log(x) / n; else tmp = t_0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 8.5e-140], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[x, 0.56], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 8.5 \cdot 10^{-140}:\\
\;\;\;\;1 - t_0\\
\mathbf{elif}\;x \leq 0.56:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\end{array}
\end{array}
if x < 8.49999999999999997e-140Initial program 61.5%
Taylor expanded in x around 0 61.5%
*-lft-identity61.5%
associate-*l/61.5%
log-pow61.5%
rem-exp-log61.5%
Simplified61.5%
if 8.49999999999999997e-140 < x < 0.56000000000000005Initial program 40.3%
Taylor expanded in x around 0 34.0%
*-lft-identity34.0%
associate-*l/34.1%
log-pow34.1%
rem-exp-log34.0%
Simplified34.0%
Taylor expanded in n around inf 51.5%
mul-1-neg51.5%
Simplified51.5%
if 0.56000000000000005 < x Initial program 57.9%
Taylor expanded in x around inf 99.3%
log-rec99.3%
mul-1-neg99.3%
associate-*r/99.3%
neg-mul-199.3%
mul-1-neg99.3%
remove-double-neg99.3%
*-lft-identity99.3%
associate-*l/99.3%
log-pow99.3%
rem-exp-log99.3%
*-commutative99.3%
Simplified99.3%
Final simplification77.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x 6e-139)
(- (+ 1.0 (/ x n)) t_0)
(if (<= x 0.56) (/ (- (log x)) n) (/ t_0 (* n x))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= 6e-139) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 0.56) {
tmp = -log(x) / n;
} else {
tmp = t_0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (x <= 6d-139) then
tmp = (1.0d0 + (x / n)) - t_0
else if (x <= 0.56d0) then
tmp = -log(x) / n
else
tmp = t_0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 6e-139) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 0.56) {
tmp = -Math.log(x) / n;
} else {
tmp = t_0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if x <= 6e-139: tmp = (1.0 + (x / n)) - t_0 elif x <= 0.56: tmp = -math.log(x) / n else: tmp = t_0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 6e-139) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); elseif (x <= 0.56) tmp = Float64(Float64(-log(x)) / n); else tmp = Float64(t_0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (x <= 6e-139) tmp = (1.0 + (x / n)) - t_0; elseif (x <= 0.56) tmp = -log(x) / n; else tmp = t_0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 6e-139], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 0.56], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 6 \cdot 10^{-139}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{elif}\;x \leq 0.56:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\end{array}
\end{array}
if x < 5.9999999999999998e-139Initial program 61.5%
Taylor expanded in x around 0 61.5%
if 5.9999999999999998e-139 < x < 0.56000000000000005Initial program 40.3%
Taylor expanded in x around 0 34.0%
*-lft-identity34.0%
associate-*l/34.1%
log-pow34.1%
rem-exp-log34.0%
Simplified34.0%
Taylor expanded in n around inf 51.5%
mul-1-neg51.5%
Simplified51.5%
if 0.56000000000000005 < x Initial program 57.9%
Taylor expanded in x around inf 99.3%
log-rec99.3%
mul-1-neg99.3%
associate-*r/99.3%
neg-mul-199.3%
mul-1-neg99.3%
remove-double-neg99.3%
*-lft-identity99.3%
associate-*l/99.3%
log-pow99.3%
rem-exp-log99.3%
*-commutative99.3%
Simplified99.3%
Final simplification77.3%
(FPCore (x n)
:precision binary64
(if (<= x 4.5e-239)
(/ 1.0 (* n x))
(if (<= x 1.55e-9)
(/ (- (log x)) n)
(if (<= x 2.4e+237)
(+ (/ (/ 1.0 n) x) (* (+ (/ 0.5 (* n n)) (/ -0.5 n)) (/ 1.0 (* x x))))
0.0))))
double code(double x, double n) {
double tmp;
if (x <= 4.5e-239) {
tmp = 1.0 / (n * x);
} else if (x <= 1.55e-9) {
tmp = -log(x) / n;
} else if (x <= 2.4e+237) {
tmp = ((1.0 / n) / x) + (((0.5 / (n * n)) + (-0.5 / n)) * (1.0 / (x * x)));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 4.5d-239) then
tmp = 1.0d0 / (n * x)
else if (x <= 1.55d-9) then
tmp = -log(x) / n
else if (x <= 2.4d+237) then
tmp = ((1.0d0 / n) / x) + (((0.5d0 / (n * n)) + ((-0.5d0) / n)) * (1.0d0 / (x * x)))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 4.5e-239) {
tmp = 1.0 / (n * x);
} else if (x <= 1.55e-9) {
tmp = -Math.log(x) / n;
} else if (x <= 2.4e+237) {
tmp = ((1.0 / n) / x) + (((0.5 / (n * n)) + (-0.5 / n)) * (1.0 / (x * x)));
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 4.5e-239: tmp = 1.0 / (n * x) elif x <= 1.55e-9: tmp = -math.log(x) / n elif x <= 2.4e+237: tmp = ((1.0 / n) / x) + (((0.5 / (n * n)) + (-0.5 / n)) * (1.0 / (x * x))) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 4.5e-239) tmp = Float64(1.0 / Float64(n * x)); elseif (x <= 1.55e-9) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 2.4e+237) tmp = Float64(Float64(Float64(1.0 / n) / x) + Float64(Float64(Float64(0.5 / Float64(n * n)) + Float64(-0.5 / n)) * Float64(1.0 / Float64(x * x)))); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 4.5e-239) tmp = 1.0 / (n * x); elseif (x <= 1.55e-9) tmp = -log(x) / n; elseif (x <= 2.4e+237) tmp = ((1.0 / n) / x) + (((0.5 / (n * n)) + (-0.5 / n)) * (1.0 / (x * x))); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 4.5e-239], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.55e-9], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 2.4e+237], N[(N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision] + N[(N[(N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.5 \cdot 10^{-239}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-9}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+237}:\\
\;\;\;\;\frac{\frac{1}{n}}{x} + \left(\frac{0.5}{n \cdot n} + \frac{-0.5}{n}\right) \cdot \frac{1}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 4.50000000000000013e-239Initial program 75.2%
Taylor expanded in x around inf 53.3%
log-rec53.3%
mul-1-neg53.3%
associate-*r/53.3%
neg-mul-153.3%
mul-1-neg53.3%
remove-double-neg53.3%
*-lft-identity53.3%
associate-*l/53.3%
log-pow53.3%
rem-exp-log53.3%
*-commutative53.3%
Simplified53.3%
Taylor expanded in n around inf 53.8%
*-commutative53.8%
Simplified53.8%
if 4.50000000000000013e-239 < x < 1.55000000000000002e-9Initial program 45.6%
Taylor expanded in x around 0 45.5%
*-lft-identity45.5%
associate-*l/45.6%
log-pow45.6%
rem-exp-log45.6%
Simplified45.6%
Taylor expanded in n around inf 48.4%
mul-1-neg48.4%
Simplified48.4%
if 1.55000000000000002e-9 < x < 2.3999999999999999e237Initial program 45.5%
Taylor expanded in x around inf 81.6%
Simplified81.6%
Taylor expanded in n around inf 75.1%
unpow275.1%
Simplified75.1%
Taylor expanded in n around inf 70.5%
associate-/r*68.8%
Simplified70.4%
if 2.3999999999999999e237 < x Initial program 94.7%
Taylor expanded in x around inf 100.0%
log-rec100.0%
mul-1-neg100.0%
associate-*r/100.0%
neg-mul-1100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-lft-identity100.0%
associate-*l/100.0%
log-pow100.0%
rem-exp-log100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in n around inf 50.7%
associate-/r*50.7%
Simplified50.7%
Applied egg-rr94.7%
Final simplification63.4%
(FPCore (x n)
:precision binary64
(if (<= x 4.15e-140)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 1.55e-9)
(/ (- (log x)) n)
(if (<= x 2.4e+237)
(+ (/ (/ 1.0 n) x) (* (+ (/ 0.5 (* n n)) (/ -0.5 n)) (/ 1.0 (* x x))))
0.0))))
double code(double x, double n) {
double tmp;
if (x <= 4.15e-140) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 1.55e-9) {
tmp = -log(x) / n;
} else if (x <= 2.4e+237) {
tmp = ((1.0 / n) / x) + (((0.5 / (n * n)) + (-0.5 / n)) * (1.0 / (x * x)));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 4.15d-140) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 1.55d-9) then
tmp = -log(x) / n
else if (x <= 2.4d+237) then
tmp = ((1.0d0 / n) / x) + (((0.5d0 / (n * n)) + ((-0.5d0) / n)) * (1.0d0 / (x * x)))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 4.15e-140) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 1.55e-9) {
tmp = -Math.log(x) / n;
} else if (x <= 2.4e+237) {
tmp = ((1.0 / n) / x) + (((0.5 / (n * n)) + (-0.5 / n)) * (1.0 / (x * x)));
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 4.15e-140: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 1.55e-9: tmp = -math.log(x) / n elif x <= 2.4e+237: tmp = ((1.0 / n) / x) + (((0.5 / (n * n)) + (-0.5 / n)) * (1.0 / (x * x))) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 4.15e-140) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 1.55e-9) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 2.4e+237) tmp = Float64(Float64(Float64(1.0 / n) / x) + Float64(Float64(Float64(0.5 / Float64(n * n)) + Float64(-0.5 / n)) * Float64(1.0 / Float64(x * x)))); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 4.15e-140) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 1.55e-9) tmp = -log(x) / n; elseif (x <= 2.4e+237) tmp = ((1.0 / n) / x) + (((0.5 / (n * n)) + (-0.5 / n)) * (1.0 / (x * x))); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 4.15e-140], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.55e-9], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 2.4e+237], N[(N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision] + N[(N[(N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.15 \cdot 10^{-140}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-9}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+237}:\\
\;\;\;\;\frac{\frac{1}{n}}{x} + \left(\frac{0.5}{n \cdot n} + \frac{-0.5}{n}\right) \cdot \frac{1}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 4.1499999999999998e-140Initial program 61.5%
Taylor expanded in x around 0 61.5%
*-lft-identity61.5%
associate-*l/61.5%
log-pow61.5%
rem-exp-log61.5%
Simplified61.5%
if 4.1499999999999998e-140 < x < 1.55000000000000002e-9Initial program 38.0%
Taylor expanded in x around 0 38.0%
*-lft-identity38.0%
associate-*l/38.0%
log-pow38.0%
rem-exp-log38.0%
Simplified38.0%
Taylor expanded in n around inf 55.4%
mul-1-neg55.4%
Simplified55.4%
if 1.55000000000000002e-9 < x < 2.3999999999999999e237Initial program 45.5%
Taylor expanded in x around inf 81.6%
Simplified81.6%
Taylor expanded in n around inf 75.1%
unpow275.1%
Simplified75.1%
Taylor expanded in n around inf 70.5%
associate-/r*68.8%
Simplified70.4%
if 2.3999999999999999e237 < x Initial program 94.7%
Taylor expanded in x around inf 100.0%
log-rec100.0%
mul-1-neg100.0%
associate-*r/100.0%
neg-mul-1100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-lft-identity100.0%
associate-*l/100.0%
log-pow100.0%
rem-exp-log100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in n around inf 50.7%
associate-/r*50.7%
Simplified50.7%
Applied egg-rr94.7%
Final simplification67.9%
(FPCore (x n) :precision binary64 (if (<= x 3.25e+237) (/ 1.0 (* n x)) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 3.25e+237) {
tmp = 1.0 / (n * x);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 3.25d+237) then
tmp = 1.0d0 / (n * x)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 3.25e+237) {
tmp = 1.0 / (n * x);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 3.25e+237: tmp = 1.0 / (n * x) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 3.25e+237) tmp = Float64(1.0 / Float64(n * x)); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 3.25e+237) tmp = 1.0 / (n * x); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 3.25e+237], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.25 \cdot 10^{+237}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 3.2499999999999999e237Initial program 48.6%
Taylor expanded in x around inf 62.3%
log-rec62.3%
mul-1-neg62.3%
associate-*r/62.3%
neg-mul-162.3%
mul-1-neg62.3%
remove-double-neg62.3%
*-lft-identity62.3%
associate-*l/62.3%
log-pow62.3%
rem-exp-log62.3%
*-commutative62.3%
Simplified62.3%
Taylor expanded in n around inf 46.3%
*-commutative46.3%
Simplified46.3%
if 3.2499999999999999e237 < x Initial program 94.7%
Taylor expanded in x around inf 100.0%
log-rec100.0%
mul-1-neg100.0%
associate-*r/100.0%
neg-mul-1100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-lft-identity100.0%
associate-*l/100.0%
log-pow100.0%
rem-exp-log100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in n around inf 50.7%
associate-/r*50.7%
Simplified50.7%
Applied egg-rr94.7%
Final simplification52.5%
(FPCore (x n) :precision binary64 0.0)
double code(double x, double n) {
return 0.0;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 0.0d0
end function
public static double code(double x, double n) {
return 0.0;
}
def code(x, n): return 0.0
function code(x, n) return 0.0 end
function tmp = code(x, n) tmp = 0.0; end
code[x_, n_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 54.5%
Taylor expanded in x around inf 67.2%
log-rec67.2%
mul-1-neg67.2%
associate-*r/67.2%
neg-mul-167.2%
mul-1-neg67.2%
remove-double-neg67.2%
*-lft-identity67.2%
associate-*l/67.2%
log-pow67.2%
rem-exp-log67.2%
*-commutative67.2%
Simplified67.2%
Taylor expanded in n around inf 46.9%
associate-/r*46.9%
Simplified46.9%
Applied egg-rr29.6%
Final simplification29.6%
herbie shell --seed 2023297
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))