
(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 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (exp (/ (log x) n))))
(if (<= (/ 1.0 n) -4e-12)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 5e-36)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 100000.0)
(+
(* (/ t_1 (pow x 2.0)) (+ (/ 0.5 (pow n 2.0)) (/ -0.5 n)))
(+
(/ t_1 (* n x))
(*
(/ t_1 (pow x 3.0))
(+
(/ 0.16666666666666666 (pow n 3.0))
(+ (/ 0.3333333333333333 n) (/ -0.5 (pow n 2.0)))))))
(- (exp (/ x n)) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = exp((log(x) / n));
double tmp;
if ((1.0 / n) <= -4e-12) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-36) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = ((t_1 / pow(x, 2.0)) * ((0.5 / pow(n, 2.0)) + (-0.5 / n))) + ((t_1 / (n * x)) + ((t_1 / pow(x, 3.0)) * ((0.16666666666666666 / pow(n, 3.0)) + ((0.3333333333333333 / n) + (-0.5 / pow(n, 2.0))))));
} else {
tmp = exp((x / n)) - t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = exp((log(x) / n))
if ((1.0d0 / n) <= (-4d-12)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 5d-36) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 100000.0d0) then
tmp = ((t_1 / (x ** 2.0d0)) * ((0.5d0 / (n ** 2.0d0)) + ((-0.5d0) / n))) + ((t_1 / (n * x)) + ((t_1 / (x ** 3.0d0)) * ((0.16666666666666666d0 / (n ** 3.0d0)) + ((0.3333333333333333d0 / n) + ((-0.5d0) / (n ** 2.0d0))))))
else
tmp = exp((x / n)) - t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.exp((Math.log(x) / n));
double tmp;
if ((1.0 / n) <= -4e-12) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-36) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = ((t_1 / Math.pow(x, 2.0)) * ((0.5 / Math.pow(n, 2.0)) + (-0.5 / n))) + ((t_1 / (n * x)) + ((t_1 / Math.pow(x, 3.0)) * ((0.16666666666666666 / Math.pow(n, 3.0)) + ((0.3333333333333333 / n) + (-0.5 / Math.pow(n, 2.0))))));
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.exp((math.log(x) / n)) tmp = 0 if (1.0 / n) <= -4e-12: tmp = t_0 / (n * x) elif (1.0 / n) <= 5e-36: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 100000.0: tmp = ((t_1 / math.pow(x, 2.0)) * ((0.5 / math.pow(n, 2.0)) + (-0.5 / n))) + ((t_1 / (n * x)) + ((t_1 / math.pow(x, 3.0)) * ((0.16666666666666666 / math.pow(n, 3.0)) + ((0.3333333333333333 / n) + (-0.5 / math.pow(n, 2.0)))))) else: tmp = math.exp((x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = exp(Float64(log(x) / n)) tmp = 0.0 if (Float64(1.0 / n) <= -4e-12) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 5e-36) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 100000.0) tmp = Float64(Float64(Float64(t_1 / (x ^ 2.0)) * Float64(Float64(0.5 / (n ^ 2.0)) + Float64(-0.5 / n))) + Float64(Float64(t_1 / Float64(n * x)) + Float64(Float64(t_1 / (x ^ 3.0)) * Float64(Float64(0.16666666666666666 / (n ^ 3.0)) + Float64(Float64(0.3333333333333333 / n) + Float64(-0.5 / (n ^ 2.0))))))); else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = exp((log(x) / n)); tmp = 0.0; if ((1.0 / n) <= -4e-12) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 5e-36) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 100000.0) tmp = ((t_1 / (x ^ 2.0)) * ((0.5 / (n ^ 2.0)) + (-0.5 / n))) + ((t_1 / (n * x)) + ((t_1 / (x ^ 3.0)) * ((0.16666666666666666 / (n ^ 3.0)) + ((0.3333333333333333 / n) + (-0.5 / (n ^ 2.0)))))); else tmp = exp((x / n)) - t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-12], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-36], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 100000.0], N[(N[(N[(t$95$1 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] * N[(N[(0.16666666666666666 / N[Power[n, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.3333333333333333 / n), $MachinePrecision] + N[(-0.5 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := e^{\frac{\log x}{n}}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-12}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-36}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 100000:\\
\;\;\;\;\frac{t\_1}{{x}^{2}} \cdot \left(\frac{0.5}{{n}^{2}} + \frac{-0.5}{n}\right) + \left(\frac{t\_1}{n \cdot x} + \frac{t\_1}{{x}^{3}} \cdot \left(\frac{0.16666666666666666}{{n}^{3}} + \left(\frac{0.3333333333333333}{n} + \frac{-0.5}{{n}^{2}}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -3.99999999999999992e-12Initial program 96.1%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
*-rgt-identity100.0%
associate-*l/100.0%
associate-*r/100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -3.99999999999999992e-12 < (/.f64 1 n) < 5.00000000000000004e-36Initial program 39.4%
Taylor expanded in n around inf 81.5%
log1p-def81.5%
Simplified81.5%
log1p-udef81.5%
diff-log81.8%
+-commutative81.8%
Applied egg-rr81.8%
if 5.00000000000000004e-36 < (/.f64 1 n) < 1e5Initial program 17.5%
Taylor expanded in x around inf 71.5%
Simplified71.5%
if 1e5 < (/.f64 1 n) Initial program 42.2%
Taylor expanded in n around 0 42.2%
log1p-def100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
Final simplification88.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (exp (/ (log x) n))) (t_1 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-12)
(/ t_1 (* n x))
(if (<= (/ 1.0 n) 5e-36)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 3e-15)
(+
(/ t_0 (* n x))
(/ t_0 (/ (pow x 2.0) (+ (/ 0.5 (pow n 2.0)) (/ -0.5 n)))))
(log (exp (- (exp (/ (log1p x) n)) t_1))))))))
double code(double x, double n) {
double t_0 = exp((log(x) / n));
double t_1 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-12) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= 5e-36) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 3e-15) {
tmp = (t_0 / (n * x)) + (t_0 / (pow(x, 2.0) / ((0.5 / pow(n, 2.0)) + (-0.5 / n))));
} else {
tmp = log(exp((exp((log1p(x) / n)) - t_1)));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.exp((Math.log(x) / n));
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-12) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= 5e-36) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 3e-15) {
tmp = (t_0 / (n * x)) + (t_0 / (Math.pow(x, 2.0) / ((0.5 / Math.pow(n, 2.0)) + (-0.5 / n))));
} else {
tmp = Math.log(Math.exp((Math.exp((Math.log1p(x) / n)) - t_1)));
}
return tmp;
}
def code(x, n): t_0 = math.exp((math.log(x) / n)) t_1 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -4e-12: tmp = t_1 / (n * x) elif (1.0 / n) <= 5e-36: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 3e-15: tmp = (t_0 / (n * x)) + (t_0 / (math.pow(x, 2.0) / ((0.5 / math.pow(n, 2.0)) + (-0.5 / n)))) else: tmp = math.log(math.exp((math.exp((math.log1p(x) / n)) - t_1))) return tmp
function code(x, n) t_0 = exp(Float64(log(x) / n)) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-12) tmp = Float64(t_1 / Float64(n * x)); elseif (Float64(1.0 / n) <= 5e-36) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 3e-15) tmp = Float64(Float64(t_0 / Float64(n * x)) + Float64(t_0 / Float64((x ^ 2.0) / Float64(Float64(0.5 / (n ^ 2.0)) + Float64(-0.5 / n))))); else tmp = log(exp(Float64(exp(Float64(log1p(x) / n)) - t_1))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-12], N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-36], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 3e-15], N[(N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 / N[(N[Power[x, 2.0], $MachinePrecision] / N[(N[(0.5 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[N[Exp[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\frac{\log x}{n}}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-12}:\\
\;\;\;\;\frac{t\_1}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-36}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 3 \cdot 10^{-15}:\\
\;\;\;\;\frac{t\_0}{n \cdot x} + \frac{t\_0}{\frac{{x}^{2}}{\frac{0.5}{{n}^{2}} + \frac{-0.5}{n}}}\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_1}\right)\\
\end{array}
\end{array}
if (/.f64 1 n) < -3.99999999999999992e-12Initial program 96.1%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
*-rgt-identity100.0%
associate-*l/100.0%
associate-*r/100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -3.99999999999999992e-12 < (/.f64 1 n) < 5.00000000000000004e-36Initial program 39.4%
Taylor expanded in n around inf 81.5%
log1p-def81.5%
Simplified81.5%
log1p-udef81.5%
diff-log81.8%
+-commutative81.8%
Applied egg-rr81.8%
if 5.00000000000000004e-36 < (/.f64 1 n) < 3e-15Initial program 5.1%
Taylor expanded in x around inf 88.4%
mul-1-neg88.4%
log-rec88.4%
mul-1-neg88.4%
distribute-neg-frac88.4%
mul-1-neg88.4%
remove-double-neg88.4%
*-commutative88.4%
associate-/l*88.4%
Simplified88.4%
if 3e-15 < (/.f64 1 n) Initial program 41.9%
add-log-exp42.0%
add-exp-log42.0%
log-pow42.0%
+-commutative42.0%
log1p-udef92.4%
*-commutative92.4%
un-div-inv92.4%
Applied egg-rr92.4%
Final simplification88.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-12)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-77)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 100000.0)
(* (/ 1.0 x) (/ t_0 n))
(if (<= (/ 1.0 n) 2e+93)
(- (+ 1.0 (/ x n)) t_0)
(sqrt (pow (* n x) -2.0))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-12) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-77) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = (1.0 / x) * (t_0 / n);
} else if ((1.0 / n) <= 2e+93) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = sqrt(pow((n * x), -2.0));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-4d-12)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 2d-77) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 100000.0d0) then
tmp = (1.0d0 / x) * (t_0 / n)
else if ((1.0d0 / n) <= 2d+93) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = sqrt(((n * x) ** (-2.0d0)))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-12) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-77) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = (1.0 / x) * (t_0 / n);
} else if ((1.0 / n) <= 2e+93) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = Math.sqrt(Math.pow((n * x), -2.0));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -4e-12: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-77: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 100000.0: tmp = (1.0 / x) * (t_0 / n) elif (1.0 / n) <= 2e+93: tmp = (1.0 + (x / n)) - t_0 else: tmp = math.sqrt(math.pow((n * x), -2.0)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-12) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-77) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 100000.0) tmp = Float64(Float64(1.0 / x) * Float64(t_0 / n)); elseif (Float64(1.0 / n) <= 2e+93) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = sqrt((Float64(n * x) ^ -2.0)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -4e-12) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 2e-77) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 100000.0) tmp = (1.0 / x) * (t_0 / n); elseif ((1.0 / n) <= 2e+93) tmp = (1.0 + (x / n)) - t_0; else tmp = sqrt(((n * x) ^ -2.0)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-12], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-77], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 100000.0], N[(N[(1.0 / x), $MachinePrecision] * N[(t$95$0 / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+93], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[Sqrt[N[Power[N[(n * x), $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-12}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-77}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 100000:\\
\;\;\;\;\frac{1}{x} \cdot \frac{t\_0}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+93}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{\left(n \cdot x\right)}^{-2}}\\
\end{array}
\end{array}
if (/.f64 1 n) < -3.99999999999999992e-12Initial program 96.1%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
*-rgt-identity100.0%
associate-*l/100.0%
associate-*r/100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -3.99999999999999992e-12 < (/.f64 1 n) < 1.9999999999999999e-77Initial program 41.1%
Taylor expanded in n around inf 82.8%
log1p-def82.8%
Simplified82.8%
log1p-udef82.8%
diff-log83.1%
+-commutative83.1%
Applied egg-rr83.1%
if 1.9999999999999999e-77 < (/.f64 1 n) < 1e5Initial program 13.5%
Taylor expanded in x around inf 65.7%
mul-1-neg65.7%
log-rec65.7%
mul-1-neg65.7%
distribute-neg-frac65.7%
mul-1-neg65.7%
remove-double-neg65.7%
*-commutative65.7%
Simplified65.7%
div-inv65.7%
pow-to-exp65.7%
*-un-lft-identity65.7%
times-frac65.7%
Applied egg-rr65.7%
if 1e5 < (/.f64 1 n) < 2.00000000000000009e93Initial program 91.2%
Taylor expanded in x around 0 91.2%
if 2.00000000000000009e93 < (/.f64 1 n) Initial program 18.8%
Taylor expanded in x around inf 0.8%
mul-1-neg0.8%
log-rec0.8%
mul-1-neg0.8%
distribute-neg-frac0.8%
mul-1-neg0.8%
remove-double-neg0.8%
*-commutative0.8%
Simplified0.8%
Taylor expanded in n around inf 46.5%
*-commutative46.5%
Simplified46.5%
add-sqr-sqrt46.5%
sqrt-unprod83.2%
inv-pow83.2%
inv-pow83.2%
pow-prod-up83.2%
metadata-eval83.2%
Applied egg-rr83.2%
Final simplification86.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-12)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-77)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 100000.0)
(* (/ 1.0 x) (/ t_0 n))
(- (exp (/ x n)) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-12) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-77) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = (1.0 / x) * (t_0 / n);
} else {
tmp = exp((x / n)) - t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-4d-12)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 2d-77) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 100000.0d0) then
tmp = (1.0d0 / x) * (t_0 / n)
else
tmp = exp((x / n)) - t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-12) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-77) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = (1.0 / x) * (t_0 / n);
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -4e-12: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-77: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 100000.0: tmp = (1.0 / x) * (t_0 / n) else: tmp = math.exp((x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-12) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-77) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 100000.0) tmp = Float64(Float64(1.0 / x) * Float64(t_0 / n)); else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -4e-12) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 2e-77) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 100000.0) tmp = (1.0 / x) * (t_0 / n); else tmp = exp((x / n)) - t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-12], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-77], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 100000.0], N[(N[(1.0 / x), $MachinePrecision] * N[(t$95$0 / n), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-12}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-77}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 100000:\\
\;\;\;\;\frac{1}{x} \cdot \frac{t\_0}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -3.99999999999999992e-12Initial program 96.1%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
*-rgt-identity100.0%
associate-*l/100.0%
associate-*r/100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -3.99999999999999992e-12 < (/.f64 1 n) < 1.9999999999999999e-77Initial program 41.1%
Taylor expanded in n around inf 82.8%
log1p-def82.8%
Simplified82.8%
log1p-udef82.8%
diff-log83.1%
+-commutative83.1%
Applied egg-rr83.1%
if 1.9999999999999999e-77 < (/.f64 1 n) < 1e5Initial program 13.5%
Taylor expanded in x around inf 65.7%
mul-1-neg65.7%
log-rec65.7%
mul-1-neg65.7%
distribute-neg-frac65.7%
mul-1-neg65.7%
remove-double-neg65.7%
*-commutative65.7%
Simplified65.7%
div-inv65.7%
pow-to-exp65.7%
*-un-lft-identity65.7%
times-frac65.7%
Applied egg-rr65.7%
if 1e5 < (/.f64 1 n) Initial program 42.2%
Taylor expanded in n around 0 42.2%
log1p-def100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
Final simplification88.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ 1.0 (* n (+ (+ 1.0 x) -1.0))))
(t_1 (- 1.0 (pow x (/ 1.0 n))))
(t_2 (/ (log (/ (+ 1.0 x) x)) n)))
(if (<= (/ 1.0 n) -5e+42)
t_1
(if (<= (/ 1.0 n) -1e+14)
t_2
(if (<= (/ 1.0 n) -4e-12)
t_0
(if (<= (/ 1.0 n) 2e-77)
t_2
(if (<= (/ 1.0 n) 3e-15)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 2e+93) t_1 t_0))))))))
double code(double x, double n) {
double t_0 = 1.0 / (n * ((1.0 + x) + -1.0));
double t_1 = 1.0 - pow(x, (1.0 / n));
double t_2 = log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e+42) {
tmp = t_1;
} else if ((1.0 / n) <= -1e+14) {
tmp = t_2;
} else if ((1.0 / n) <= -4e-12) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-77) {
tmp = t_2;
} else if ((1.0 / n) <= 3e-15) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e+93) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 1.0d0 / (n * ((1.0d0 + x) + (-1.0d0)))
t_1 = 1.0d0 - (x ** (1.0d0 / n))
t_2 = log(((1.0d0 + x) / x)) / n
if ((1.0d0 / n) <= (-5d+42)) then
tmp = t_1
else if ((1.0d0 / n) <= (-1d+14)) then
tmp = t_2
else if ((1.0d0 / n) <= (-4d-12)) then
tmp = t_0
else if ((1.0d0 / n) <= 2d-77) then
tmp = t_2
else if ((1.0d0 / n) <= 3d-15) then
tmp = (1.0d0 / x) / n
else if ((1.0d0 / n) <= 2d+93) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 / (n * ((1.0 + x) + -1.0));
double t_1 = 1.0 - Math.pow(x, (1.0 / n));
double t_2 = Math.log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e+42) {
tmp = t_1;
} else if ((1.0 / n) <= -1e+14) {
tmp = t_2;
} else if ((1.0 / n) <= -4e-12) {
tmp = t_0;
} else if ((1.0 / n) <= 2e-77) {
tmp = t_2;
} else if ((1.0 / n) <= 3e-15) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e+93) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = 1.0 / (n * ((1.0 + x) + -1.0)) t_1 = 1.0 - math.pow(x, (1.0 / n)) t_2 = math.log(((1.0 + x) / x)) / n tmp = 0 if (1.0 / n) <= -5e+42: tmp = t_1 elif (1.0 / n) <= -1e+14: tmp = t_2 elif (1.0 / n) <= -4e-12: tmp = t_0 elif (1.0 / n) <= 2e-77: tmp = t_2 elif (1.0 / n) <= 3e-15: tmp = (1.0 / x) / n elif (1.0 / n) <= 2e+93: tmp = t_1 else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(1.0 / Float64(n * Float64(Float64(1.0 + x) + -1.0))) t_1 = Float64(1.0 - (x ^ Float64(1.0 / n))) t_2 = Float64(log(Float64(Float64(1.0 + x) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e+42) tmp = t_1; elseif (Float64(1.0 / n) <= -1e+14) tmp = t_2; elseif (Float64(1.0 / n) <= -4e-12) tmp = t_0; elseif (Float64(1.0 / n) <= 2e-77) tmp = t_2; elseif (Float64(1.0 / n) <= 3e-15) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 2e+93) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 / (n * ((1.0 + x) + -1.0)); t_1 = 1.0 - (x ^ (1.0 / n)); t_2 = log(((1.0 + x) / x)) / n; tmp = 0.0; if ((1.0 / n) <= -5e+42) tmp = t_1; elseif ((1.0 / n) <= -1e+14) tmp = t_2; elseif ((1.0 / n) <= -4e-12) tmp = t_0; elseif ((1.0 / n) <= 2e-77) tmp = t_2; elseif ((1.0 / n) <= 3e-15) tmp = (1.0 / x) / n; elseif ((1.0 / n) <= 2e+93) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 / N[(n * N[(N[(1.0 + x), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e+42], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+14], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-12], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-77], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], 3e-15], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+93], t$95$1, t$95$0]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{n \cdot \left(\left(1 + x\right) + -1\right)}\\
t_1 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
t_2 := \frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{+42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{+14}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\frac{1}{n} \leq -4 \cdot 10^{-12}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-77}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\frac{1}{n} \leq 3 \cdot 10^{-15}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+93}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000007e42 or 3e-15 < (/.f64 1 n) < 2.00000000000000009e93Initial program 94.7%
Taylor expanded in x around 0 63.7%
if -5.00000000000000007e42 < (/.f64 1 n) < -1e14 or -3.99999999999999992e-12 < (/.f64 1 n) < 1.9999999999999999e-77Initial program 44.1%
Taylor expanded in n around inf 83.0%
log1p-def83.0%
Simplified83.0%
log1p-udef83.0%
diff-log83.3%
+-commutative83.3%
Applied egg-rr83.3%
if -1e14 < (/.f64 1 n) < -3.99999999999999992e-12 or 2.00000000000000009e93 < (/.f64 1 n) Initial program 25.8%
Taylor expanded in x around inf 21.3%
mul-1-neg21.3%
log-rec21.3%
mul-1-neg21.3%
distribute-neg-frac21.3%
mul-1-neg21.3%
remove-double-neg21.3%
*-commutative21.3%
Simplified21.3%
Taylor expanded in n around inf 42.4%
*-commutative42.4%
Simplified42.4%
expm1-log1p-u42.4%
expm1-udef77.7%
log1p-udef77.7%
rem-exp-log77.7%
+-commutative77.7%
Applied egg-rr77.7%
if 1.9999999999999999e-77 < (/.f64 1 n) < 3e-15Initial program 4.7%
Taylor expanded in n around inf 32.6%
log1p-def32.6%
Simplified32.6%
Taylor expanded in x around inf 70.6%
Final simplification76.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-12)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-77)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 100000.0)
(* (/ 1.0 x) (/ t_0 n))
(if (<= (/ 1.0 n) 2e+93)
(- (+ 1.0 (/ x n)) t_0)
(/ 1.0 (* n (+ (+ 1.0 x) -1.0)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-12) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-77) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = (1.0 / x) * (t_0 / n);
} else if ((1.0 / n) <= 2e+93) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (n * ((1.0 + x) + -1.0));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-4d-12)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 2d-77) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 100000.0d0) then
tmp = (1.0d0 / x) * (t_0 / n)
else if ((1.0d0 / n) <= 2d+93) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = 1.0d0 / (n * ((1.0d0 + x) + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-12) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-77) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = (1.0 / x) * (t_0 / n);
} else if ((1.0 / n) <= 2e+93) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (n * ((1.0 + x) + -1.0));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -4e-12: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-77: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 100000.0: tmp = (1.0 / x) * (t_0 / n) elif (1.0 / n) <= 2e+93: tmp = (1.0 + (x / n)) - t_0 else: tmp = 1.0 / (n * ((1.0 + x) + -1.0)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-12) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-77) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 100000.0) tmp = Float64(Float64(1.0 / x) * Float64(t_0 / n)); elseif (Float64(1.0 / n) <= 2e+93) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(1.0 / Float64(n * Float64(Float64(1.0 + x) + -1.0))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -4e-12) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 2e-77) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 100000.0) tmp = (1.0 / x) * (t_0 / n); elseif ((1.0 / n) <= 2e+93) tmp = (1.0 + (x / n)) - t_0; else tmp = 1.0 / (n * ((1.0 + x) + -1.0)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-12], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-77], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 100000.0], N[(N[(1.0 / x), $MachinePrecision] * N[(t$95$0 / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+93], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 / N[(n * N[(N[(1.0 + x), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-12}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-77}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 100000:\\
\;\;\;\;\frac{1}{x} \cdot \frac{t\_0}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+93}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot \left(\left(1 + x\right) + -1\right)}\\
\end{array}
\end{array}
if (/.f64 1 n) < -3.99999999999999992e-12Initial program 96.1%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
*-rgt-identity100.0%
associate-*l/100.0%
associate-*r/100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -3.99999999999999992e-12 < (/.f64 1 n) < 1.9999999999999999e-77Initial program 41.1%
Taylor expanded in n around inf 82.8%
log1p-def82.8%
Simplified82.8%
log1p-udef82.8%
diff-log83.1%
+-commutative83.1%
Applied egg-rr83.1%
if 1.9999999999999999e-77 < (/.f64 1 n) < 1e5Initial program 13.5%
Taylor expanded in x around inf 65.7%
mul-1-neg65.7%
log-rec65.7%
mul-1-neg65.7%
distribute-neg-frac65.7%
mul-1-neg65.7%
remove-double-neg65.7%
*-commutative65.7%
Simplified65.7%
div-inv65.7%
pow-to-exp65.7%
*-un-lft-identity65.7%
times-frac65.7%
Applied egg-rr65.7%
if 1e5 < (/.f64 1 n) < 2.00000000000000009e93Initial program 91.2%
Taylor expanded in x around 0 91.2%
if 2.00000000000000009e93 < (/.f64 1 n) Initial program 18.8%
Taylor expanded in x around inf 0.8%
mul-1-neg0.8%
log-rec0.8%
mul-1-neg0.8%
distribute-neg-frac0.8%
mul-1-neg0.8%
remove-double-neg0.8%
*-commutative0.8%
Simplified0.8%
Taylor expanded in n around inf 46.5%
*-commutative46.5%
Simplified46.5%
expm1-log1p-u46.5%
expm1-udef79.2%
log1p-udef79.2%
rem-exp-log79.2%
+-commutative79.2%
Applied egg-rr79.2%
Final simplification86.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (- (log x)) n)))
(if (<= x 2.65e-275)
t_0
(if (<= x 2.8e-223)
t_1
(if (<= x 8e-218)
t_0
(if (<= x 4.8e-111)
t_1
(if (<= x 2.8e-87)
t_0
(if (<= x 7.4e-60)
t_1
(if (<= x 1.08e+216)
(/ (/ 1.0 (+ (+ 1.0 x) -1.0)) n)
0.0)))))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double t_1 = -log(x) / n;
double tmp;
if (x <= 2.65e-275) {
tmp = t_0;
} else if (x <= 2.8e-223) {
tmp = t_1;
} else if (x <= 8e-218) {
tmp = t_0;
} else if (x <= 4.8e-111) {
tmp = t_1;
} else if (x <= 2.8e-87) {
tmp = t_0;
} else if (x <= 7.4e-60) {
tmp = t_1;
} else if (x <= 1.08e+216) {
tmp = (1.0 / ((1.0 + x) + -1.0)) / n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
t_1 = -log(x) / n
if (x <= 2.65d-275) then
tmp = t_0
else if (x <= 2.8d-223) then
tmp = t_1
else if (x <= 8d-218) then
tmp = t_0
else if (x <= 4.8d-111) then
tmp = t_1
else if (x <= 2.8d-87) then
tmp = t_0
else if (x <= 7.4d-60) then
tmp = t_1
else if (x <= 1.08d+216) then
tmp = (1.0d0 / ((1.0d0 + x) + (-1.0d0))) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double t_1 = -Math.log(x) / n;
double tmp;
if (x <= 2.65e-275) {
tmp = t_0;
} else if (x <= 2.8e-223) {
tmp = t_1;
} else if (x <= 8e-218) {
tmp = t_0;
} else if (x <= 4.8e-111) {
tmp = t_1;
} else if (x <= 2.8e-87) {
tmp = t_0;
} else if (x <= 7.4e-60) {
tmp = t_1;
} else if (x <= 1.08e+216) {
tmp = (1.0 / ((1.0 + x) + -1.0)) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) t_1 = -math.log(x) / n tmp = 0 if x <= 2.65e-275: tmp = t_0 elif x <= 2.8e-223: tmp = t_1 elif x <= 8e-218: tmp = t_0 elif x <= 4.8e-111: tmp = t_1 elif x <= 2.8e-87: tmp = t_0 elif x <= 7.4e-60: tmp = t_1 elif x <= 1.08e+216: tmp = (1.0 / ((1.0 + x) + -1.0)) / n else: tmp = 0.0 return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) t_1 = Float64(Float64(-log(x)) / n) tmp = 0.0 if (x <= 2.65e-275) tmp = t_0; elseif (x <= 2.8e-223) tmp = t_1; elseif (x <= 8e-218) tmp = t_0; elseif (x <= 4.8e-111) tmp = t_1; elseif (x <= 2.8e-87) tmp = t_0; elseif (x <= 7.4e-60) tmp = t_1; elseif (x <= 1.08e+216) tmp = Float64(Float64(1.0 / Float64(Float64(1.0 + x) + -1.0)) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); t_1 = -log(x) / n; tmp = 0.0; if (x <= 2.65e-275) tmp = t_0; elseif (x <= 2.8e-223) tmp = t_1; elseif (x <= 8e-218) tmp = t_0; elseif (x <= 4.8e-111) tmp = t_1; elseif (x <= 2.8e-87) tmp = t_0; elseif (x <= 7.4e-60) tmp = t_1; elseif (x <= 1.08e+216) tmp = (1.0 / ((1.0 + x) + -1.0)) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[x, 2.65e-275], t$95$0, If[LessEqual[x, 2.8e-223], t$95$1, If[LessEqual[x, 8e-218], t$95$0, If[LessEqual[x, 4.8e-111], t$95$1, If[LessEqual[x, 2.8e-87], t$95$0, If[LessEqual[x, 7.4e-60], t$95$1, If[LessEqual[x, 1.08e+216], N[(N[(1.0 / N[(N[(1.0 + x), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{-\log x}{n}\\
\mathbf{if}\;x \leq 2.65 \cdot 10^{-275}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-223}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-218}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-111}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-87}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 7.4 \cdot 10^{-60}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.08 \cdot 10^{+216}:\\
\;\;\;\;\frac{\frac{1}{\left(1 + x\right) + -1}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.64999999999999993e-275 or 2.80000000000000015e-223 < x < 8.0000000000000003e-218 or 4.8000000000000001e-111 < x < 2.8000000000000001e-87Initial program 85.4%
Taylor expanded in x around 0 85.4%
if 2.64999999999999993e-275 < x < 2.80000000000000015e-223 or 8.0000000000000003e-218 < x < 4.8000000000000001e-111 or 2.8000000000000001e-87 < x < 7.4000000000000005e-60Initial program 34.4%
Taylor expanded in x around 0 34.4%
Taylor expanded in n around inf 60.9%
neg-mul-160.9%
distribute-neg-frac60.9%
Simplified60.9%
if 7.4000000000000005e-60 < x < 1.08e216Initial program 50.0%
Taylor expanded in n around inf 48.6%
log1p-def48.6%
Simplified48.6%
Taylor expanded in x around inf 59.2%
expm1-log1p-u56.6%
expm1-udef67.0%
log1p-udef67.0%
rem-exp-log69.0%
+-commutative69.0%
Applied egg-rr69.5%
if 1.08e216 < x Initial program 93.0%
add-log-exp93.0%
add-exp-log93.0%
log-pow93.0%
+-commutative93.0%
log1p-udef93.0%
*-commutative93.0%
un-div-inv93.0%
Applied egg-rr93.0%
Taylor expanded in x around inf 93.0%
Final simplification71.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (/ t_0 n) x)))
(if (<= (/ 1.0 n) -4e-12)
t_1
(if (<= (/ 1.0 n) 2e-77)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 100000.0)
t_1
(if (<= (/ 1.0 n) 2e+93)
(- 1.0 t_0)
(/ 1.0 (* n (+ (+ 1.0 x) -1.0)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = (t_0 / n) / x;
double tmp;
if ((1.0 / n) <= -4e-12) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-77) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = t_1;
} else if ((1.0 / n) <= 2e+93) {
tmp = 1.0 - t_0;
} else {
tmp = 1.0 / (n * ((1.0 + x) + -1.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 = (t_0 / n) / x
if ((1.0d0 / n) <= (-4d-12)) then
tmp = t_1
else if ((1.0d0 / n) <= 2d-77) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 100000.0d0) then
tmp = t_1
else if ((1.0d0 / n) <= 2d+93) then
tmp = 1.0d0 - t_0
else
tmp = 1.0d0 / (n * ((1.0d0 + x) + (-1.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 = (t_0 / n) / x;
double tmp;
if ((1.0 / n) <= -4e-12) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-77) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = t_1;
} else if ((1.0 / n) <= 2e+93) {
tmp = 1.0 - t_0;
} else {
tmp = 1.0 / (n * ((1.0 + x) + -1.0));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = (t_0 / n) / x tmp = 0 if (1.0 / n) <= -4e-12: tmp = t_1 elif (1.0 / n) <= 2e-77: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 100000.0: tmp = t_1 elif (1.0 / n) <= 2e+93: tmp = 1.0 - t_0 else: tmp = 1.0 / (n * ((1.0 + x) + -1.0)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(t_0 / n) / x) tmp = 0.0 if (Float64(1.0 / n) <= -4e-12) tmp = t_1; elseif (Float64(1.0 / n) <= 2e-77) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 100000.0) tmp = t_1; elseif (Float64(1.0 / n) <= 2e+93) tmp = Float64(1.0 - t_0); else tmp = Float64(1.0 / Float64(n * Float64(Float64(1.0 + x) + -1.0))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = (t_0 / n) / x; tmp = 0.0; if ((1.0 / n) <= -4e-12) tmp = t_1; elseif ((1.0 / n) <= 2e-77) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 100000.0) tmp = t_1; elseif ((1.0 / n) <= 2e+93) tmp = 1.0 - t_0; else tmp = 1.0 / (n * ((1.0 + x) + -1.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[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-12], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-77], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 100000.0], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+93], N[(1.0 - t$95$0), $MachinePrecision], N[(1.0 / N[(n * N[(N[(1.0 + x), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\frac{t\_0}{n}}{x}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-12}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-77}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 100000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+93}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot \left(\left(1 + x\right) + -1\right)}\\
\end{array}
\end{array}
if (/.f64 1 n) < -3.99999999999999992e-12 or 1.9999999999999999e-77 < (/.f64 1 n) < 1e5Initial program 78.1%
Taylor expanded in x around inf 92.5%
mul-1-neg92.5%
log-rec92.5%
mul-1-neg92.5%
distribute-neg-frac92.5%
mul-1-neg92.5%
remove-double-neg92.5%
*-commutative92.5%
Simplified92.5%
div-inv92.5%
pow-to-exp92.5%
*-un-lft-identity92.5%
times-frac92.6%
Applied egg-rr92.6%
associate-*l/92.5%
*-un-lft-identity92.5%
Applied egg-rr92.5%
if -3.99999999999999992e-12 < (/.f64 1 n) < 1.9999999999999999e-77Initial program 41.1%
Taylor expanded in n around inf 82.8%
log1p-def82.8%
Simplified82.8%
log1p-udef82.8%
diff-log83.1%
+-commutative83.1%
Applied egg-rr83.1%
if 1e5 < (/.f64 1 n) < 2.00000000000000009e93Initial program 91.2%
Taylor expanded in x around 0 91.2%
if 2.00000000000000009e93 < (/.f64 1 n) Initial program 18.8%
Taylor expanded in x around inf 0.8%
mul-1-neg0.8%
log-rec0.8%
mul-1-neg0.8%
distribute-neg-frac0.8%
mul-1-neg0.8%
remove-double-neg0.8%
*-commutative0.8%
Simplified0.8%
Taylor expanded in n around inf 46.5%
*-commutative46.5%
Simplified46.5%
expm1-log1p-u46.5%
expm1-udef79.2%
log1p-udef79.2%
rem-exp-log79.2%
+-commutative79.2%
Applied egg-rr79.2%
Final simplification86.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-12)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-77)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 100000.0)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 2e+93)
(- 1.0 t_0)
(/ 1.0 (* n (+ (+ 1.0 x) -1.0)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-12) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-77) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e+93) {
tmp = 1.0 - t_0;
} else {
tmp = 1.0 / (n * ((1.0 + x) + -1.0));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-4d-12)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 2d-77) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 100000.0d0) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 2d+93) then
tmp = 1.0d0 - t_0
else
tmp = 1.0d0 / (n * ((1.0d0 + x) + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-12) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-77) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 2e+93) {
tmp = 1.0 - t_0;
} else {
tmp = 1.0 / (n * ((1.0 + x) + -1.0));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -4e-12: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-77: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 100000.0: tmp = (t_0 / n) / x elif (1.0 / n) <= 2e+93: tmp = 1.0 - t_0 else: tmp = 1.0 / (n * ((1.0 + x) + -1.0)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-12) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-77) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 100000.0) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 2e+93) tmp = Float64(1.0 - t_0); else tmp = Float64(1.0 / Float64(n * Float64(Float64(1.0 + x) + -1.0))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -4e-12) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 2e-77) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 100000.0) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 2e+93) tmp = 1.0 - t_0; else tmp = 1.0 / (n * ((1.0 + x) + -1.0)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-12], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-77], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 100000.0], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+93], N[(1.0 - t$95$0), $MachinePrecision], N[(1.0 / N[(n * N[(N[(1.0 + x), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-12}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-77}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 100000:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+93}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot \left(\left(1 + x\right) + -1\right)}\\
\end{array}
\end{array}
if (/.f64 1 n) < -3.99999999999999992e-12Initial program 96.1%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
*-rgt-identity100.0%
associate-*l/100.0%
associate-*r/100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -3.99999999999999992e-12 < (/.f64 1 n) < 1.9999999999999999e-77Initial program 41.1%
Taylor expanded in n around inf 82.8%
log1p-def82.8%
Simplified82.8%
log1p-udef82.8%
diff-log83.1%
+-commutative83.1%
Applied egg-rr83.1%
if 1.9999999999999999e-77 < (/.f64 1 n) < 1e5Initial program 13.5%
Taylor expanded in x around inf 65.7%
mul-1-neg65.7%
log-rec65.7%
mul-1-neg65.7%
distribute-neg-frac65.7%
mul-1-neg65.7%
remove-double-neg65.7%
*-commutative65.7%
Simplified65.7%
div-inv65.7%
pow-to-exp65.7%
*-un-lft-identity65.7%
times-frac65.7%
Applied egg-rr65.7%
associate-*l/65.7%
*-un-lft-identity65.7%
Applied egg-rr65.7%
if 1e5 < (/.f64 1 n) < 2.00000000000000009e93Initial program 91.2%
Taylor expanded in x around 0 91.2%
if 2.00000000000000009e93 < (/.f64 1 n) Initial program 18.8%
Taylor expanded in x around inf 0.8%
mul-1-neg0.8%
log-rec0.8%
mul-1-neg0.8%
distribute-neg-frac0.8%
mul-1-neg0.8%
remove-double-neg0.8%
*-commutative0.8%
Simplified0.8%
Taylor expanded in n around inf 46.5%
*-commutative46.5%
Simplified46.5%
expm1-log1p-u46.5%
expm1-udef79.2%
log1p-udef79.2%
rem-exp-log79.2%
+-commutative79.2%
Applied egg-rr79.2%
Final simplification86.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-12)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-77)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 100000.0)
(* (/ 1.0 x) (/ t_0 n))
(if (<= (/ 1.0 n) 2e+93)
(- 1.0 t_0)
(/ 1.0 (* n (+ (+ 1.0 x) -1.0)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-12) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-77) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = (1.0 / x) * (t_0 / n);
} else if ((1.0 / n) <= 2e+93) {
tmp = 1.0 - t_0;
} else {
tmp = 1.0 / (n * ((1.0 + x) + -1.0));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-4d-12)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 2d-77) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 100000.0d0) then
tmp = (1.0d0 / x) * (t_0 / n)
else if ((1.0d0 / n) <= 2d+93) then
tmp = 1.0d0 - t_0
else
tmp = 1.0d0 / (n * ((1.0d0 + x) + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-12) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-77) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = (1.0 / x) * (t_0 / n);
} else if ((1.0 / n) <= 2e+93) {
tmp = 1.0 - t_0;
} else {
tmp = 1.0 / (n * ((1.0 + x) + -1.0));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -4e-12: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-77: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 100000.0: tmp = (1.0 / x) * (t_0 / n) elif (1.0 / n) <= 2e+93: tmp = 1.0 - t_0 else: tmp = 1.0 / (n * ((1.0 + x) + -1.0)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-12) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-77) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 100000.0) tmp = Float64(Float64(1.0 / x) * Float64(t_0 / n)); elseif (Float64(1.0 / n) <= 2e+93) tmp = Float64(1.0 - t_0); else tmp = Float64(1.0 / Float64(n * Float64(Float64(1.0 + x) + -1.0))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -4e-12) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 2e-77) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 100000.0) tmp = (1.0 / x) * (t_0 / n); elseif ((1.0 / n) <= 2e+93) tmp = 1.0 - t_0; else tmp = 1.0 / (n * ((1.0 + x) + -1.0)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-12], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-77], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 100000.0], N[(N[(1.0 / x), $MachinePrecision] * N[(t$95$0 / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+93], N[(1.0 - t$95$0), $MachinePrecision], N[(1.0 / N[(n * N[(N[(1.0 + x), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-12}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-77}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 100000:\\
\;\;\;\;\frac{1}{x} \cdot \frac{t\_0}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+93}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot \left(\left(1 + x\right) + -1\right)}\\
\end{array}
\end{array}
if (/.f64 1 n) < -3.99999999999999992e-12Initial program 96.1%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
*-rgt-identity100.0%
associate-*l/100.0%
associate-*r/100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -3.99999999999999992e-12 < (/.f64 1 n) < 1.9999999999999999e-77Initial program 41.1%
Taylor expanded in n around inf 82.8%
log1p-def82.8%
Simplified82.8%
log1p-udef82.8%
diff-log83.1%
+-commutative83.1%
Applied egg-rr83.1%
if 1.9999999999999999e-77 < (/.f64 1 n) < 1e5Initial program 13.5%
Taylor expanded in x around inf 65.7%
mul-1-neg65.7%
log-rec65.7%
mul-1-neg65.7%
distribute-neg-frac65.7%
mul-1-neg65.7%
remove-double-neg65.7%
*-commutative65.7%
Simplified65.7%
div-inv65.7%
pow-to-exp65.7%
*-un-lft-identity65.7%
times-frac65.7%
Applied egg-rr65.7%
if 1e5 < (/.f64 1 n) < 2.00000000000000009e93Initial program 91.2%
Taylor expanded in x around 0 91.2%
if 2.00000000000000009e93 < (/.f64 1 n) Initial program 18.8%
Taylor expanded in x around inf 0.8%
mul-1-neg0.8%
log-rec0.8%
mul-1-neg0.8%
distribute-neg-frac0.8%
mul-1-neg0.8%
remove-double-neg0.8%
*-commutative0.8%
Simplified0.8%
Taylor expanded in n around inf 46.5%
*-commutative46.5%
Simplified46.5%
expm1-log1p-u46.5%
expm1-udef79.2%
log1p-udef79.2%
rem-exp-log79.2%
+-commutative79.2%
Applied egg-rr79.2%
Final simplification86.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (+ (+ 1.0 x) -1.0)) (t_1 (/ (- (log x)) n)))
(if (<= x 6.3e-109)
t_1
(if (<= x 1e-82)
(/ 1.0 (* n t_0))
(if (<= x 8.8e-60) t_1 (if (<= x 2.2e+216) (/ (/ 1.0 t_0) n) 0.0))))))
double code(double x, double n) {
double t_0 = (1.0 + x) + -1.0;
double t_1 = -log(x) / n;
double tmp;
if (x <= 6.3e-109) {
tmp = t_1;
} else if (x <= 1e-82) {
tmp = 1.0 / (n * t_0);
} else if (x <= 8.8e-60) {
tmp = t_1;
} else if (x <= 2.2e+216) {
tmp = (1.0 / t_0) / n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (1.0d0 + x) + (-1.0d0)
t_1 = -log(x) / n
if (x <= 6.3d-109) then
tmp = t_1
else if (x <= 1d-82) then
tmp = 1.0d0 / (n * t_0)
else if (x <= 8.8d-60) then
tmp = t_1
else if (x <= 2.2d+216) then
tmp = (1.0d0 / t_0) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = (1.0 + x) + -1.0;
double t_1 = -Math.log(x) / n;
double tmp;
if (x <= 6.3e-109) {
tmp = t_1;
} else if (x <= 1e-82) {
tmp = 1.0 / (n * t_0);
} else if (x <= 8.8e-60) {
tmp = t_1;
} else if (x <= 2.2e+216) {
tmp = (1.0 / t_0) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): t_0 = (1.0 + x) + -1.0 t_1 = -math.log(x) / n tmp = 0 if x <= 6.3e-109: tmp = t_1 elif x <= 1e-82: tmp = 1.0 / (n * t_0) elif x <= 8.8e-60: tmp = t_1 elif x <= 2.2e+216: tmp = (1.0 / t_0) / n else: tmp = 0.0 return tmp
function code(x, n) t_0 = Float64(Float64(1.0 + x) + -1.0) t_1 = Float64(Float64(-log(x)) / n) tmp = 0.0 if (x <= 6.3e-109) tmp = t_1; elseif (x <= 1e-82) tmp = Float64(1.0 / Float64(n * t_0)); elseif (x <= 8.8e-60) tmp = t_1; elseif (x <= 2.2e+216) tmp = Float64(Float64(1.0 / t_0) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) t_0 = (1.0 + x) + -1.0; t_1 = -log(x) / n; tmp = 0.0; if (x <= 6.3e-109) tmp = t_1; elseif (x <= 1e-82) tmp = 1.0 / (n * t_0); elseif (x <= 8.8e-60) tmp = t_1; elseif (x <= 2.2e+216) tmp = (1.0 / t_0) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(1.0 + x), $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[x, 6.3e-109], t$95$1, If[LessEqual[x, 1e-82], N[(1.0 / N[(n * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.8e-60], t$95$1, If[LessEqual[x, 2.2e+216], N[(N[(1.0 / t$95$0), $MachinePrecision] / n), $MachinePrecision], 0.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 + x\right) + -1\\
t_1 := \frac{-\log x}{n}\\
\mathbf{if}\;x \leq 6.3 \cdot 10^{-109}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 10^{-82}:\\
\;\;\;\;\frac{1}{n \cdot t\_0}\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{-60}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+216}:\\
\;\;\;\;\frac{\frac{1}{t\_0}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 6.3000000000000001e-109 or 1e-82 < x < 8.7999999999999995e-60Initial program 42.8%
Taylor expanded in x around 0 42.8%
Taylor expanded in n around inf 55.4%
neg-mul-155.4%
distribute-neg-frac55.4%
Simplified55.4%
if 6.3000000000000001e-109 < x < 1e-82Initial program 83.9%
Taylor expanded in x around inf 67.2%
mul-1-neg67.2%
log-rec67.2%
mul-1-neg67.2%
distribute-neg-frac67.2%
mul-1-neg67.2%
remove-double-neg67.2%
*-commutative67.2%
Simplified67.2%
Taylor expanded in n around inf 37.6%
*-commutative37.6%
Simplified37.6%
expm1-log1p-u37.6%
expm1-udef83.9%
log1p-udef83.9%
rem-exp-log83.9%
+-commutative83.9%
Applied egg-rr83.9%
if 8.7999999999999995e-60 < x < 2.2e216Initial program 50.0%
Taylor expanded in n around inf 48.6%
log1p-def48.6%
Simplified48.6%
Taylor expanded in x around inf 59.2%
expm1-log1p-u56.6%
expm1-udef67.0%
log1p-udef67.0%
rem-exp-log69.0%
+-commutative69.0%
Applied egg-rr69.5%
if 2.2e216 < x Initial program 93.0%
add-log-exp93.0%
add-exp-log93.0%
log-pow93.0%
+-commutative93.0%
log1p-udef93.0%
*-commutative93.0%
un-div-inv93.0%
Applied egg-rr93.0%
Taylor expanded in x around inf 93.0%
Final simplification67.7%
(FPCore (x n) :precision binary64 (if (<= x 8.2e+215) (/ (/ 1.0 (+ (+ 1.0 x) -1.0)) n) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 8.2e+215) {
tmp = (1.0 / ((1.0 + x) + -1.0)) / n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 8.2d+215) then
tmp = (1.0d0 / ((1.0d0 + x) + (-1.0d0))) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 8.2e+215) {
tmp = (1.0 / ((1.0 + x) + -1.0)) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 8.2e+215: tmp = (1.0 / ((1.0 + x) + -1.0)) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 8.2e+215) tmp = Float64(Float64(1.0 / Float64(Float64(1.0 + x) + -1.0)) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 8.2e+215) tmp = (1.0 / ((1.0 + x) + -1.0)) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 8.2e+215], N[(N[(1.0 / N[(N[(1.0 + x), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.2 \cdot 10^{+215}:\\
\;\;\;\;\frac{\frac{1}{\left(1 + x\right) + -1}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 8.2000000000000007e215Initial program 47.4%
Taylor expanded in n around inf 50.7%
log1p-def50.7%
Simplified50.7%
Taylor expanded in x around inf 41.8%
expm1-log1p-u40.6%
expm1-udef52.3%
log1p-udef52.3%
rem-exp-log53.3%
+-commutative53.3%
Applied egg-rr53.6%
if 8.2000000000000007e215 < x Initial program 93.0%
add-log-exp93.0%
add-exp-log93.0%
log-pow93.0%
+-commutative93.0%
log1p-udef93.0%
*-commutative93.0%
un-div-inv93.0%
Applied egg-rr93.0%
Taylor expanded in x around inf 93.0%
Final simplification59.7%
(FPCore (x n) :precision binary64 (/ 1.0 (* n (+ (+ 1.0 x) -1.0))))
double code(double x, double n) {
return 1.0 / (n * ((1.0 + x) + -1.0));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 1.0d0 / (n * ((1.0d0 + x) + (-1.0d0)))
end function
public static double code(double x, double n) {
return 1.0 / (n * ((1.0 + x) + -1.0));
}
def code(x, n): return 1.0 / (n * ((1.0 + x) + -1.0))
function code(x, n) return Float64(1.0 / Float64(n * Float64(Float64(1.0 + x) + -1.0))) end
function tmp = code(x, n) tmp = 1.0 / (n * ((1.0 + x) + -1.0)); end
code[x_, n_] := N[(1.0 / N[(n * N[(N[(1.0 + x), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{n \cdot \left(\left(1 + x\right) + -1\right)}
\end{array}
Initial program 54.5%
Taylor expanded in x around inf 62.6%
mul-1-neg62.6%
log-rec62.6%
mul-1-neg62.6%
distribute-neg-frac62.6%
mul-1-neg62.6%
remove-double-neg62.6%
*-commutative62.6%
Simplified62.6%
Taylor expanded in n around inf 46.8%
*-commutative46.8%
Simplified46.8%
expm1-log1p-u46.0%
expm1-udef55.8%
log1p-udef55.8%
rem-exp-log56.7%
+-commutative56.7%
Applied egg-rr56.7%
Final simplification56.7%
(FPCore (x n) :precision binary64 (/ (/ 1.0 (+ (+ 1.0 x) -1.0)) n))
double code(double x, double n) {
return (1.0 / ((1.0 + x) + -1.0)) / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / ((1.0d0 + x) + (-1.0d0))) / n
end function
public static double code(double x, double n) {
return (1.0 / ((1.0 + x) + -1.0)) / n;
}
def code(x, n): return (1.0 / ((1.0 + x) + -1.0)) / n
function code(x, n) return Float64(Float64(1.0 / Float64(Float64(1.0 + x) + -1.0)) / n) end
function tmp = code(x, n) tmp = (1.0 / ((1.0 + x) + -1.0)) / n; end
code[x_, n_] := N[(N[(1.0 / N[(N[(1.0 + x), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{\left(1 + x\right) + -1}}{n}
\end{array}
Initial program 54.5%
Taylor expanded in n around inf 57.3%
log1p-def57.3%
Simplified57.3%
Taylor expanded in x around inf 47.0%
expm1-log1p-u46.0%
expm1-udef55.8%
log1p-udef55.8%
rem-exp-log56.7%
+-commutative56.7%
Applied egg-rr56.9%
Final simplification56.9%
(FPCore (x n) :precision binary64 (/ 1.0 (* n x)))
double code(double x, double n) {
return 1.0 / (n * x);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 1.0d0 / (n * x)
end function
public static double code(double x, double n) {
return 1.0 / (n * x);
}
def code(x, n): return 1.0 / (n * x)
function code(x, n) return Float64(1.0 / Float64(n * x)) end
function tmp = code(x, n) tmp = 1.0 / (n * x); end
code[x_, n_] := N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{n \cdot x}
\end{array}
Initial program 54.5%
Taylor expanded in x around inf 62.6%
mul-1-neg62.6%
log-rec62.6%
mul-1-neg62.6%
distribute-neg-frac62.6%
mul-1-neg62.6%
remove-double-neg62.6%
*-commutative62.6%
Simplified62.6%
Taylor expanded in n around inf 46.8%
*-commutative46.8%
Simplified46.8%
Final simplification46.8%
(FPCore (x n) :precision binary64 (/ (/ 1.0 n) x))
double code(double x, double n) {
return (1.0 / n) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / n) / x
end function
public static double code(double x, double n) {
return (1.0 / n) / x;
}
def code(x, n): return (1.0 / n) / x
function code(x, n) return Float64(Float64(1.0 / n) / x) end
function tmp = code(x, n) tmp = (1.0 / n) / x; end
code[x_, n_] := N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n}}{x}
\end{array}
Initial program 54.5%
Taylor expanded in x around inf 62.6%
mul-1-neg62.6%
log-rec62.6%
mul-1-neg62.6%
distribute-neg-frac62.6%
mul-1-neg62.6%
remove-double-neg62.6%
*-commutative62.6%
Simplified62.6%
Taylor expanded in n around inf 46.8%
*-commutative46.8%
Simplified46.8%
add-sqr-sqrt32.0%
pow232.0%
inv-pow32.0%
sqrt-pow132.0%
metadata-eval32.0%
Applied egg-rr32.0%
pow-pow46.8%
metadata-eval46.8%
inv-pow46.8%
*-commutative46.8%
associate-/r*47.0%
Applied egg-rr47.0%
Final simplification47.0%
(FPCore (x n) :precision binary64 (/ x n))
double code(double x, double n) {
return x / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = x / n
end function
public static double code(double x, double n) {
return x / n;
}
def code(x, n): return x / n
function code(x, n) return Float64(x / n) end
function tmp = code(x, n) tmp = x / n; end
code[x_, n_] := N[(x / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{n}
\end{array}
Initial program 54.5%
Taylor expanded in n around inf 57.3%
log1p-def57.3%
Simplified57.3%
Taylor expanded in x around 0 27.3%
neg-mul-127.3%
unsub-neg27.3%
Simplified27.3%
Taylor expanded in x around inf 4.4%
Final simplification4.4%
herbie shell --seed 2024101
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))