
(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 13 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 (/ t_0 (* n x))))
(if (<= (/ 1.0 n) -1e-20)
t_1
(if (<= (/ 1.0 n) 5e-82)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 100000.0)
t_1
(- (exp (+ (/ x n) (* -0.5 (/ (* x x) n)))) t_0))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = t_0 / (n * x);
double tmp;
if ((1.0 / n) <= -1e-20) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-82) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = t_1;
} else {
tmp = exp(((x / n) + (-0.5 * ((x * 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 = t_0 / (n * x)
if ((1.0d0 / n) <= (-1d-20)) then
tmp = t_1
else if ((1.0d0 / n) <= 5d-82) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 100000.0d0) then
tmp = t_1
else
tmp = exp(((x / n) + ((-0.5d0) * ((x * 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 = t_0 / (n * x);
double tmp;
if ((1.0 / n) <= -1e-20) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-82) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = t_1;
} else {
tmp = Math.exp(((x / n) + (-0.5 * ((x * x) / n)))) - t_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) <= -1e-20: tmp = t_1 elif (1.0 / n) <= 5e-82: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 100000.0: tmp = t_1 else: tmp = math.exp(((x / n) + (-0.5 * ((x * x) / n)))) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(t_0 / Float64(n * x)) tmp = 0.0 if (Float64(1.0 / n) <= -1e-20) tmp = t_1; elseif (Float64(1.0 / n) <= 5e-82) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 100000.0) tmp = t_1; else tmp = Float64(exp(Float64(Float64(x / n) + Float64(-0.5 * Float64(Float64(x * x) / n)))) - t_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) <= -1e-20) tmp = t_1; elseif ((1.0 / n) <= 5e-82) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 100000.0) tmp = t_1; else tmp = exp(((x / n) + (-0.5 * ((x * 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[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-20], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-82], 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, N[(N[Exp[N[(N[(x / n), $MachinePrecision] + N[(-0.5 * N[(N[(x * x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{t_0}{n \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-20}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-82}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 100000:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n} + -0.5 \cdot \frac{x \cdot x}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -9.99999999999999945e-21 or 4.9999999999999998e-82 < (/.f64 1 n) < 1e5Initial program 73.2%
Taylor expanded in x around inf 93.4%
log-rec93.4%
mul-1-neg93.4%
mul-1-neg93.4%
distribute-frac-neg93.4%
neg-mul-193.4%
remove-double-neg93.4%
*-rgt-identity93.4%
associate-*r/93.4%
unpow-193.4%
exp-to-pow93.4%
unpow-193.4%
*-commutative93.4%
Simplified93.4%
if -9.99999999999999945e-21 < (/.f64 1 n) < 4.9999999999999998e-82Initial program 33.5%
Taylor expanded in n around inf 83.6%
log1p-def83.6%
Simplified83.6%
log1p-udef83.6%
diff-log83.6%
Applied egg-rr83.6%
if 1e5 < (/.f64 1 n) Initial program 46.8%
Taylor expanded in n around 0 46.8%
log1p-def100.0%
*-rgt-identity100.0%
associate-*r/100.0%
unpow-1100.0%
exp-to-pow100.0%
/-rgt-identity100.0%
metadata-eval100.0%
associate-/l*100.0%
*-commutative100.0%
*-commutative100.0%
associate-/l*100.0%
metadata-eval100.0%
/-rgt-identity100.0%
unpow-1100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
unpow2100.0%
Simplified100.0%
Final simplification89.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ t_0 (* n x))) (t_2 (/ 1.0 (* n x))))
(if (<= (/ 1.0 n) -1e-20)
t_1
(if (<= (/ 1.0 n) 5e-82)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 100000.0)
t_1
(if (<= (/ 1.0 n) 4e+195)
(- (+ 1.0 (/ x n)) t_0)
(cbrt (* t_2 (/ t_2 (* n x))))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = t_0 / (n * x);
double t_2 = 1.0 / (n * x);
double tmp;
if ((1.0 / n) <= -1e-20) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-82) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = t_1;
} else if ((1.0 / n) <= 4e+195) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = cbrt((t_2 * (t_2 / (n * x))));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = t_0 / (n * x);
double t_2 = 1.0 / (n * x);
double tmp;
if ((1.0 / n) <= -1e-20) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-82) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = t_1;
} else if ((1.0 / n) <= 4e+195) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = Math.cbrt((t_2 * (t_2 / (n * x))));
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(t_0 / Float64(n * x)) t_2 = Float64(1.0 / Float64(n * x)) tmp = 0.0 if (Float64(1.0 / n) <= -1e-20) tmp = t_1; elseif (Float64(1.0 / n) <= 5e-82) 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) <= 4e+195) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = cbrt(Float64(t_2 * Float64(t_2 / Float64(n * x)))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-20], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-82], 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], 4e+195], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[Power[N[(t$95$2 * N[(t$95$2 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{t_0}{n \cdot x}\\
t_2 := \frac{1}{n \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-20}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-82}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 100000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+195}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{t_2 \cdot \frac{t_2}{n \cdot x}}\\
\end{array}
\end{array}
if (/.f64 1 n) < -9.99999999999999945e-21 or 4.9999999999999998e-82 < (/.f64 1 n) < 1e5Initial program 73.2%
Taylor expanded in x around inf 93.4%
log-rec93.4%
mul-1-neg93.4%
mul-1-neg93.4%
distribute-frac-neg93.4%
neg-mul-193.4%
remove-double-neg93.4%
*-rgt-identity93.4%
associate-*r/93.4%
unpow-193.4%
exp-to-pow93.4%
unpow-193.4%
*-commutative93.4%
Simplified93.4%
if -9.99999999999999945e-21 < (/.f64 1 n) < 4.9999999999999998e-82Initial program 33.5%
Taylor expanded in n around inf 83.6%
log1p-def83.6%
Simplified83.6%
log1p-udef83.6%
diff-log83.6%
Applied egg-rr83.6%
if 1e5 < (/.f64 1 n) < 3.99999999999999991e195Initial program 67.8%
Taylor expanded in x around 0 70.2%
if 3.99999999999999991e195 < (/.f64 1 n) Initial program 20.3%
Taylor expanded in n around inf 6.3%
log1p-def6.3%
Simplified6.3%
Taylor expanded in x around inf 74.6%
*-commutative74.6%
Simplified74.6%
add-cbrt-cube80.6%
Applied egg-rr80.6%
associate-*r/80.6%
*-rgt-identity80.6%
associate-*r/80.6%
Simplified80.6%
Final simplification85.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ t_0 (* n x))))
(if (<= (/ 1.0 n) -1e-20)
t_1
(if (<= (/ 1.0 n) 5e-82)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 100000.0)
t_1
(if (<= (/ 1.0 n) 4e+195)
(- (+ 1.0 (/ x n)) t_0)
(/ 1.0 (* n x))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = t_0 / (n * x);
double tmp;
if ((1.0 / n) <= -1e-20) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-82) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = t_1;
} else if ((1.0 / n) <= 4e+195) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = t_0 / (n * x)
if ((1.0d0 / n) <= (-1d-20)) then
tmp = t_1
else if ((1.0d0 / n) <= 5d-82) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 100000.0d0) then
tmp = t_1
else if ((1.0d0 / n) <= 4d+195) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = t_0 / (n * x);
double tmp;
if ((1.0 / n) <= -1e-20) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-82) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = t_1;
} else if ((1.0 / n) <= 4e+195) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = t_0 / (n * x) tmp = 0 if (1.0 / n) <= -1e-20: tmp = t_1 elif (1.0 / n) <= 5e-82: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 100000.0: tmp = t_1 elif (1.0 / n) <= 4e+195: tmp = (1.0 + (x / n)) - t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(t_0 / Float64(n * x)) tmp = 0.0 if (Float64(1.0 / n) <= -1e-20) tmp = t_1; elseif (Float64(1.0 / n) <= 5e-82) 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) <= 4e+195) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = t_0 / (n * x); tmp = 0.0; if ((1.0 / n) <= -1e-20) tmp = t_1; elseif ((1.0 / n) <= 5e-82) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 100000.0) tmp = t_1; elseif ((1.0 / n) <= 4e+195) tmp = (1.0 + (x / n)) - t_0; else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-20], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-82], 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], 4e+195], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{t_0}{n \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-20}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-82}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 100000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+195}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -9.99999999999999945e-21 or 4.9999999999999998e-82 < (/.f64 1 n) < 1e5Initial program 73.2%
Taylor expanded in x around inf 93.4%
log-rec93.4%
mul-1-neg93.4%
mul-1-neg93.4%
distribute-frac-neg93.4%
neg-mul-193.4%
remove-double-neg93.4%
*-rgt-identity93.4%
associate-*r/93.4%
unpow-193.4%
exp-to-pow93.4%
unpow-193.4%
*-commutative93.4%
Simplified93.4%
if -9.99999999999999945e-21 < (/.f64 1 n) < 4.9999999999999998e-82Initial program 33.5%
Taylor expanded in n around inf 83.6%
log1p-def83.6%
Simplified83.6%
log1p-udef83.6%
diff-log83.6%
Applied egg-rr83.6%
if 1e5 < (/.f64 1 n) < 3.99999999999999991e195Initial program 67.8%
Taylor expanded in x around 0 70.2%
if 3.99999999999999991e195 < (/.f64 1 n) Initial program 20.3%
Taylor expanded in n around inf 6.3%
log1p-def6.3%
Simplified6.3%
Taylor expanded in x around inf 74.6%
*-commutative74.6%
Simplified74.6%
Final simplification85.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ t_0 (* n x))))
(if (<= (/ 1.0 n) -1e-20)
t_1
(if (<= (/ 1.0 n) 5e-82)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 100000.0)
t_1
(if (<= (/ 1.0 n) 4e+195) (- 1.0 t_0) (/ 1.0 (* n x))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = t_0 / (n * x);
double tmp;
if ((1.0 / n) <= -1e-20) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-82) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = t_1;
} else if ((1.0 / n) <= 4e+195) {
tmp = 1.0 - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = t_0 / (n * x)
if ((1.0d0 / n) <= (-1d-20)) then
tmp = t_1
else if ((1.0d0 / n) <= 5d-82) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 100000.0d0) then
tmp = t_1
else if ((1.0d0 / n) <= 4d+195) then
tmp = 1.0d0 - t_0
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = t_0 / (n * x);
double tmp;
if ((1.0 / n) <= -1e-20) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-82) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 100000.0) {
tmp = t_1;
} else if ((1.0 / n) <= 4e+195) {
tmp = 1.0 - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = t_0 / (n * x) tmp = 0 if (1.0 / n) <= -1e-20: tmp = t_1 elif (1.0 / n) <= 5e-82: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 100000.0: tmp = t_1 elif (1.0 / n) <= 4e+195: tmp = 1.0 - t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(t_0 / Float64(n * x)) tmp = 0.0 if (Float64(1.0 / n) <= -1e-20) tmp = t_1; elseif (Float64(1.0 / n) <= 5e-82) 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) <= 4e+195) tmp = Float64(1.0 - t_0); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = t_0 / (n * x); tmp = 0.0; if ((1.0 / n) <= -1e-20) tmp = t_1; elseif ((1.0 / n) <= 5e-82) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 100000.0) tmp = t_1; elseif ((1.0 / n) <= 4e+195) tmp = 1.0 - t_0; else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-20], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-82], 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], 4e+195], N[(1.0 - t$95$0), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{t_0}{n \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-20}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-82}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 100000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+195}:\\
\;\;\;\;1 - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -9.99999999999999945e-21 or 4.9999999999999998e-82 < (/.f64 1 n) < 1e5Initial program 73.2%
Taylor expanded in x around inf 93.4%
log-rec93.4%
mul-1-neg93.4%
mul-1-neg93.4%
distribute-frac-neg93.4%
neg-mul-193.4%
remove-double-neg93.4%
*-rgt-identity93.4%
associate-*r/93.4%
unpow-193.4%
exp-to-pow93.4%
unpow-193.4%
*-commutative93.4%
Simplified93.4%
if -9.99999999999999945e-21 < (/.f64 1 n) < 4.9999999999999998e-82Initial program 33.5%
Taylor expanded in n around inf 83.6%
log1p-def83.6%
Simplified83.6%
log1p-udef83.6%
diff-log83.6%
Applied egg-rr83.6%
if 1e5 < (/.f64 1 n) < 3.99999999999999991e195Initial program 67.8%
Taylor expanded in x around 0 67.8%
*-rgt-identity67.8%
associate-*r/67.8%
unpow-167.8%
exp-to-pow67.8%
unpow-167.8%
Simplified67.8%
if 3.99999999999999991e195 < (/.f64 1 n) Initial program 20.3%
Taylor expanded in n around inf 6.3%
log1p-def6.3%
Simplified6.3%
Taylor expanded in x around inf 74.6%
*-commutative74.6%
Simplified74.6%
Final simplification85.3%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) 5e-82)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 0.002)
(/ (/ 1.0 n) x)
(if (<= (/ 1.0 n) 4e+195) (- 1.0 (pow x (/ 1.0 n))) (/ 1.0 (* n x))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 5e-82) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 0.002) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 4e+195) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((1.0d0 / n) <= 5d-82) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 0.002d0) then
tmp = (1.0d0 / n) / x
else if ((1.0d0 / n) <= 4d+195) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= 5e-82) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 0.002) {
tmp = (1.0 / n) / x;
} else if ((1.0 / n) <= 4e+195) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= 5e-82: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 0.002: tmp = (1.0 / n) / x elif (1.0 / n) <= 4e+195: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = 1.0 / (n * x) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= 5e-82) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 0.002) tmp = Float64(Float64(1.0 / n) / x); elseif (Float64(1.0 / n) <= 4e+195) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= 5e-82) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 0.002) tmp = (1.0 / n) / x; elseif ((1.0 / n) <= 4e+195) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-82], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.002], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+195], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq 5 \cdot 10^{-82}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.002:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+195}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < 4.9999999999999998e-82Initial program 53.2%
Taylor expanded in n around inf 74.5%
log1p-def74.5%
Simplified74.5%
log1p-udef74.5%
diff-log74.6%
Applied egg-rr74.6%
if 4.9999999999999998e-82 < (/.f64 1 n) < 2e-3Initial program 4.9%
Taylor expanded in n around inf 26.2%
log1p-def26.2%
Simplified26.2%
Taylor expanded in x around inf 68.4%
*-commutative68.4%
Simplified68.4%
Taylor expanded in x around 0 68.4%
associate-/r*68.6%
Simplified68.6%
if 2e-3 < (/.f64 1 n) < 3.99999999999999991e195Initial program 66.1%
Taylor expanded in x around 0 66.1%
*-rgt-identity66.1%
associate-*r/66.1%
unpow-166.1%
exp-to-pow66.1%
unpow-166.1%
Simplified66.1%
if 3.99999999999999991e195 < (/.f64 1 n) Initial program 20.3%
Taylor expanded in n around inf 6.3%
log1p-def6.3%
Simplified6.3%
Taylor expanded in x around inf 74.6%
*-commutative74.6%
Simplified74.6%
Final simplification73.4%
(FPCore (x n) :precision binary64 (if (<= x 0.96) (- (/ x n) (/ (log x) n)) (if (<= x 4.2e+123) (/ (- (/ 1.0 x) (/ 0.5 (* x x))) n) (/ 0.0 n))))
double code(double x, double n) {
double tmp;
if (x <= 0.96) {
tmp = (x / n) - (log(x) / n);
} else if (x <= 4.2e+123) {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.96d0) then
tmp = (x / n) - (log(x) / n)
else if (x <= 4.2d+123) then
tmp = ((1.0d0 / x) - (0.5d0 / (x * x))) / n
else
tmp = 0.0d0 / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.96) {
tmp = (x / n) - (Math.log(x) / n);
} else if (x <= 4.2e+123) {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.96: tmp = (x / n) - (math.log(x) / n) elif x <= 4.2e+123: tmp = ((1.0 / x) - (0.5 / (x * x))) / n else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.96) tmp = Float64(Float64(x / n) - Float64(log(x) / n)); elseif (x <= 4.2e+123) tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.96) tmp = (x / n) - (log(x) / n); elseif (x <= 4.2e+123) tmp = ((1.0 / x) - (0.5 / (x * x))) / n; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.96], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.2e+123], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.96:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{+123}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 0.95999999999999996Initial program 34.5%
Taylor expanded in n around inf 58.5%
log1p-def58.5%
Simplified58.5%
Taylor expanded in x around 0 58.4%
neg-mul-158.4%
sub-neg58.4%
Simplified58.4%
div-sub58.4%
Applied egg-rr58.4%
if 0.95999999999999996 < x < 4.19999999999999988e123Initial program 42.3%
Taylor expanded in n around inf 40.9%
log1p-def40.9%
Simplified40.9%
Taylor expanded in x around inf 70.1%
associate-*r/70.1%
metadata-eval70.1%
unpow270.1%
Simplified70.1%
if 4.19999999999999988e123 < x Initial program 80.7%
Taylor expanded in n around inf 80.7%
log1p-def80.7%
Simplified80.7%
log1p-udef80.7%
diff-log80.7%
Applied egg-rr80.7%
Taylor expanded in x around inf 80.7%
Final simplification66.8%
(FPCore (x n) :precision binary64 (if (<= x 1.0) (/ (- x (log x)) n) (if (<= x 1.7e+124) (/ (- (/ 1.0 x) (/ 0.5 (* x x))) n) (/ 0.0 n))))
double code(double x, double n) {
double tmp;
if (x <= 1.0) {
tmp = (x - log(x)) / n;
} else if (x <= 1.7e+124) {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.0d0) then
tmp = (x - log(x)) / n
else if (x <= 1.7d+124) then
tmp = ((1.0d0 / x) - (0.5d0 / (x * x))) / n
else
tmp = 0.0d0 / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.0) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 1.7e+124) {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.0: tmp = (x - math.log(x)) / n elif x <= 1.7e+124: tmp = ((1.0 / x) - (0.5 / (x * x))) / n else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.0) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 1.7e+124) tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.0) tmp = (x - log(x)) / n; elseif (x <= 1.7e+124) tmp = ((1.0 / x) - (0.5 / (x * x))) / n; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 1.7e+124], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{+124}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 1Initial program 34.5%
Taylor expanded in n around inf 58.5%
log1p-def58.5%
Simplified58.5%
Taylor expanded in x around 0 58.4%
neg-mul-158.4%
sub-neg58.4%
Simplified58.4%
if 1 < x < 1.7e124Initial program 42.3%
Taylor expanded in n around inf 40.9%
log1p-def40.9%
Simplified40.9%
Taylor expanded in x around inf 70.1%
associate-*r/70.1%
metadata-eval70.1%
unpow270.1%
Simplified70.1%
if 1.7e124 < x Initial program 80.7%
Taylor expanded in n around inf 80.7%
log1p-def80.7%
Simplified80.7%
log1p-udef80.7%
diff-log80.7%
Applied egg-rr80.7%
Taylor expanded in x around inf 80.7%
Final simplification66.8%
(FPCore (x n) :precision binary64 (if (<= x 0.7) (/ (- (log x)) n) (if (<= x 4.8e+123) (/ (- (/ 1.0 x) (/ 0.5 (* x x))) n) (/ 0.0 n))))
double code(double x, double n) {
double tmp;
if (x <= 0.7) {
tmp = -log(x) / n;
} else if (x <= 4.8e+123) {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.7d0) then
tmp = -log(x) / n
else if (x <= 4.8d+123) then
tmp = ((1.0d0 / x) - (0.5d0 / (x * x))) / n
else
tmp = 0.0d0 / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.7) {
tmp = -Math.log(x) / n;
} else if (x <= 4.8e+123) {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.7: tmp = -math.log(x) / n elif x <= 4.8e+123: tmp = ((1.0 / x) - (0.5 / (x * x))) / n else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.7) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 4.8e+123) tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.7) tmp = -log(x) / n; elseif (x <= 4.8e+123) tmp = ((1.0 / x) - (0.5 / (x * x))) / n; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.7], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 4.8e+123], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.7:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+123}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 0.69999999999999996Initial program 34.5%
Taylor expanded in n around inf 58.5%
log1p-def58.5%
Simplified58.5%
Taylor expanded in x around 0 58.2%
neg-mul-158.2%
Simplified58.2%
if 0.69999999999999996 < x < 4.79999999999999978e123Initial program 42.3%
Taylor expanded in n around inf 40.9%
log1p-def40.9%
Simplified40.9%
Taylor expanded in x around inf 70.1%
associate-*r/70.1%
metadata-eval70.1%
unpow270.1%
Simplified70.1%
if 4.79999999999999978e123 < x Initial program 80.7%
Taylor expanded in n around inf 80.7%
log1p-def80.7%
Simplified80.7%
log1p-udef80.7%
diff-log80.7%
Applied egg-rr80.7%
Taylor expanded in x around inf 80.7%
Final simplification66.7%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -2000.0) (/ 0.0 n) (/ (/ 1.0 x) n)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2000.0) {
tmp = 0.0 / n;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((1.0d0 / n) <= (-2000.0d0)) then
tmp = 0.0d0 / n
else
tmp = (1.0d0 / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2000.0) {
tmp = 0.0 / n;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -2000.0: tmp = 0.0 / n else: tmp = (1.0 / x) / n return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -2000.0) tmp = Float64(0.0 / n); else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -2000.0) tmp = 0.0 / n; else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -2000.0], N[(0.0 / n), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -2000:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e3Initial program 100.0%
Taylor expanded in n around inf 60.2%
log1p-def60.2%
Simplified60.2%
log1p-udef60.2%
diff-log60.2%
Applied egg-rr60.2%
Taylor expanded in x around inf 58.7%
if -2e3 < (/.f64 1 n) Initial program 32.6%
Taylor expanded in n around inf 61.9%
log1p-def61.9%
Simplified61.9%
Taylor expanded in x around inf 48.5%
Final simplification51.0%
(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 48.9%
Taylor expanded in n around inf 61.5%
log1p-def61.5%
Simplified61.5%
Taylor expanded in x around inf 42.7%
*-commutative42.7%
Simplified42.7%
Final simplification42.7%
(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 48.9%
Taylor expanded in n around inf 61.5%
log1p-def61.5%
Simplified61.5%
Taylor expanded in x around inf 42.7%
*-commutative42.7%
Simplified42.7%
Taylor expanded in x around 0 42.7%
associate-/r*42.9%
Simplified42.9%
Final simplification42.9%
(FPCore (x n) :precision binary64 (/ (/ 1.0 x) n))
double code(double x, double n) {
return (1.0 / x) / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / x) / n
end function
public static double code(double x, double n) {
return (1.0 / x) / n;
}
def code(x, n): return (1.0 / x) / n
function code(x, n) return Float64(Float64(1.0 / x) / n) end
function tmp = code(x, n) tmp = (1.0 / x) / n; end
code[x_, n_] := N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{n}
\end{array}
Initial program 48.9%
Taylor expanded in n around inf 61.5%
log1p-def61.5%
Simplified61.5%
Taylor expanded in x around inf 43.0%
Final simplification43.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 48.9%
Taylor expanded in x around 0 27.7%
Taylor expanded in x around inf 4.6%
Final simplification4.6%
herbie shell --seed 2023279
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))