
(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))))
(if (<= (/ 1.0 n) -6e-23)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-10)
(+
(/ (- (log1p x) (log x)) n)
(*
0.5
(-
(/ (pow (log1p x) 2.0) (pow n 2.0))
(/ (pow (log x) 2.0) (pow n 2.0)))))
(- (exp (/ (log1p x) n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -6e-23) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-10) {
tmp = ((log1p(x) - log(x)) / n) + (0.5 * ((pow(log1p(x), 2.0) / pow(n, 2.0)) - (pow(log(x), 2.0) / pow(n, 2.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 tmp;
if ((1.0 / n) <= -6e-23) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-10) {
tmp = ((Math.log1p(x) - Math.log(x)) / n) + (0.5 * ((Math.pow(Math.log1p(x), 2.0) / Math.pow(n, 2.0)) - (Math.pow(Math.log(x), 2.0) / Math.pow(n, 2.0))));
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -6e-23: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-10: tmp = ((math.log1p(x) - math.log(x)) / n) + (0.5 * ((math.pow(math.log1p(x), 2.0) / math.pow(n, 2.0)) - (math.pow(math.log(x), 2.0) / math.pow(n, 2.0)))) else: tmp = math.exp((math.log1p(x) / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -6e-23) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-10) tmp = Float64(Float64(Float64(log1p(x) - log(x)) / n) + Float64(0.5 * Float64(Float64((log1p(x) ^ 2.0) / (n ^ 2.0)) - Float64((log(x) ^ 2.0) / (n ^ 2.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]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -6e-23], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-10], N[(N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(0.5 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision] - N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -6 \cdot 10^{-23}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n} + 0.5 \cdot \left(\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{{n}^{2}} - \frac{{\log x}^{2}}{{n}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -6.00000000000000006e-23Initial program 95.9%
Taylor expanded in x around inf 97.8%
mul-1-neg97.8%
log-rec97.8%
mul-1-neg97.8%
distribute-neg-frac97.8%
mul-1-neg97.8%
remove-double-neg97.8%
*-commutative97.8%
Simplified97.8%
Taylor expanded in x around inf 97.8%
mul-1-neg97.8%
log-rec97.8%
*-rgt-identity97.8%
associate-*r/97.8%
distribute-lft-neg-in97.8%
remove-double-neg97.8%
exp-to-pow97.9%
Simplified97.9%
if -6.00000000000000006e-23 < (/.f64 1 n) < 2.00000000000000007e-10Initial program 26.8%
Taylor expanded in n around inf 81.4%
associate--l+76.2%
+-commutative76.2%
associate--r+81.4%
div-sub81.5%
remove-double-neg81.5%
mul-1-neg81.5%
distribute-lft-out--81.5%
distribute-neg-frac81.5%
mul-1-neg81.5%
Simplified81.5%
if 2.00000000000000007e-10 < (/.f64 1 n) Initial program 45.1%
Taylor expanded in n around 0 45.1%
log1p-def97.5%
Simplified97.5%
Final simplification89.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-11)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-11)
(/ (- (log (/ x (+ 1.0 x)))) n)
(log (exp (- (exp (/ (log1p x) n)) t_0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = -log((x / (1.0 + x))) / n;
} else {
tmp = log(exp((exp((log1p(x) / n)) - t_0)));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = -Math.log((x / (1.0 + x))) / n;
} else {
tmp = Math.log(Math.exp((Math.exp((Math.log1p(x) / n)) - t_0)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-11: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-11: tmp = -math.log((x / (1.0 + x))) / n else: tmp = math.log(math.exp((math.exp((math.log1p(x) / n)) - t_0))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-11) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-11) tmp = Float64(Float64(-log(Float64(x / Float64(1.0 + x)))) / n); else tmp = log(exp(Float64(exp(Float64(log1p(x) / n)) - t_0))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-11], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-11], N[((-N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision], N[Log[N[Exp[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-11}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\frac{-\log \left(\frac{x}{1 + x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0}\right)\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000018e-11Initial program 97.8%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
*-rgt-identity98.9%
associate-*r/98.9%
distribute-lft-neg-in98.9%
remove-double-neg98.9%
exp-to-pow98.9%
Simplified98.9%
if -5.00000000000000018e-11 < (/.f64 1 n) < 1.99999999999999988e-11Initial program 26.3%
Taylor expanded in n around inf 80.6%
+-rgt-identity80.6%
+-rgt-identity80.6%
log1p-def80.6%
Simplified80.6%
log1p-udef80.6%
diff-log80.7%
+-commutative80.7%
Applied egg-rr80.7%
clear-num80.7%
log-rec80.7%
Applied egg-rr80.7%
if 1.99999999999999988e-11 < (/.f64 1 n) Initial program 45.6%
add-log-exp45.7%
add-exp-log45.7%
log-pow45.7%
+-commutative45.7%
log1p-udef96.7%
*-commutative96.7%
un-div-inv96.7%
Applied egg-rr96.7%
Final simplification89.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-11)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-11)
(/ (- (log (/ x (+ 1.0 x)))) n)
(- (exp (/ (log1p x) n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = -log((x / (1.0 + x))) / n;
} else {
tmp = exp((log1p(x) / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = -Math.log((x / (1.0 + x))) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-11: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-11: tmp = -math.log((x / (1.0 + x))) / n else: tmp = math.exp((math.log1p(x) / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-11) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-11) tmp = Float64(Float64(-log(Float64(x / Float64(1.0 + x)))) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-11], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-11], N[((-N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-11}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\frac{-\log \left(\frac{x}{1 + x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000018e-11Initial program 97.8%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
*-rgt-identity98.9%
associate-*r/98.9%
distribute-lft-neg-in98.9%
remove-double-neg98.9%
exp-to-pow98.9%
Simplified98.9%
if -5.00000000000000018e-11 < (/.f64 1 n) < 1.99999999999999988e-11Initial program 26.3%
Taylor expanded in n around inf 80.6%
+-rgt-identity80.6%
+-rgt-identity80.6%
log1p-def80.6%
Simplified80.6%
log1p-udef80.6%
diff-log80.7%
+-commutative80.7%
Applied egg-rr80.7%
clear-num80.7%
log-rec80.7%
Applied egg-rr80.7%
if 1.99999999999999988e-11 < (/.f64 1 n) Initial program 45.6%
Taylor expanded in n around 0 45.6%
log1p-def96.6%
Simplified96.6%
Final simplification89.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-11)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-11)
(/ (- (log (/ x (+ 1.0 x)))) n)
(if (<= (/ 1.0 n) 5e+125)
(- (+ 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) <= -5e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = -log((x / (1.0 + x))) / n;
} else if ((1.0 / n) <= 5e+125) {
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) <= (-5d-11)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 2d-11) then
tmp = -log((x / (1.0d0 + x))) / n
else if ((1.0d0 / n) <= 5d+125) 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) <= -5e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = -Math.log((x / (1.0 + x))) / n;
} else if ((1.0 / n) <= 5e+125) {
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) <= -5e-11: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-11: tmp = -math.log((x / (1.0 + x))) / n elif (1.0 / n) <= 5e+125: 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) <= -5e-11) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-11) tmp = Float64(Float64(-log(Float64(x / Float64(1.0 + x)))) / n); elseif (Float64(1.0 / n) <= 5e+125) 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) <= -5e-11) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 2e-11) tmp = -log((x / (1.0 + x))) / n; elseif ((1.0 / n) <= 5e+125) 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], -5e-11], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-11], N[((-N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+125], 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 -5 \cdot 10^{-11}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\frac{-\log \left(\frac{x}{1 + x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+125}:\\
\;\;\;\;\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) < -5.00000000000000018e-11Initial program 97.8%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
*-rgt-identity98.9%
associate-*r/98.9%
distribute-lft-neg-in98.9%
remove-double-neg98.9%
exp-to-pow98.9%
Simplified98.9%
if -5.00000000000000018e-11 < (/.f64 1 n) < 1.99999999999999988e-11Initial program 26.3%
Taylor expanded in n around inf 80.6%
+-rgt-identity80.6%
+-rgt-identity80.6%
log1p-def80.6%
Simplified80.6%
log1p-udef80.6%
diff-log80.7%
+-commutative80.7%
Applied egg-rr80.7%
clear-num80.7%
log-rec80.7%
Applied egg-rr80.7%
if 1.99999999999999988e-11 < (/.f64 1 n) < 4.99999999999999962e125Initial program 73.8%
Taylor expanded in x around 0 74.2%
if 4.99999999999999962e125 < (/.f64 1 n) Initial program 18.8%
Taylor expanded in n around inf 7.8%
+-rgt-identity7.8%
+-rgt-identity7.8%
log1p-def7.8%
Simplified7.8%
Taylor expanded in x around inf 62.2%
add-sqr-sqrt62.2%
sqrt-unprod85.5%
inv-pow85.5%
inv-pow85.5%
pow-prod-up85.5%
*-commutative85.5%
metadata-eval85.5%
Applied egg-rr85.5%
Final simplification86.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-11)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-11)
(/ (- (log (/ x (+ 1.0 x)))) n)
(- (exp (/ x n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = -log((x / (1.0 + x))) / n;
} else {
tmp = exp((x / n)) - t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-5d-11)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 2d-11) then
tmp = -log((x / (1.0d0 + x))) / n
else
tmp = exp((x / n)) - t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = -Math.log((x / (1.0 + x))) / n;
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-11: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-11: tmp = -math.log((x / (1.0 + x))) / n else: tmp = math.exp((x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-11) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-11) tmp = Float64(Float64(-log(Float64(x / Float64(1.0 + x)))) / n); else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -5e-11) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 2e-11) tmp = -log((x / (1.0 + x))) / n; else tmp = exp((x / n)) - t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-11], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-11], N[((-N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-11}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\frac{-\log \left(\frac{x}{1 + x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000018e-11Initial program 97.8%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
*-rgt-identity98.9%
associate-*r/98.9%
distribute-lft-neg-in98.9%
remove-double-neg98.9%
exp-to-pow98.9%
Simplified98.9%
if -5.00000000000000018e-11 < (/.f64 1 n) < 1.99999999999999988e-11Initial program 26.3%
Taylor expanded in n around inf 80.6%
+-rgt-identity80.6%
+-rgt-identity80.6%
log1p-def80.6%
Simplified80.6%
log1p-udef80.6%
diff-log80.7%
+-commutative80.7%
Applied egg-rr80.7%
clear-num80.7%
log-rec80.7%
Applied egg-rr80.7%
if 1.99999999999999988e-11 < (/.f64 1 n) Initial program 45.6%
Taylor expanded in n around 0 45.6%
log1p-def96.6%
Simplified96.6%
Taylor expanded in x around 0 96.6%
Final simplification89.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (- (log x)) n)))
(if (<= x 4e-272)
t_0
(if (<= x 1.1e-241)
t_1
(if (<= x 1.04e-232)
(/ 1.0 (* n x))
(if (<= x 2.5e-196)
(* (log x) (/ 1.0 (- n)))
(if (<= x 6e-167)
t_0
(if (<= x 3.1e-103)
t_1
(if (<= x 3.9e-75)
t_0
(if (<= x 2.6e-35) t_1 (if (<= x 1.0) t_0 (/ 0.0 n))))))))))))
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 <= 4e-272) {
tmp = t_0;
} else if (x <= 1.1e-241) {
tmp = t_1;
} else if (x <= 1.04e-232) {
tmp = 1.0 / (n * x);
} else if (x <= 2.5e-196) {
tmp = log(x) * (1.0 / -n);
} else if (x <= 6e-167) {
tmp = t_0;
} else if (x <= 3.1e-103) {
tmp = t_1;
} else if (x <= 3.9e-75) {
tmp = t_0;
} else if (x <= 2.6e-35) {
tmp = t_1;
} else if (x <= 1.0) {
tmp = t_0;
} else {
tmp = 0.0 / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
t_1 = -log(x) / n
if (x <= 4d-272) then
tmp = t_0
else if (x <= 1.1d-241) then
tmp = t_1
else if (x <= 1.04d-232) then
tmp = 1.0d0 / (n * x)
else if (x <= 2.5d-196) then
tmp = log(x) * (1.0d0 / -n)
else if (x <= 6d-167) then
tmp = t_0
else if (x <= 3.1d-103) then
tmp = t_1
else if (x <= 3.9d-75) then
tmp = t_0
else if (x <= 2.6d-35) then
tmp = t_1
else if (x <= 1.0d0) then
tmp = t_0
else
tmp = 0.0d0 / n
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 <= 4e-272) {
tmp = t_0;
} else if (x <= 1.1e-241) {
tmp = t_1;
} else if (x <= 1.04e-232) {
tmp = 1.0 / (n * x);
} else if (x <= 2.5e-196) {
tmp = Math.log(x) * (1.0 / -n);
} else if (x <= 6e-167) {
tmp = t_0;
} else if (x <= 3.1e-103) {
tmp = t_1;
} else if (x <= 3.9e-75) {
tmp = t_0;
} else if (x <= 2.6e-35) {
tmp = t_1;
} else if (x <= 1.0) {
tmp = t_0;
} else {
tmp = 0.0 / n;
}
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 <= 4e-272: tmp = t_0 elif x <= 1.1e-241: tmp = t_1 elif x <= 1.04e-232: tmp = 1.0 / (n * x) elif x <= 2.5e-196: tmp = math.log(x) * (1.0 / -n) elif x <= 6e-167: tmp = t_0 elif x <= 3.1e-103: tmp = t_1 elif x <= 3.9e-75: tmp = t_0 elif x <= 2.6e-35: tmp = t_1 elif x <= 1.0: tmp = t_0 else: tmp = 0.0 / n 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 <= 4e-272) tmp = t_0; elseif (x <= 1.1e-241) tmp = t_1; elseif (x <= 1.04e-232) tmp = Float64(1.0 / Float64(n * x)); elseif (x <= 2.5e-196) tmp = Float64(log(x) * Float64(1.0 / Float64(-n))); elseif (x <= 6e-167) tmp = t_0; elseif (x <= 3.1e-103) tmp = t_1; elseif (x <= 3.9e-75) tmp = t_0; elseif (x <= 2.6e-35) tmp = t_1; elseif (x <= 1.0) tmp = t_0; else tmp = Float64(0.0 / n); 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 <= 4e-272) tmp = t_0; elseif (x <= 1.1e-241) tmp = t_1; elseif (x <= 1.04e-232) tmp = 1.0 / (n * x); elseif (x <= 2.5e-196) tmp = log(x) * (1.0 / -n); elseif (x <= 6e-167) tmp = t_0; elseif (x <= 3.1e-103) tmp = t_1; elseif (x <= 3.9e-75) tmp = t_0; elseif (x <= 2.6e-35) tmp = t_1; elseif (x <= 1.0) tmp = t_0; else tmp = 0.0 / n; 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, 4e-272], t$95$0, If[LessEqual[x, 1.1e-241], t$95$1, If[LessEqual[x, 1.04e-232], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.5e-196], N[(N[Log[x], $MachinePrecision] * N[(1.0 / (-n)), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6e-167], t$95$0, If[LessEqual[x, 3.1e-103], t$95$1, If[LessEqual[x, 3.9e-75], t$95$0, If[LessEqual[x, 2.6e-35], t$95$1, If[LessEqual[x, 1.0], t$95$0, N[(0.0 / n), $MachinePrecision]]]]]]]]]]]]
\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 4 \cdot 10^{-272}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-241}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.04 \cdot 10^{-232}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-196}:\\
\;\;\;\;\log x \cdot \frac{1}{-n}\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-167}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{-103}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{-75}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-35}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 3.99999999999999972e-272 or 2.5000000000000002e-196 < x < 5.9999999999999996e-167 or 3.1000000000000001e-103 < x < 3.9000000000000001e-75 or 2.60000000000000005e-35 < x < 1Initial program 65.6%
Taylor expanded in x around 0 64.2%
if 3.99999999999999972e-272 < x < 1.1e-241 or 5.9999999999999996e-167 < x < 3.1000000000000001e-103 or 3.9000000000000001e-75 < x < 2.60000000000000005e-35Initial program 23.6%
Taylor expanded in x around 0 23.6%
Taylor expanded in n around inf 73.0%
neg-mul-173.0%
distribute-neg-frac73.0%
Simplified73.0%
if 1.1e-241 < x < 1.0399999999999999e-232Initial program 41.9%
Taylor expanded in n around inf 8.9%
+-rgt-identity8.9%
+-rgt-identity8.9%
log1p-def8.9%
Simplified8.9%
Taylor expanded in x around inf 100.0%
if 1.0399999999999999e-232 < x < 2.5000000000000002e-196Initial program 41.8%
Taylor expanded in n around inf 65.6%
+-rgt-identity65.6%
+-rgt-identity65.6%
log1p-def65.6%
Simplified65.6%
log1p-udef65.6%
diff-log65.6%
+-commutative65.6%
Applied egg-rr65.6%
frac-2neg65.6%
log-div65.6%
+-commutative65.6%
log1p-udef65.6%
div-inv65.7%
log1p-udef65.7%
+-commutative65.7%
log-div65.7%
neg-log65.7%
clear-num65.7%
Applied egg-rr65.7%
Taylor expanded in x around 0 65.7%
if 1 < x Initial program 70.9%
Taylor expanded in n around inf 71.9%
+-rgt-identity71.9%
+-rgt-identity71.9%
log1p-def71.9%
Simplified71.9%
log1p-udef71.9%
diff-log72.0%
+-commutative72.0%
Applied egg-rr72.0%
add-cube-cbrt71.9%
log-prod71.9%
pow271.9%
Applied egg-rr71.9%
log-pow71.9%
distribute-lft1-in71.9%
metadata-eval71.9%
Simplified71.9%
Taylor expanded in x around inf 70.9%
Final simplification70.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ x (+ 1.0 x))) (t_1 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-11)
(/ t_1 (* n x))
(if (<= (/ 1.0 n) 2e-11)
(/ (- (log t_0)) n)
(if (<= (/ 1.0 n) 5e+125)
(- (+ 1.0 (/ x n)) t_1)
(* (log1p (+ t_0 -1.0)) (/ 1.0 (- n))))))))
double code(double x, double n) {
double t_0 = x / (1.0 + x);
double t_1 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-11) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = -log(t_0) / n;
} else if ((1.0 / n) <= 5e+125) {
tmp = (1.0 + (x / n)) - t_1;
} else {
tmp = log1p((t_0 + -1.0)) * (1.0 / -n);
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = x / (1.0 + x);
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-11) {
tmp = t_1 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = -Math.log(t_0) / n;
} else if ((1.0 / n) <= 5e+125) {
tmp = (1.0 + (x / n)) - t_1;
} else {
tmp = Math.log1p((t_0 + -1.0)) * (1.0 / -n);
}
return tmp;
}
def code(x, n): t_0 = x / (1.0 + x) t_1 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-11: tmp = t_1 / (n * x) elif (1.0 / n) <= 2e-11: tmp = -math.log(t_0) / n elif (1.0 / n) <= 5e+125: tmp = (1.0 + (x / n)) - t_1 else: tmp = math.log1p((t_0 + -1.0)) * (1.0 / -n) return tmp
function code(x, n) t_0 = Float64(x / Float64(1.0 + x)) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-11) tmp = Float64(t_1 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-11) tmp = Float64(Float64(-log(t_0)) / n); elseif (Float64(1.0 / n) <= 5e+125) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_1); else tmp = Float64(log1p(Float64(t_0 + -1.0)) * Float64(1.0 / Float64(-n))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-11], N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-11], N[((-N[Log[t$95$0], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+125], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], N[(N[Log[1 + N[(t$95$0 + -1.0), $MachinePrecision]], $MachinePrecision] * N[(1.0 / (-n)), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{1 + x}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-11}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\frac{-\log t_0}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+125}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(t_0 + -1\right) \cdot \frac{1}{-n}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000018e-11Initial program 97.8%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
*-rgt-identity98.9%
associate-*r/98.9%
distribute-lft-neg-in98.9%
remove-double-neg98.9%
exp-to-pow98.9%
Simplified98.9%
if -5.00000000000000018e-11 < (/.f64 1 n) < 1.99999999999999988e-11Initial program 26.3%
Taylor expanded in n around inf 80.6%
+-rgt-identity80.6%
+-rgt-identity80.6%
log1p-def80.6%
Simplified80.6%
log1p-udef80.6%
diff-log80.7%
+-commutative80.7%
Applied egg-rr80.7%
clear-num80.7%
log-rec80.7%
Applied egg-rr80.7%
if 1.99999999999999988e-11 < (/.f64 1 n) < 4.99999999999999962e125Initial program 73.8%
Taylor expanded in x around 0 74.2%
if 4.99999999999999962e125 < (/.f64 1 n) Initial program 18.8%
Taylor expanded in n around inf 7.8%
+-rgt-identity7.8%
+-rgt-identity7.8%
log1p-def7.8%
Simplified7.8%
log1p-udef7.8%
diff-log7.8%
+-commutative7.8%
Applied egg-rr7.8%
frac-2neg7.8%
log-div7.8%
+-commutative7.8%
log1p-udef7.8%
div-inv7.8%
log1p-udef7.8%
+-commutative7.8%
log-div7.8%
neg-log7.8%
clear-num7.8%
Applied egg-rr7.8%
log1p-expm1-u81.2%
expm1-udef81.2%
add-exp-log81.2%
Applied egg-rr81.2%
Final simplification86.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-11)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-11)
(/ (- (log (/ x (+ 1.0 x)))) n)
(if (<= (/ 1.0 n) 5e+125)
(- (+ 1.0 (/ x n)) t_0)
(/ 0.3333333333333333 (* n (pow x 3.0))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = -log((x / (1.0 + x))) / n;
} else if ((1.0 / n) <= 5e+125) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 0.3333333333333333 / (n * pow(x, 3.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) <= (-5d-11)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 2d-11) then
tmp = -log((x / (1.0d0 + x))) / n
else if ((1.0d0 / n) <= 5d+125) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = 0.3333333333333333d0 / (n * (x ** 3.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) <= -5e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = -Math.log((x / (1.0 + x))) / n;
} else if ((1.0 / n) <= 5e+125) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 0.3333333333333333 / (n * Math.pow(x, 3.0));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-11: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-11: tmp = -math.log((x / (1.0 + x))) / n elif (1.0 / n) <= 5e+125: tmp = (1.0 + (x / n)) - t_0 else: tmp = 0.3333333333333333 / (n * math.pow(x, 3.0)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-11) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-11) tmp = Float64(Float64(-log(Float64(x / Float64(1.0 + x)))) / n); elseif (Float64(1.0 / n) <= 5e+125) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(0.3333333333333333 / Float64(n * (x ^ 3.0))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -5e-11) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 2e-11) tmp = -log((x / (1.0 + x))) / n; elseif ((1.0 / n) <= 5e+125) tmp = (1.0 + (x / n)) - t_0; else tmp = 0.3333333333333333 / (n * (x ^ 3.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], -5e-11], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-11], N[((-N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+125], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(0.3333333333333333 / N[(n * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-11}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\frac{-\log \left(\frac{x}{1 + x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+125}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000018e-11Initial program 97.8%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
*-rgt-identity98.9%
associate-*r/98.9%
distribute-lft-neg-in98.9%
remove-double-neg98.9%
exp-to-pow98.9%
Simplified98.9%
if -5.00000000000000018e-11 < (/.f64 1 n) < 1.99999999999999988e-11Initial program 26.3%
Taylor expanded in n around inf 80.6%
+-rgt-identity80.6%
+-rgt-identity80.6%
log1p-def80.6%
Simplified80.6%
log1p-udef80.6%
diff-log80.7%
+-commutative80.7%
Applied egg-rr80.7%
clear-num80.7%
log-rec80.7%
Applied egg-rr80.7%
if 1.99999999999999988e-11 < (/.f64 1 n) < 4.99999999999999962e125Initial program 73.8%
Taylor expanded in x around 0 74.2%
if 4.99999999999999962e125 < (/.f64 1 n) Initial program 18.8%
Taylor expanded in n around inf 7.8%
+-rgt-identity7.8%
+-rgt-identity7.8%
log1p-def7.8%
Simplified7.8%
Taylor expanded in x around inf 30.3%
sub-neg30.3%
+-commutative30.3%
associate-+l+30.3%
associate-*r/30.3%
metadata-eval30.3%
associate-*r/30.3%
metadata-eval30.3%
distribute-neg-frac30.3%
metadata-eval30.3%
Simplified30.3%
Taylor expanded in x around 0 80.8%
*-commutative80.8%
Simplified80.8%
Final simplification86.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- x (log x)) n)))
(if (<= n -1.02e+189)
(* (log x) (/ 1.0 (- n)))
(if (<= n -2.5e+143)
(/ (/ 1.0 n) x)
(if (<= n -2.45)
t_0
(if (<= n 3.5e-128)
(/ 0.3333333333333333 (* n (pow x 3.0)))
(if (<= n 58000000000.0)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= n 7.6e+103)
t_0
(if (<= n 3.1e+187) (/ (/ 1.0 x) n) (/ (- (log x)) n))))))))))
double code(double x, double n) {
double t_0 = (x - log(x)) / n;
double tmp;
if (n <= -1.02e+189) {
tmp = log(x) * (1.0 / -n);
} else if (n <= -2.5e+143) {
tmp = (1.0 / n) / x;
} else if (n <= -2.45) {
tmp = t_0;
} else if (n <= 3.5e-128) {
tmp = 0.3333333333333333 / (n * pow(x, 3.0));
} else if (n <= 58000000000.0) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (n <= 7.6e+103) {
tmp = t_0;
} else if (n <= 3.1e+187) {
tmp = (1.0 / x) / n;
} else {
tmp = -log(x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = (x - log(x)) / n
if (n <= (-1.02d+189)) then
tmp = log(x) * (1.0d0 / -n)
else if (n <= (-2.5d+143)) then
tmp = (1.0d0 / n) / x
else if (n <= (-2.45d0)) then
tmp = t_0
else if (n <= 3.5d-128) then
tmp = 0.3333333333333333d0 / (n * (x ** 3.0d0))
else if (n <= 58000000000.0d0) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (n <= 7.6d+103) then
tmp = t_0
else if (n <= 3.1d+187) then
tmp = (1.0d0 / x) / n
else
tmp = -log(x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = (x - Math.log(x)) / n;
double tmp;
if (n <= -1.02e+189) {
tmp = Math.log(x) * (1.0 / -n);
} else if (n <= -2.5e+143) {
tmp = (1.0 / n) / x;
} else if (n <= -2.45) {
tmp = t_0;
} else if (n <= 3.5e-128) {
tmp = 0.3333333333333333 / (n * Math.pow(x, 3.0));
} else if (n <= 58000000000.0) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (n <= 7.6e+103) {
tmp = t_0;
} else if (n <= 3.1e+187) {
tmp = (1.0 / x) / n;
} else {
tmp = -Math.log(x) / n;
}
return tmp;
}
def code(x, n): t_0 = (x - math.log(x)) / n tmp = 0 if n <= -1.02e+189: tmp = math.log(x) * (1.0 / -n) elif n <= -2.5e+143: tmp = (1.0 / n) / x elif n <= -2.45: tmp = t_0 elif n <= 3.5e-128: tmp = 0.3333333333333333 / (n * math.pow(x, 3.0)) elif n <= 58000000000.0: tmp = 1.0 - math.pow(x, (1.0 / n)) elif n <= 7.6e+103: tmp = t_0 elif n <= 3.1e+187: tmp = (1.0 / x) / n else: tmp = -math.log(x) / n return tmp
function code(x, n) t_0 = Float64(Float64(x - log(x)) / n) tmp = 0.0 if (n <= -1.02e+189) tmp = Float64(log(x) * Float64(1.0 / Float64(-n))); elseif (n <= -2.5e+143) tmp = Float64(Float64(1.0 / n) / x); elseif (n <= -2.45) tmp = t_0; elseif (n <= 3.5e-128) tmp = Float64(0.3333333333333333 / Float64(n * (x ^ 3.0))); elseif (n <= 58000000000.0) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (n <= 7.6e+103) tmp = t_0; elseif (n <= 3.1e+187) tmp = Float64(Float64(1.0 / x) / n); else tmp = Float64(Float64(-log(x)) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = (x - log(x)) / n; tmp = 0.0; if (n <= -1.02e+189) tmp = log(x) * (1.0 / -n); elseif (n <= -2.5e+143) tmp = (1.0 / n) / x; elseif (n <= -2.45) tmp = t_0; elseif (n <= 3.5e-128) tmp = 0.3333333333333333 / (n * (x ^ 3.0)); elseif (n <= 58000000000.0) tmp = 1.0 - (x ^ (1.0 / n)); elseif (n <= 7.6e+103) tmp = t_0; elseif (n <= 3.1e+187) tmp = (1.0 / x) / n; else tmp = -log(x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[n, -1.02e+189], N[(N[Log[x], $MachinePrecision] * N[(1.0 / (-n)), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -2.5e+143], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[n, -2.45], t$95$0, If[LessEqual[n, 3.5e-128], N[(0.3333333333333333 / N[(n * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 58000000000.0], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7.6e+103], t$95$0, If[LessEqual[n, 3.1e+187], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x - \log x}{n}\\
\mathbf{if}\;n \leq -1.02 \cdot 10^{+189}:\\
\;\;\;\;\log x \cdot \frac{1}{-n}\\
\mathbf{elif}\;n \leq -2.5 \cdot 10^{+143}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{elif}\;n \leq -2.45:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 3.5 \cdot 10^{-128}:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\
\mathbf{elif}\;n \leq 58000000000:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;n \leq 7.6 \cdot 10^{+103}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 3.1 \cdot 10^{+187}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\log x}{n}\\
\end{array}
\end{array}
if n < -1.02e189Initial program 34.5%
Taylor expanded in n around inf 91.0%
+-rgt-identity91.0%
+-rgt-identity91.0%
log1p-def91.0%
Simplified91.0%
log1p-udef91.0%
diff-log91.0%
+-commutative91.0%
Applied egg-rr91.0%
frac-2neg91.0%
log-div91.0%
+-commutative91.0%
log1p-udef91.0%
div-inv91.0%
log1p-udef91.0%
+-commutative91.0%
log-div91.0%
neg-log91.0%
clear-num91.0%
Applied egg-rr91.0%
Taylor expanded in x around 0 63.3%
if -1.02e189 < n < -2.50000000000000006e143Initial program 26.1%
Taylor expanded in n around inf 46.2%
+-rgt-identity46.2%
+-rgt-identity46.2%
log1p-def46.2%
Simplified46.2%
Taylor expanded in x around inf 75.9%
associate-/r*81.3%
Simplified81.3%
if -2.50000000000000006e143 < n < -2.4500000000000002 or 5.8e10 < n < 7.5999999999999994e103Initial program 11.1%
Taylor expanded in n around inf 73.7%
+-rgt-identity73.7%
+-rgt-identity73.7%
log1p-def73.7%
Simplified73.7%
Taylor expanded in x around 0 68.4%
neg-mul-168.4%
unsub-neg68.4%
Simplified68.4%
if -2.4500000000000002 < n < 3.5e-128Initial program 84.7%
Taylor expanded in n around inf 41.7%
+-rgt-identity41.7%
+-rgt-identity41.7%
log1p-def41.7%
Simplified41.7%
Taylor expanded in x around inf 19.8%
sub-neg19.8%
+-commutative19.8%
associate-+l+19.8%
associate-*r/19.8%
metadata-eval19.8%
associate-*r/19.8%
metadata-eval19.8%
distribute-neg-frac19.8%
metadata-eval19.8%
Simplified19.8%
Taylor expanded in x around 0 68.5%
*-commutative68.5%
Simplified68.5%
if 3.5e-128 < n < 5.8e10Initial program 73.8%
Taylor expanded in x around 0 73.7%
if 7.5999999999999994e103 < n < 3.10000000000000012e187Initial program 43.9%
Taylor expanded in n around inf 72.2%
+-rgt-identity72.2%
+-rgt-identity72.2%
log1p-def72.2%
Simplified72.2%
Taylor expanded in x around inf 71.4%
if 3.10000000000000012e187 < n Initial program 32.5%
Taylor expanded in x around 0 32.5%
Taylor expanded in n around inf 70.1%
neg-mul-170.1%
distribute-neg-frac70.1%
Simplified70.1%
Final simplification69.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-11)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 2e-11)
(/ (- (log (/ x (+ 1.0 x)))) n)
(if (<= (/ 1.0 n) 5e+125)
(- 1.0 t_0)
(/ 0.3333333333333333 (* n (pow x 3.0))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = -log((x / (1.0 + x))) / n;
} else if ((1.0 / n) <= 5e+125) {
tmp = 1.0 - t_0;
} else {
tmp = 0.3333333333333333 / (n * pow(x, 3.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) <= (-5d-11)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 2d-11) then
tmp = -log((x / (1.0d0 + x))) / n
else if ((1.0d0 / n) <= 5d+125) then
tmp = 1.0d0 - t_0
else
tmp = 0.3333333333333333d0 / (n * (x ** 3.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) <= -5e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 2e-11) {
tmp = -Math.log((x / (1.0 + x))) / n;
} else if ((1.0 / n) <= 5e+125) {
tmp = 1.0 - t_0;
} else {
tmp = 0.3333333333333333 / (n * Math.pow(x, 3.0));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-11: tmp = t_0 / (n * x) elif (1.0 / n) <= 2e-11: tmp = -math.log((x / (1.0 + x))) / n elif (1.0 / n) <= 5e+125: tmp = 1.0 - t_0 else: tmp = 0.3333333333333333 / (n * math.pow(x, 3.0)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-11) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 2e-11) tmp = Float64(Float64(-log(Float64(x / Float64(1.0 + x)))) / n); elseif (Float64(1.0 / n) <= 5e+125) tmp = Float64(1.0 - t_0); else tmp = Float64(0.3333333333333333 / Float64(n * (x ^ 3.0))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -5e-11) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 2e-11) tmp = -log((x / (1.0 + x))) / n; elseif ((1.0 / n) <= 5e+125) tmp = 1.0 - t_0; else tmp = 0.3333333333333333 / (n * (x ^ 3.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], -5e-11], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-11], N[((-N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+125], N[(1.0 - t$95$0), $MachinePrecision], N[(0.3333333333333333 / N[(n * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-11}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\frac{-\log \left(\frac{x}{1 + x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+125}:\\
\;\;\;\;1 - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000018e-11Initial program 97.8%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
*-rgt-identity98.9%
associate-*r/98.9%
distribute-lft-neg-in98.9%
remove-double-neg98.9%
exp-to-pow98.9%
Simplified98.9%
if -5.00000000000000018e-11 < (/.f64 1 n) < 1.99999999999999988e-11Initial program 26.3%
Taylor expanded in n around inf 80.6%
+-rgt-identity80.6%
+-rgt-identity80.6%
log1p-def80.6%
Simplified80.6%
log1p-udef80.6%
diff-log80.7%
+-commutative80.7%
Applied egg-rr80.7%
clear-num80.7%
log-rec80.7%
Applied egg-rr80.7%
if 1.99999999999999988e-11 < (/.f64 1 n) < 4.99999999999999962e125Initial program 73.8%
Taylor expanded in x around 0 73.7%
if 4.99999999999999962e125 < (/.f64 1 n) Initial program 18.8%
Taylor expanded in n around inf 7.8%
+-rgt-identity7.8%
+-rgt-identity7.8%
log1p-def7.8%
Simplified7.8%
Taylor expanded in x around inf 30.3%
sub-neg30.3%
+-commutative30.3%
associate-+l+30.3%
associate-*r/30.3%
metadata-eval30.3%
associate-*r/30.3%
metadata-eval30.3%
distribute-neg-frac30.3%
metadata-eval30.3%
Simplified30.3%
Taylor expanded in x around 0 80.8%
*-commutative80.8%
Simplified80.8%
Final simplification86.5%
(FPCore (x n)
:precision binary64
(if (<= n -4.8e-135)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= n 3.3e-130)
(/ 0.3333333333333333 (* n (pow x 3.0)))
(if (<= n 16200000000.0)
(- 1.0 (pow x (/ 1.0 n)))
(/ (- (log (/ x (+ 1.0 x)))) n)))))
double code(double x, double n) {
double tmp;
if (n <= -4.8e-135) {
tmp = log(((1.0 + x) / x)) / n;
} else if (n <= 3.3e-130) {
tmp = 0.3333333333333333 / (n * pow(x, 3.0));
} else if (n <= 16200000000.0) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = -log((x / (1.0 + x))) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-4.8d-135)) then
tmp = log(((1.0d0 + x) / x)) / n
else if (n <= 3.3d-130) then
tmp = 0.3333333333333333d0 / (n * (x ** 3.0d0))
else if (n <= 16200000000.0d0) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = -log((x / (1.0d0 + x))) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (n <= -4.8e-135) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if (n <= 3.3e-130) {
tmp = 0.3333333333333333 / (n * Math.pow(x, 3.0));
} else if (n <= 16200000000.0) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = -Math.log((x / (1.0 + x))) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -4.8e-135: tmp = math.log(((1.0 + x) / x)) / n elif n <= 3.3e-130: tmp = 0.3333333333333333 / (n * math.pow(x, 3.0)) elif n <= 16200000000.0: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = -math.log((x / (1.0 + x))) / n return tmp
function code(x, n) tmp = 0.0 if (n <= -4.8e-135) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (n <= 3.3e-130) tmp = Float64(0.3333333333333333 / Float64(n * (x ^ 3.0))); elseif (n <= 16200000000.0) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(Float64(-log(Float64(x / Float64(1.0 + x)))) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (n <= -4.8e-135) tmp = log(((1.0 + x) / x)) / n; elseif (n <= 3.3e-130) tmp = 0.3333333333333333 / (n * (x ^ 3.0)); elseif (n <= 16200000000.0) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = -log((x / (1.0 + x))) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[n, -4.8e-135], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, 3.3e-130], N[(0.3333333333333333 / N[(n * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 16200000000.0], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[((-N[Log[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.8 \cdot 10^{-135}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;n \leq 3.3 \cdot 10^{-130}:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\
\mathbf{elif}\;n \leq 16200000000:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\log \left(\frac{x}{1 + x}\right)}{n}\\
\end{array}
\end{array}
if n < -4.7999999999999997e-135Initial program 54.3%
Taylor expanded in n around inf 69.0%
+-rgt-identity69.0%
+-rgt-identity69.0%
log1p-def69.0%
Simplified69.0%
log1p-udef69.0%
diff-log69.9%
+-commutative69.9%
Applied egg-rr69.9%
if -4.7999999999999997e-135 < n < 3.2999999999999998e-130Initial program 73.8%
Taylor expanded in n around inf 31.3%
+-rgt-identity31.3%
+-rgt-identity31.3%
log1p-def31.3%
Simplified31.3%
Taylor expanded in x around inf 25.3%
sub-neg25.3%
+-commutative25.3%
associate-+l+25.3%
associate-*r/25.3%
metadata-eval25.3%
associate-*r/25.3%
metadata-eval25.3%
distribute-neg-frac25.3%
metadata-eval25.3%
Simplified25.3%
Taylor expanded in x around 0 81.5%
*-commutative81.5%
Simplified81.5%
if 3.2999999999999998e-130 < n < 1.62e10Initial program 73.8%
Taylor expanded in x around 0 73.7%
if 1.62e10 < n Initial program 28.0%
Taylor expanded in n around inf 80.9%
+-rgt-identity80.9%
+-rgt-identity80.9%
log1p-def80.9%
Simplified80.9%
log1p-udef80.9%
diff-log81.0%
+-commutative81.0%
Applied egg-rr81.0%
clear-num81.0%
log-rec81.1%
Applied egg-rr81.1%
Final simplification75.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ 1.0 (* n x))))
(if (<= x 1.85e-274)
t_0
(if (<= x 1.7e-240)
(/ (- (log x)) n)
(if (<= x 1e-232)
t_0
(if (<= x 6000000000000.0) (/ (- x (log x)) n) (/ 0.0 n)))))))
double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double tmp;
if (x <= 1.85e-274) {
tmp = t_0;
} else if (x <= 1.7e-240) {
tmp = -log(x) / n;
} else if (x <= 1e-232) {
tmp = t_0;
} else if (x <= 6000000000000.0) {
tmp = (x - log(x)) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 / (n * x)
if (x <= 1.85d-274) then
tmp = t_0
else if (x <= 1.7d-240) then
tmp = -log(x) / n
else if (x <= 1d-232) then
tmp = t_0
else if (x <= 6000000000000.0d0) then
tmp = (x - log(x)) / n
else
tmp = 0.0d0 / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double tmp;
if (x <= 1.85e-274) {
tmp = t_0;
} else if (x <= 1.7e-240) {
tmp = -Math.log(x) / n;
} else if (x <= 1e-232) {
tmp = t_0;
} else if (x <= 6000000000000.0) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): t_0 = 1.0 / (n * x) tmp = 0 if x <= 1.85e-274: tmp = t_0 elif x <= 1.7e-240: tmp = -math.log(x) / n elif x <= 1e-232: tmp = t_0 elif x <= 6000000000000.0: tmp = (x - math.log(x)) / n else: tmp = 0.0 / n return tmp
function code(x, n) t_0 = Float64(1.0 / Float64(n * x)) tmp = 0.0 if (x <= 1.85e-274) tmp = t_0; elseif (x <= 1.7e-240) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 1e-232) tmp = t_0; elseif (x <= 6000000000000.0) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 / (n * x); tmp = 0.0; if (x <= 1.85e-274) tmp = t_0; elseif (x <= 1.7e-240) tmp = -log(x) / n; elseif (x <= 1e-232) tmp = t_0; elseif (x <= 6000000000000.0) tmp = (x - log(x)) / n; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.85e-274], t$95$0, If[LessEqual[x, 1.7e-240], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 1e-232], t$95$0, If[LessEqual[x, 6000000000000.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{n \cdot x}\\
\mathbf{if}\;x \leq 1.85 \cdot 10^{-274}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-240}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 10^{-232}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 6000000000000:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 1.84999999999999992e-274 or 1.69999999999999995e-240 < x < 1.00000000000000002e-232Initial program 64.9%
Taylor expanded in n around inf 23.4%
+-rgt-identity23.4%
+-rgt-identity23.4%
log1p-def23.4%
Simplified23.4%
Taylor expanded in x around inf 78.0%
if 1.84999999999999992e-274 < x < 1.69999999999999995e-240Initial program 23.6%
Taylor expanded in x around 0 23.6%
Taylor expanded in n around inf 69.6%
neg-mul-169.6%
distribute-neg-frac69.6%
Simplified69.6%
if 1.00000000000000002e-232 < x < 6e12Initial program 42.2%
Taylor expanded in n around inf 52.6%
+-rgt-identity52.6%
+-rgt-identity52.6%
log1p-def52.6%
Simplified52.6%
Taylor expanded in x around 0 51.8%
neg-mul-151.8%
unsub-neg51.8%
Simplified51.8%
if 6e12 < x Initial program 72.3%
Taylor expanded in n around inf 72.3%
+-rgt-identity72.3%
+-rgt-identity72.3%
log1p-def72.3%
Simplified72.3%
log1p-udef72.3%
diff-log72.3%
+-commutative72.3%
Applied egg-rr72.3%
add-cube-cbrt72.3%
log-prod72.3%
pow272.3%
Applied egg-rr72.3%
log-pow72.3%
distribute-lft1-in72.3%
metadata-eval72.3%
Simplified72.3%
Taylor expanded in x around inf 72.3%
Final simplification62.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log (/ (+ 1.0 x) x)) n)))
(if (<= n -4.5e-135)
t_0
(if (<= n 3.3e-130)
(/ 0.3333333333333333 (* n (pow x 3.0)))
(if (<= n 15000000000.0) (- 1.0 (pow x (/ 1.0 n))) t_0)))))
double code(double x, double n) {
double t_0 = log(((1.0 + x) / x)) / n;
double tmp;
if (n <= -4.5e-135) {
tmp = t_0;
} else if (n <= 3.3e-130) {
tmp = 0.3333333333333333 / (n * pow(x, 3.0));
} else if (n <= 15000000000.0) {
tmp = 1.0 - pow(x, (1.0 / n));
} 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) :: tmp
t_0 = log(((1.0d0 + x) / x)) / n
if (n <= (-4.5d-135)) then
tmp = t_0
else if (n <= 3.3d-130) then
tmp = 0.3333333333333333d0 / (n * (x ** 3.0d0))
else if (n <= 15000000000.0d0) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(((1.0 + x) / x)) / n;
double tmp;
if (n <= -4.5e-135) {
tmp = t_0;
} else if (n <= 3.3e-130) {
tmp = 0.3333333333333333 / (n * Math.pow(x, 3.0));
} else if (n <= 15000000000.0) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = math.log(((1.0 + x) / x)) / n tmp = 0 if n <= -4.5e-135: tmp = t_0 elif n <= 3.3e-130: tmp = 0.3333333333333333 / (n * math.pow(x, 3.0)) elif n <= 15000000000.0: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(log(Float64(Float64(1.0 + x) / x)) / n) tmp = 0.0 if (n <= -4.5e-135) tmp = t_0; elseif (n <= 3.3e-130) tmp = Float64(0.3333333333333333 / Float64(n * (x ^ 3.0))); elseif (n <= 15000000000.0) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, n) t_0 = log(((1.0 + x) / x)) / n; tmp = 0.0; if (n <= -4.5e-135) tmp = t_0; elseif (n <= 3.3e-130) tmp = 0.3333333333333333 / (n * (x ^ 3.0)); elseif (n <= 15000000000.0) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[n, -4.5e-135], t$95$0, If[LessEqual[n, 3.3e-130], N[(0.3333333333333333 / N[(n * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 15000000000.0], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{if}\;n \leq -4.5 \cdot 10^{-135}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 3.3 \cdot 10^{-130}:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\
\mathbf{elif}\;n \leq 15000000000:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -4.49999999999999987e-135 or 1.5e10 < n Initial program 45.0%
Taylor expanded in n around inf 73.2%
+-rgt-identity73.2%
+-rgt-identity73.2%
log1p-def73.2%
Simplified73.2%
log1p-udef73.2%
diff-log73.8%
+-commutative73.8%
Applied egg-rr73.8%
if -4.49999999999999987e-135 < n < 3.2999999999999998e-130Initial program 73.8%
Taylor expanded in n around inf 31.3%
+-rgt-identity31.3%
+-rgt-identity31.3%
log1p-def31.3%
Simplified31.3%
Taylor expanded in x around inf 25.3%
sub-neg25.3%
+-commutative25.3%
associate-+l+25.3%
associate-*r/25.3%
metadata-eval25.3%
associate-*r/25.3%
metadata-eval25.3%
distribute-neg-frac25.3%
metadata-eval25.3%
Simplified25.3%
Taylor expanded in x around 0 81.5%
*-commutative81.5%
Simplified81.5%
if 3.2999999999999998e-130 < n < 1.5e10Initial program 73.8%
Taylor expanded in x around 0 73.7%
Final simplification75.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ 1.0 (* n x))) (t_1 (/ (- (log x)) n)))
(if (<= x 6.5e-274)
t_0
(if (<= x 3.7e-240)
t_1
(if (<= x 1e-232) t_0 (if (<= x 1.85e-25) t_1 (/ (/ 1.0 n) x)))))))
double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double t_1 = -log(x) / n;
double tmp;
if (x <= 6.5e-274) {
tmp = t_0;
} else if (x <= 3.7e-240) {
tmp = t_1;
} else if (x <= 1e-232) {
tmp = t_0;
} else if (x <= 1.85e-25) {
tmp = t_1;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 / (n * x)
t_1 = -log(x) / n
if (x <= 6.5d-274) then
tmp = t_0
else if (x <= 3.7d-240) then
tmp = t_1
else if (x <= 1d-232) then
tmp = t_0
else if (x <= 1.85d-25) then
tmp = t_1
else
tmp = (1.0d0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double t_1 = -Math.log(x) / n;
double tmp;
if (x <= 6.5e-274) {
tmp = t_0;
} else if (x <= 3.7e-240) {
tmp = t_1;
} else if (x <= 1e-232) {
tmp = t_0;
} else if (x <= 1.85e-25) {
tmp = t_1;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = 1.0 / (n * x) t_1 = -math.log(x) / n tmp = 0 if x <= 6.5e-274: tmp = t_0 elif x <= 3.7e-240: tmp = t_1 elif x <= 1e-232: tmp = t_0 elif x <= 1.85e-25: tmp = t_1 else: tmp = (1.0 / n) / x return tmp
function code(x, n) t_0 = Float64(1.0 / Float64(n * x)) t_1 = Float64(Float64(-log(x)) / n) tmp = 0.0 if (x <= 6.5e-274) tmp = t_0; elseif (x <= 3.7e-240) tmp = t_1; elseif (x <= 1e-232) tmp = t_0; elseif (x <= 1.85e-25) tmp = t_1; else tmp = Float64(Float64(1.0 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 / (n * x); t_1 = -log(x) / n; tmp = 0.0; if (x <= 6.5e-274) tmp = t_0; elseif (x <= 3.7e-240) tmp = t_1; elseif (x <= 1e-232) tmp = t_0; elseif (x <= 1.85e-25) tmp = t_1; else tmp = (1.0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[x, 6.5e-274], t$95$0, If[LessEqual[x, 3.7e-240], t$95$1, If[LessEqual[x, 1e-232], t$95$0, If[LessEqual[x, 1.85e-25], t$95$1, N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{n \cdot x}\\
t_1 := \frac{-\log x}{n}\\
\mathbf{if}\;x \leq 6.5 \cdot 10^{-274}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{-240}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 10^{-232}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-25}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\end{array}
\end{array}
if x < 6.49999999999999959e-274 or 3.7000000000000002e-240 < x < 1.00000000000000002e-232Initial program 64.9%
Taylor expanded in n around inf 23.4%
+-rgt-identity23.4%
+-rgt-identity23.4%
log1p-def23.4%
Simplified23.4%
Taylor expanded in x around inf 78.0%
if 6.49999999999999959e-274 < x < 3.7000000000000002e-240 or 1.00000000000000002e-232 < x < 1.85000000000000004e-25Initial program 38.0%
Taylor expanded in x around 0 38.0%
Taylor expanded in n around inf 57.0%
neg-mul-157.0%
distribute-neg-frac57.0%
Simplified57.0%
if 1.85000000000000004e-25 < x Initial program 71.7%
Taylor expanded in n around inf 67.2%
+-rgt-identity67.2%
+-rgt-identity67.2%
log1p-def67.2%
Simplified67.2%
Taylor expanded in x around inf 54.0%
associate-/r*54.9%
Simplified54.9%
Final simplification58.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ 1.0 (* n x))) (t_1 (/ (- (log x)) n)))
(if (<= x 2.4e-274)
t_0
(if (<= x 2.8e-240)
t_1
(if (<= x 1e-232) t_0 (if (<= x 1.0) t_1 (/ 0.0 n)))))))
double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double t_1 = -log(x) / n;
double tmp;
if (x <= 2.4e-274) {
tmp = t_0;
} else if (x <= 2.8e-240) {
tmp = t_1;
} else if (x <= 1e-232) {
tmp = t_0;
} else if (x <= 1.0) {
tmp = t_1;
} else {
tmp = 0.0 / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 / (n * x)
t_1 = -log(x) / n
if (x <= 2.4d-274) then
tmp = t_0
else if (x <= 2.8d-240) then
tmp = t_1
else if (x <= 1d-232) then
tmp = t_0
else if (x <= 1.0d0) then
tmp = t_1
else
tmp = 0.0d0 / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double t_1 = -Math.log(x) / n;
double tmp;
if (x <= 2.4e-274) {
tmp = t_0;
} else if (x <= 2.8e-240) {
tmp = t_1;
} else if (x <= 1e-232) {
tmp = t_0;
} else if (x <= 1.0) {
tmp = t_1;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): t_0 = 1.0 / (n * x) t_1 = -math.log(x) / n tmp = 0 if x <= 2.4e-274: tmp = t_0 elif x <= 2.8e-240: tmp = t_1 elif x <= 1e-232: tmp = t_0 elif x <= 1.0: tmp = t_1 else: tmp = 0.0 / n return tmp
function code(x, n) t_0 = Float64(1.0 / Float64(n * x)) t_1 = Float64(Float64(-log(x)) / n) tmp = 0.0 if (x <= 2.4e-274) tmp = t_0; elseif (x <= 2.8e-240) tmp = t_1; elseif (x <= 1e-232) tmp = t_0; elseif (x <= 1.0) tmp = t_1; else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 / (n * x); t_1 = -log(x) / n; tmp = 0.0; if (x <= 2.4e-274) tmp = t_0; elseif (x <= 2.8e-240) tmp = t_1; elseif (x <= 1e-232) tmp = t_0; elseif (x <= 1.0) tmp = t_1; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[x, 2.4e-274], t$95$0, If[LessEqual[x, 2.8e-240], t$95$1, If[LessEqual[x, 1e-232], t$95$0, If[LessEqual[x, 1.0], t$95$1, N[(0.0 / n), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{n \cdot x}\\
t_1 := \frac{-\log x}{n}\\
\mathbf{if}\;x \leq 2.4 \cdot 10^{-274}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-240}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 10^{-232}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 2.4e-274 or 2.7999999999999999e-240 < x < 1.00000000000000002e-232Initial program 64.9%
Taylor expanded in n around inf 23.4%
+-rgt-identity23.4%
+-rgt-identity23.4%
log1p-def23.4%
Simplified23.4%
Taylor expanded in x around inf 78.0%
if 2.4e-274 < x < 2.7999999999999999e-240 or 1.00000000000000002e-232 < x < 1Initial program 40.7%
Taylor expanded in x around 0 40.0%
Taylor expanded in n around inf 54.3%
neg-mul-154.3%
distribute-neg-frac54.3%
Simplified54.3%
if 1 < x Initial program 70.9%
Taylor expanded in n around inf 71.9%
+-rgt-identity71.9%
+-rgt-identity71.9%
log1p-def71.9%
Simplified71.9%
log1p-udef71.9%
diff-log72.0%
+-commutative72.0%
Applied egg-rr72.0%
add-cube-cbrt71.9%
log-prod71.9%
pow271.9%
Applied egg-rr71.9%
log-pow71.9%
distribute-lft1-in71.9%
metadata-eval71.9%
Simplified71.9%
Taylor expanded in x around inf 70.9%
Final simplification62.6%
(FPCore (x n) :precision binary64 (/ 1.0 (* n x)))
double code(double x, double n) {
return 1.0 / (n * x);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 1.0d0 / (n * x)
end function
public static double code(double x, double n) {
return 1.0 / (n * x);
}
def code(x, n): return 1.0 / (n * x)
function code(x, n) return Float64(1.0 / Float64(n * x)) end
function tmp = code(x, n) tmp = 1.0 / (n * x); end
code[x_, n_] := N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{n \cdot x}
\end{array}
Initial program 54.1%
Taylor expanded in n around inf 58.3%
+-rgt-identity58.3%
+-rgt-identity58.3%
log1p-def58.3%
Simplified58.3%
Taylor expanded in x around inf 38.3%
Final simplification38.3%
(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.1%
Taylor expanded in n around inf 58.3%
+-rgt-identity58.3%
+-rgt-identity58.3%
log1p-def58.3%
Simplified58.3%
Taylor expanded in x around inf 38.3%
associate-/r*38.7%
Simplified38.7%
Final simplification38.7%
herbie shell --seed 2023322
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))