
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1.05e-11)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 1e-9)
(/ (log1p (/ 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) <= -1.05e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-9) {
tmp = log1p((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) <= -1.05e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-9) {
tmp = Math.log1p((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) <= -1.05e-11: tmp = t_0 / (n * x) elif (1.0 / n) <= 1e-9: tmp = math.log1p((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) <= -1.05e-11) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-9) tmp = Float64(log1p(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], -1.05e-11], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-9], N[(N[Log[1 + N[(1.0 / x), $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 -1.05 \cdot 10^{-11}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-9}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(\frac{1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.0499999999999999e-11Initial program 96.2%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -1.0499999999999999e-11 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000006e-9Initial program 25.6%
Taylor expanded in n around inf 74.8%
log1p-define74.8%
Simplified74.8%
add-exp-log74.2%
Applied egg-rr74.2%
Taylor expanded in n around 0 74.8%
log1p-define74.8%
rem-log-exp74.8%
exp-diff74.8%
log1p-define74.8%
+-commutative74.8%
rem-exp-log56.6%
rem-exp-log75.1%
*-lft-identity75.1%
associate-*l/70.1%
distribute-lft-in70.1%
lft-mult-inverse75.1%
*-rgt-identity75.1%
log1p-define98.2%
Simplified98.2%
if 1.00000000000000006e-9 < (/.f64 #s(literal 1 binary64) n) Initial program 54.5%
Taylor expanded in n around 0 54.5%
log1p-define94.5%
*-rgt-identity94.5%
associate-/l*94.5%
exp-to-pow94.5%
Simplified94.5%
Final simplification98.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1.05e-11)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 0.0001)
(/ (log1p (/ 1.0 x)) n)
(-
(+
1.0
(*
x
(+
(/ 1.0 n)
(* x (+ (* 0.5 (/ 1.0 (pow n 2.0))) (* 0.5 (/ -1.0 n)))))))
t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1.05e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.0001) {
tmp = log1p((1.0 / x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / pow(n, 2.0))) + (0.5 * (-1.0 / 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) <= -1.05e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.0001) {
tmp = Math.log1p((1.0 / x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / Math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))))) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1.05e-11: tmp = t_0 / (n * x) elif (1.0 / n) <= 0.0001: tmp = math.log1p((1.0 / x)) / n else: tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))))) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1.05e-11) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 0.0001) tmp = Float64(log1p(Float64(1.0 / x)) / n); else tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(x * Float64(Float64(0.5 * Float64(1.0 / (n ^ 2.0))) + Float64(0.5 * Float64(-1.0 / 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], -1.05e-11], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.0001], N[(N[Log[1 + N[(1.0 / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(x * N[(N[(0.5 * N[(1.0 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 -1.05 \cdot 10^{-11}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.0001:\\
\;\;\;\;\frac{\mathsf{log1p}\left(\frac{1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + x \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)\right)\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.0499999999999999e-11Initial program 96.2%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -1.0499999999999999e-11 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000005e-4Initial program 25.7%
Taylor expanded in n around inf 74.5%
log1p-define74.5%
Simplified74.5%
add-exp-log73.9%
Applied egg-rr73.9%
Taylor expanded in n around 0 74.5%
log1p-define74.5%
rem-log-exp74.5%
exp-diff74.5%
log1p-define74.5%
+-commutative74.5%
rem-exp-log56.4%
rem-exp-log74.8%
*-lft-identity74.8%
associate-*l/69.8%
distribute-lft-in69.8%
lft-mult-inverse74.8%
*-rgt-identity74.8%
log1p-define97.7%
Simplified97.7%
if 1.00000000000000005e-4 < (/.f64 #s(literal 1 binary64) n) Initial program 54.9%
Taylor expanded in x around 0 72.6%
Final simplification93.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1.05e-11)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 1e-9)
(/ (log1p (/ 1.0 x)) n)
(if (<= (/ 1.0 n) 1e+129)
(- (pow (+ 1.0 x) (/ 1.0 n)) t_0)
(log1p (expm1 (/ (/ 1.0 n) x))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1.05e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-9) {
tmp = log1p((1.0 / x)) / n;
} else if ((1.0 / n) <= 1e+129) {
tmp = pow((1.0 + x), (1.0 / n)) - t_0;
} else {
tmp = log1p(expm1(((1.0 / n) / x)));
}
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) <= -1.05e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-9) {
tmp = Math.log1p((1.0 / x)) / n;
} else if ((1.0 / n) <= 1e+129) {
tmp = Math.pow((1.0 + x), (1.0 / n)) - t_0;
} else {
tmp = Math.log1p(Math.expm1(((1.0 / n) / x)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1.05e-11: tmp = t_0 / (n * x) elif (1.0 / n) <= 1e-9: tmp = math.log1p((1.0 / x)) / n elif (1.0 / n) <= 1e+129: tmp = math.pow((1.0 + x), (1.0 / n)) - t_0 else: tmp = math.log1p(math.expm1(((1.0 / n) / x))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1.05e-11) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-9) tmp = Float64(log1p(Float64(1.0 / x)) / n); elseif (Float64(1.0 / n) <= 1e+129) tmp = Float64((Float64(1.0 + x) ^ Float64(1.0 / n)) - t_0); else tmp = log1p(expm1(Float64(Float64(1.0 / n) / x))); 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], -1.05e-11], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-9], N[(N[Log[1 + N[(1.0 / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+129], N[(N[Power[N[(1.0 + x), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], N[Log[1 + N[(Exp[N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1.05 \cdot 10^{-11}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-9}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(\frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+129}:\\
\;\;\;\;{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{n}}{x}\right)\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.0499999999999999e-11Initial program 96.2%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -1.0499999999999999e-11 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000006e-9Initial program 25.6%
Taylor expanded in n around inf 74.8%
log1p-define74.8%
Simplified74.8%
add-exp-log74.2%
Applied egg-rr74.2%
Taylor expanded in n around 0 74.8%
log1p-define74.8%
rem-log-exp74.8%
exp-diff74.8%
log1p-define74.8%
+-commutative74.8%
rem-exp-log56.6%
rem-exp-log75.1%
*-lft-identity75.1%
associate-*l/70.1%
distribute-lft-in70.1%
lft-mult-inverse75.1%
*-rgt-identity75.1%
log1p-define98.2%
Simplified98.2%
if 1.00000000000000006e-9 < (/.f64 #s(literal 1 binary64) n) < 1e129Initial program 73.5%
if 1e129 < (/.f64 #s(literal 1 binary64) n) Initial program 26.6%
Taylor expanded in n around inf 11.0%
log1p-define11.0%
Simplified11.0%
Taylor expanded in x around inf 50.0%
log1p-expm1-u74.5%
associate-/l/74.5%
associate-/r*74.5%
Applied egg-rr74.5%
Final simplification94.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1.05e-11)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 0.0001)
(/ (log1p (/ 1.0 x)) n)
(if (<= (/ 1.0 n) 5e+158)
(- (+ 1.0 (/ x n)) t_0)
(log1p (expm1 (/ (/ 1.0 n) x))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1.05e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.0001) {
tmp = log1p((1.0 / x)) / n;
} else if ((1.0 / n) <= 5e+158) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = log1p(expm1(((1.0 / n) / x)));
}
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) <= -1.05e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.0001) {
tmp = Math.log1p((1.0 / x)) / n;
} else if ((1.0 / n) <= 5e+158) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = Math.log1p(Math.expm1(((1.0 / n) / x)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1.05e-11: tmp = t_0 / (n * x) elif (1.0 / n) <= 0.0001: tmp = math.log1p((1.0 / x)) / n elif (1.0 / n) <= 5e+158: tmp = (1.0 + (x / n)) - t_0 else: tmp = math.log1p(math.expm1(((1.0 / n) / x))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1.05e-11) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 0.0001) tmp = Float64(log1p(Float64(1.0 / x)) / n); elseif (Float64(1.0 / n) <= 5e+158) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = log1p(expm1(Float64(Float64(1.0 / n) / x))); 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], -1.05e-11], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.0001], N[(N[Log[1 + N[(1.0 / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+158], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[Log[1 + N[(Exp[N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1.05 \cdot 10^{-11}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.0001:\\
\;\;\;\;\frac{\mathsf{log1p}\left(\frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+158}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{n}}{x}\right)\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.0499999999999999e-11Initial program 96.2%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -1.0499999999999999e-11 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000005e-4Initial program 25.7%
Taylor expanded in n around inf 74.5%
log1p-define74.5%
Simplified74.5%
add-exp-log73.9%
Applied egg-rr73.9%
Taylor expanded in n around 0 74.5%
log1p-define74.5%
rem-log-exp74.5%
exp-diff74.5%
log1p-define74.5%
+-commutative74.5%
rem-exp-log56.4%
rem-exp-log74.8%
*-lft-identity74.8%
associate-*l/69.8%
distribute-lft-in69.8%
lft-mult-inverse74.8%
*-rgt-identity74.8%
log1p-define97.7%
Simplified97.7%
if 1.00000000000000005e-4 < (/.f64 #s(literal 1 binary64) n) < 4.9999999999999996e158Initial program 70.6%
Taylor expanded in x around 0 70.6%
if 4.9999999999999996e158 < (/.f64 #s(literal 1 binary64) n) Initial program 15.1%
Taylor expanded in n around inf 14.0%
log1p-define14.0%
Simplified14.0%
Taylor expanded in x around inf 70.7%
log1p-expm1-u85.1%
associate-/l/85.1%
associate-/r*85.1%
Applied egg-rr85.1%
Final simplification94.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1.05e-11)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 0.0001)
(/ (log1p (/ 1.0 x)) n)
(if (<= (/ 1.0 n) 5e+158)
(- (+ 1.0 (/ x n)) t_0)
(/
(/ 1.0 (/ x (+ (/ (+ (/ 0.3333333333333333 x) -0.5) x) -1.0)))
n))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1.05e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.0001) {
tmp = log1p((1.0 / x)) / n;
} else if ((1.0 / n) <= 5e+158) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = (1.0 / (x / ((((0.3333333333333333 / x) + -0.5) / x) + -1.0))) / n;
}
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) <= -1.05e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.0001) {
tmp = Math.log1p((1.0 / x)) / n;
} else if ((1.0 / n) <= 5e+158) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = (1.0 / (x / ((((0.3333333333333333 / x) + -0.5) / x) + -1.0))) / n;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1.05e-11: tmp = t_0 / (n * x) elif (1.0 / n) <= 0.0001: tmp = math.log1p((1.0 / x)) / n elif (1.0 / n) <= 5e+158: tmp = (1.0 + (x / n)) - t_0 else: tmp = (1.0 / (x / ((((0.3333333333333333 / x) + -0.5) / x) + -1.0))) / n return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1.05e-11) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 0.0001) tmp = Float64(log1p(Float64(1.0 / x)) / n); elseif (Float64(1.0 / n) <= 5e+158) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(Float64(1.0 / Float64(x / Float64(Float64(Float64(Float64(0.3333333333333333 / x) + -0.5) / x) + -1.0))) / n); 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], -1.05e-11], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.0001], N[(N[Log[1 + N[(1.0 / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+158], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(1.0 / N[(x / N[(N[(N[(N[(0.3333333333333333 / x), $MachinePrecision] + -0.5), $MachinePrecision] / x), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1.05 \cdot 10^{-11}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.0001:\\
\;\;\;\;\frac{\mathsf{log1p}\left(\frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+158}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\frac{x}{\frac{\frac{0.3333333333333333}{x} + -0.5}{x} + -1}}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.0499999999999999e-11Initial program 96.2%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -1.0499999999999999e-11 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000005e-4Initial program 25.7%
Taylor expanded in n around inf 74.5%
log1p-define74.5%
Simplified74.5%
add-exp-log73.9%
Applied egg-rr73.9%
Taylor expanded in n around 0 74.5%
log1p-define74.5%
rem-log-exp74.5%
exp-diff74.5%
log1p-define74.5%
+-commutative74.5%
rem-exp-log56.4%
rem-exp-log74.8%
*-lft-identity74.8%
associate-*l/69.8%
distribute-lft-in69.8%
lft-mult-inverse74.8%
*-rgt-identity74.8%
log1p-define97.7%
Simplified97.7%
if 1.00000000000000005e-4 < (/.f64 #s(literal 1 binary64) n) < 4.9999999999999996e158Initial program 70.6%
Taylor expanded in x around 0 70.6%
if 4.9999999999999996e158 < (/.f64 #s(literal 1 binary64) n) Initial program 15.1%
Taylor expanded in n around inf 14.0%
log1p-define14.0%
Simplified14.0%
Taylor expanded in x around -inf 77.9%
add-sqr-sqrt77.9%
sqrt-unprod77.9%
mul-1-neg77.9%
mul-1-neg77.9%
sqr-neg77.9%
sqrt-unprod0.0%
add-sqr-sqrt0.1%
clear-num0.1%
sub-neg0.1%
Applied egg-rr77.9%
Final simplification93.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1.05e-11)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 0.0001)
(/ (log1p (/ 1.0 x)) n)
(if (<= (/ 1.0 n) 1e+156)
(- 1.0 t_0)
(/
(/ 1.0 (/ x (+ (/ (+ (/ 0.3333333333333333 x) -0.5) x) -1.0)))
n))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1.05e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.0001) {
tmp = log1p((1.0 / x)) / n;
} else if ((1.0 / n) <= 1e+156) {
tmp = 1.0 - t_0;
} else {
tmp = (1.0 / (x / ((((0.3333333333333333 / x) + -0.5) / x) + -1.0))) / n;
}
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) <= -1.05e-11) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.0001) {
tmp = Math.log1p((1.0 / x)) / n;
} else if ((1.0 / n) <= 1e+156) {
tmp = 1.0 - t_0;
} else {
tmp = (1.0 / (x / ((((0.3333333333333333 / x) + -0.5) / x) + -1.0))) / n;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1.05e-11: tmp = t_0 / (n * x) elif (1.0 / n) <= 0.0001: tmp = math.log1p((1.0 / x)) / n elif (1.0 / n) <= 1e+156: tmp = 1.0 - t_0 else: tmp = (1.0 / (x / ((((0.3333333333333333 / x) + -0.5) / x) + -1.0))) / n return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1.05e-11) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 0.0001) tmp = Float64(log1p(Float64(1.0 / x)) / n); elseif (Float64(1.0 / n) <= 1e+156) tmp = Float64(1.0 - t_0); else tmp = Float64(Float64(1.0 / Float64(x / Float64(Float64(Float64(Float64(0.3333333333333333 / x) + -0.5) / x) + -1.0))) / n); 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], -1.05e-11], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.0001], N[(N[Log[1 + N[(1.0 / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+156], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(1.0 / N[(x / N[(N[(N[(N[(0.3333333333333333 / x), $MachinePrecision] + -0.5), $MachinePrecision] / x), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1.05 \cdot 10^{-11}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.0001:\\
\;\;\;\;\frac{\mathsf{log1p}\left(\frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+156}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\frac{x}{\frac{\frac{0.3333333333333333}{x} + -0.5}{x} + -1}}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.0499999999999999e-11Initial program 96.2%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
log-rec100.0%
mul-1-neg100.0%
distribute-neg-frac100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-rgt-identity100.0%
associate-/l*100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -1.0499999999999999e-11 < (/.f64 #s(literal 1 binary64) n) < 1.00000000000000005e-4Initial program 25.7%
Taylor expanded in n around inf 74.5%
log1p-define74.5%
Simplified74.5%
add-exp-log73.9%
Applied egg-rr73.9%
Taylor expanded in n around 0 74.5%
log1p-define74.5%
rem-log-exp74.5%
exp-diff74.5%
log1p-define74.5%
+-commutative74.5%
rem-exp-log56.4%
rem-exp-log74.8%
*-lft-identity74.8%
associate-*l/69.8%
distribute-lft-in69.8%
lft-mult-inverse74.8%
*-rgt-identity74.8%
log1p-define97.7%
Simplified97.7%
if 1.00000000000000005e-4 < (/.f64 #s(literal 1 binary64) n) < 9.9999999999999998e155Initial program 71.8%
Taylor expanded in x around 0 71.7%
*-rgt-identity71.7%
associate-/l*71.7%
exp-to-pow71.7%
Simplified71.7%
if 9.9999999999999998e155 < (/.f64 #s(literal 1 binary64) n) Initial program 19.9%
Taylor expanded in n around inf 12.8%
log1p-define12.8%
Simplified12.8%
Taylor expanded in x around -inf 74.4%
add-sqr-sqrt74.4%
sqrt-unprod74.4%
mul-1-neg74.4%
mul-1-neg74.4%
sqr-neg74.4%
sqrt-unprod0.0%
add-sqr-sqrt0.1%
clear-num0.1%
sub-neg0.1%
Applied egg-rr74.4%
Final simplification93.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log1p (/ 1.0 x)) n)))
(if (<= n -0.0037)
t_0
(if (<= n -3.7e-116)
(/ 0.0 n)
(if (<= n 9.6e-167)
(/ (/ (- (* x (/ (+ (/ 0.3333333333333333 x) -0.5) x)) x) (* x x)) n)
(if (<= n 19000.0) (- 1.0 (pow x (/ 1.0 n))) t_0))))))
double code(double x, double n) {
double t_0 = log1p((1.0 / x)) / n;
double tmp;
if (n <= -0.0037) {
tmp = t_0;
} else if (n <= -3.7e-116) {
tmp = 0.0 / n;
} else if (n <= 9.6e-167) {
tmp = (((x * (((0.3333333333333333 / x) + -0.5) / x)) - x) / (x * x)) / n;
} else if (n <= 19000.0) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.log1p((1.0 / x)) / n;
double tmp;
if (n <= -0.0037) {
tmp = t_0;
} else if (n <= -3.7e-116) {
tmp = 0.0 / n;
} else if (n <= 9.6e-167) {
tmp = (((x * (((0.3333333333333333 / x) + -0.5) / x)) - x) / (x * x)) / n;
} else if (n <= 19000.0) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = math.log1p((1.0 / x)) / n tmp = 0 if n <= -0.0037: tmp = t_0 elif n <= -3.7e-116: tmp = 0.0 / n elif n <= 9.6e-167: tmp = (((x * (((0.3333333333333333 / x) + -0.5) / x)) - x) / (x * x)) / n elif n <= 19000.0: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(log1p(Float64(1.0 / x)) / n) tmp = 0.0 if (n <= -0.0037) tmp = t_0; elseif (n <= -3.7e-116) tmp = Float64(0.0 / n); elseif (n <= 9.6e-167) tmp = Float64(Float64(Float64(Float64(x * Float64(Float64(Float64(0.3333333333333333 / x) + -0.5) / x)) - x) / Float64(x * x)) / n); elseif (n <= 19000.0) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = t_0; end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[1 + N[(1.0 / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[n, -0.0037], t$95$0, If[LessEqual[n, -3.7e-116], N[(0.0 / n), $MachinePrecision], If[LessEqual[n, 9.6e-167], N[(N[(N[(N[(x * N[(N[(N[(0.3333333333333333 / x), $MachinePrecision] + -0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, 19000.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{\mathsf{log1p}\left(\frac{1}{x}\right)}{n}\\
\mathbf{if}\;n \leq -0.0037:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -3.7 \cdot 10^{-116}:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{elif}\;n \leq 9.6 \cdot 10^{-167}:\\
\;\;\;\;\frac{\frac{x \cdot \frac{\frac{0.3333333333333333}{x} + -0.5}{x} - x}{x \cdot x}}{n}\\
\mathbf{elif}\;n \leq 19000:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -0.0037000000000000002 or 19000 < n Initial program 25.8%
Taylor expanded in n around inf 72.5%
log1p-define72.5%
Simplified72.5%
add-exp-log71.9%
Applied egg-rr71.9%
Taylor expanded in n around 0 72.5%
log1p-define72.5%
rem-log-exp72.5%
exp-diff72.5%
log1p-define72.5%
+-commutative72.5%
rem-exp-log54.9%
rem-exp-log72.8%
*-lft-identity72.8%
associate-*l/68.0%
distribute-lft-in68.0%
lft-mult-inverse72.8%
*-rgt-identity72.8%
log1p-define96.0%
Simplified96.0%
if -0.0037000000000000002 < n < -3.7000000000000002e-116Initial program 100.0%
Taylor expanded in n around inf 70.6%
log1p-define70.6%
Simplified70.6%
log1p-undefine70.6%
diff-log70.6%
Applied egg-rr70.6%
Taylor expanded in x around inf 78.6%
if -3.7000000000000002e-116 < n < 9.59999999999999972e-167Initial program 81.9%
Taylor expanded in n around inf 44.6%
log1p-define44.6%
Simplified44.6%
Taylor expanded in x around -inf 50.9%
add-sqr-sqrt50.9%
sqrt-unprod66.8%
mul-1-neg66.8%
mul-1-neg66.8%
sqr-neg66.8%
sqrt-unprod0.0%
add-sqr-sqrt1.1%
div-sub1.1%
frac-2neg1.1%
metadata-eval1.1%
frac-sub17.0%
Applied egg-rr66.8%
if 9.59999999999999972e-167 < n < 19000Initial program 70.6%
Taylor expanded in x around 0 70.5%
*-rgt-identity70.5%
associate-/l*70.5%
exp-to-pow70.5%
Simplified70.5%
Final simplification84.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log1p (/ 1.0 x)) n)))
(if (<= n -0.0037)
t_0
(if (<= n -3.7e-116)
(/ 0.0 n)
(if (<= n 9e-109)
(/ (/ (- (* x (/ (+ (/ 0.3333333333333333 x) -0.5) x)) x) (* x x)) n)
t_0)))))
double code(double x, double n) {
double t_0 = log1p((1.0 / x)) / n;
double tmp;
if (n <= -0.0037) {
tmp = t_0;
} else if (n <= -3.7e-116) {
tmp = 0.0 / n;
} else if (n <= 9e-109) {
tmp = (((x * (((0.3333333333333333 / x) + -0.5) / x)) - x) / (x * x)) / n;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.log1p((1.0 / x)) / n;
double tmp;
if (n <= -0.0037) {
tmp = t_0;
} else if (n <= -3.7e-116) {
tmp = 0.0 / n;
} else if (n <= 9e-109) {
tmp = (((x * (((0.3333333333333333 / x) + -0.5) / x)) - x) / (x * x)) / n;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = math.log1p((1.0 / x)) / n tmp = 0 if n <= -0.0037: tmp = t_0 elif n <= -3.7e-116: tmp = 0.0 / n elif n <= 9e-109: tmp = (((x * (((0.3333333333333333 / x) + -0.5) / x)) - x) / (x * x)) / n else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(log1p(Float64(1.0 / x)) / n) tmp = 0.0 if (n <= -0.0037) tmp = t_0; elseif (n <= -3.7e-116) tmp = Float64(0.0 / n); elseif (n <= 9e-109) tmp = Float64(Float64(Float64(Float64(x * Float64(Float64(Float64(0.3333333333333333 / x) + -0.5) / x)) - x) / Float64(x * x)) / n); else tmp = t_0; end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[1 + N[(1.0 / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[n, -0.0037], t$95$0, If[LessEqual[n, -3.7e-116], N[(0.0 / n), $MachinePrecision], If[LessEqual[n, 9e-109], N[(N[(N[(N[(x * N[(N[(N[(0.3333333333333333 / x), $MachinePrecision] + -0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{log1p}\left(\frac{1}{x}\right)}{n}\\
\mathbf{if}\;n \leq -0.0037:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -3.7 \cdot 10^{-116}:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{elif}\;n \leq 9 \cdot 10^{-109}:\\
\;\;\;\;\frac{\frac{x \cdot \frac{\frac{0.3333333333333333}{x} + -0.5}{x} - x}{x \cdot x}}{n}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -0.0037000000000000002 or 9.0000000000000002e-109 < n Initial program 32.1%
Taylor expanded in n around inf 64.2%
log1p-define64.3%
Simplified64.3%
add-exp-log63.7%
Applied egg-rr63.7%
Taylor expanded in n around 0 64.2%
log1p-define64.3%
rem-log-exp64.2%
exp-diff64.2%
log1p-define64.2%
+-commutative64.2%
rem-exp-log48.8%
rem-exp-log64.5%
*-lft-identity64.5%
associate-*l/60.3%
distribute-lft-in60.3%
lft-mult-inverse64.5%
*-rgt-identity64.5%
log1p-define84.8%
Simplified84.8%
if -0.0037000000000000002 < n < -3.7000000000000002e-116Initial program 100.0%
Taylor expanded in n around inf 70.6%
log1p-define70.6%
Simplified70.6%
log1p-undefine70.6%
diff-log70.6%
Applied egg-rr70.6%
Taylor expanded in x around inf 78.6%
if -3.7000000000000002e-116 < n < 9.0000000000000002e-109Initial program 78.5%
Taylor expanded in n around inf 37.6%
log1p-define37.6%
Simplified37.6%
Taylor expanded in x around -inf 47.8%
add-sqr-sqrt47.8%
sqrt-unprod60.9%
mul-1-neg60.9%
mul-1-neg60.9%
sqr-neg60.9%
sqrt-unprod0.0%
add-sqr-sqrt1.0%
div-sub1.0%
frac-2neg1.0%
metadata-eval1.0%
frac-sub14.1%
Applied egg-rr60.9%
Final simplification77.4%
(FPCore (x n)
:precision binary64
(if (<= x 0.58)
(/ (- (log x)) n)
(if (<= x 1.7e+165)
(/ (+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* n x)) (/ -0.5 n)) x)) x)
(/ (/ (- (* x (/ (+ (/ 0.3333333333333333 x) -0.5) x)) x) (* x x)) n))))
double code(double x, double n) {
double tmp;
if (x <= 0.58) {
tmp = -log(x) / n;
} else if (x <= 1.7e+165) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
} else {
tmp = (((x * (((0.3333333333333333 / x) + -0.5) / x)) - x) / (x * x)) / 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.58d0) then
tmp = -log(x) / n
else if (x <= 1.7d+165) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) + ((-0.5d0) / n)) / x)) / x
else
tmp = (((x * (((0.3333333333333333d0 / x) + (-0.5d0)) / x)) - x) / (x * x)) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.58) {
tmp = -Math.log(x) / n;
} else if (x <= 1.7e+165) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
} else {
tmp = (((x * (((0.3333333333333333 / x) + -0.5) / x)) - x) / (x * x)) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.58: tmp = -math.log(x) / n elif x <= 1.7e+165: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x else: tmp = (((x * (((0.3333333333333333 / x) + -0.5) / x)) - x) / (x * x)) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.58) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 1.7e+165) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) + Float64(-0.5 / n)) / x)) / x); else tmp = Float64(Float64(Float64(Float64(x * Float64(Float64(Float64(0.3333333333333333 / x) + -0.5) / x)) - x) / Float64(x * x)) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.58) tmp = -log(x) / n; elseif (x <= 1.7e+165) tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x; else tmp = (((x * (((0.3333333333333333 / x) + -0.5) / x)) - x) / (x * x)) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.58], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 1.7e+165], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[(x * N[(N[(N[(0.3333333333333333 / x), $MachinePrecision] + -0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.58:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{+165}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot \frac{\frac{0.3333333333333333}{x} + -0.5}{x} - x}{x \cdot x}}{n}\\
\end{array}
\end{array}
if x < 0.57999999999999996Initial program 41.8%
Taylor expanded in x around 0 41.8%
*-rgt-identity41.8%
associate-/l*41.8%
exp-to-pow41.8%
Simplified41.8%
Taylor expanded in n around inf 51.3%
associate-*r/51.3%
neg-mul-151.3%
Simplified51.3%
if 0.57999999999999996 < x < 1.70000000000000005e165Initial program 48.4%
Taylor expanded in n around inf 46.4%
log1p-define46.4%
Simplified46.4%
add-exp-log46.4%
Applied egg-rr46.4%
Taylor expanded in x around -inf 59.2%
associate-*r/59.2%
Simplified59.2%
if 1.70000000000000005e165 < x Initial program 83.3%
Taylor expanded in n around inf 83.3%
log1p-define83.3%
Simplified83.3%
Taylor expanded in x around -inf 57.0%
add-sqr-sqrt57.0%
sqrt-unprod83.3%
mul-1-neg83.3%
mul-1-neg83.3%
sqr-neg83.3%
sqrt-unprod0.0%
add-sqr-sqrt47.3%
div-sub47.3%
frac-2neg47.3%
metadata-eval47.3%
frac-sub83.3%
Applied egg-rr83.3%
Final simplification59.5%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -2e+118)
(/ (/ (- (* x (/ (+ (/ 0.3333333333333333 x) -0.5) x)) x) (* x x)) n)
(if (<= (/ 1.0 n) -1000000.0)
(/ 0.0 n)
(/ (+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* n x)) (/ -0.5 n)) x)) x))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e+118) {
tmp = (((x * (((0.3333333333333333 / x) + -0.5) / x)) - x) / (x * x)) / n;
} else if ((1.0 / n) <= -1000000.0) {
tmp = 0.0 / n;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / 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) <= (-2d+118)) then
tmp = (((x * (((0.3333333333333333d0 / x) + (-0.5d0)) / x)) - x) / (x * x)) / n
else if ((1.0d0 / n) <= (-1000000.0d0)) then
tmp = 0.0d0 / n
else
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) + ((-0.5d0) / n)) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e+118) {
tmp = (((x * (((0.3333333333333333 / x) + -0.5) / x)) - x) / (x * x)) / n;
} else if ((1.0 / n) <= -1000000.0) {
tmp = 0.0 / n;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -2e+118: tmp = (((x * (((0.3333333333333333 / x) + -0.5) / x)) - x) / (x * x)) / n elif (1.0 / n) <= -1000000.0: tmp = 0.0 / n else: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -2e+118) tmp = Float64(Float64(Float64(Float64(x * Float64(Float64(Float64(0.3333333333333333 / x) + -0.5) / x)) - x) / Float64(x * x)) / n); elseif (Float64(1.0 / n) <= -1000000.0) tmp = Float64(0.0 / n); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) + Float64(-0.5 / n)) / x)) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -2e+118) tmp = (((x * (((0.3333333333333333 / x) + -0.5) / x)) - x) / (x * x)) / n; elseif ((1.0 / n) <= -1000000.0) tmp = 0.0 / n; else tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+118], N[(N[(N[(N[(x * N[(N[(N[(0.3333333333333333 / x), $MachinePrecision] + -0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1000000.0], N[(0.0 / n), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{+118}:\\
\;\;\;\;\frac{\frac{x \cdot \frac{\frac{0.3333333333333333}{x} + -0.5}{x} - x}{x \cdot x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -1000000:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.99999999999999993e118Initial program 100.0%
Taylor expanded in n around inf 52.9%
log1p-define52.9%
Simplified52.9%
Taylor expanded in x around -inf 43.6%
add-sqr-sqrt43.6%
sqrt-unprod63.9%
mul-1-neg63.9%
mul-1-neg63.9%
sqr-neg63.9%
sqrt-unprod0.0%
add-sqr-sqrt1.3%
div-sub1.3%
frac-2neg1.3%
metadata-eval1.3%
frac-sub21.5%
Applied egg-rr63.9%
if -1.99999999999999993e118 < (/.f64 #s(literal 1 binary64) n) < -1e6Initial program 100.0%
Taylor expanded in n around inf 70.6%
log1p-define70.6%
Simplified70.6%
log1p-undefine70.6%
diff-log70.6%
Applied egg-rr70.6%
Taylor expanded in x around inf 78.6%
if -1e6 < (/.f64 #s(literal 1 binary64) n) Initial program 33.0%
Taylor expanded in n around inf 56.5%
log1p-define56.5%
Simplified56.5%
add-exp-log56.1%
Applied egg-rr56.1%
Taylor expanded in x around -inf 43.7%
associate-*r/43.7%
Simplified43.7%
Final simplification50.6%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -1000000.0) (/ (/ (- (* x (/ (+ (/ 0.3333333333333333 x) -0.5) x)) x) (* x x)) n) (/ (+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* n x)) (/ -0.5 n)) x)) x)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1000000.0) {
tmp = (((x * (((0.3333333333333333 / x) + -0.5) / x)) - x) / (x * x)) / n;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / 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) <= (-1000000.0d0)) then
tmp = (((x * (((0.3333333333333333d0 / x) + (-0.5d0)) / x)) - x) / (x * x)) / n
else
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) + ((-0.5d0) / n)) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1000000.0) {
tmp = (((x * (((0.3333333333333333 / x) + -0.5) / x)) - x) / (x * x)) / n;
} else {
tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1000000.0: tmp = (((x * (((0.3333333333333333 / x) + -0.5) / x)) - x) / (x * x)) / n else: tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1000000.0) tmp = Float64(Float64(Float64(Float64(x * Float64(Float64(Float64(0.3333333333333333 / x) + -0.5) / x)) - x) / Float64(x * x)) / n); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) + Float64(-0.5 / n)) / x)) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -1000000.0) tmp = (((x * (((0.3333333333333333 / x) + -0.5) / x)) - x) / (x * x)) / n; else tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1000000.0], N[(N[(N[(N[(x * N[(N[(N[(0.3333333333333333 / x), $MachinePrecision] + -0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1000000:\\
\;\;\;\;\frac{\frac{x \cdot \frac{\frac{0.3333333333333333}{x} + -0.5}{x} - x}{x \cdot x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1e6Initial program 100.0%
Taylor expanded in n around inf 58.6%
log1p-define58.6%
Simplified58.6%
Taylor expanded in x around -inf 36.3%
add-sqr-sqrt36.3%
sqrt-unprod61.9%
mul-1-neg61.9%
mul-1-neg61.9%
sqr-neg61.9%
sqrt-unprod0.0%
add-sqr-sqrt2.0%
div-sub2.0%
frac-2neg2.0%
metadata-eval2.0%
frac-sub27.6%
Applied egg-rr61.9%
if -1e6 < (/.f64 #s(literal 1 binary64) n) Initial program 33.0%
Taylor expanded in n around inf 56.5%
log1p-define56.5%
Simplified56.5%
add-exp-log56.1%
Applied egg-rr56.1%
Taylor expanded in x around -inf 43.7%
associate-*r/43.7%
Simplified43.7%
Final simplification48.7%
(FPCore (x n) :precision binary64 (/ (+ (/ 1.0 n) (/ (+ (/ 0.3333333333333333 (* n x)) (/ -0.5 n)) x)) x))
double code(double x, double n) {
return ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((1.0d0 / n) + (((0.3333333333333333d0 / (n * x)) + ((-0.5d0) / n)) / x)) / x
end function
public static double code(double x, double n) {
return ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x;
}
def code(x, n): return ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x
function code(x, n) return Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(n * x)) + Float64(-0.5 / n)) / x)) / x) end
function tmp = code(x, n) tmp = ((1.0 / n) + (((0.3333333333333333 / (n * x)) + (-0.5 / n)) / x)) / x; end
code[x_, n_] := N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(n * x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{n \cdot x} + \frac{-0.5}{n}}{x}}{x}
\end{array}
Initial program 51.6%
Taylor expanded in n around inf 57.1%
log1p-define57.1%
Simplified57.1%
add-exp-log56.8%
Applied egg-rr56.8%
Taylor expanded in x around -inf 41.6%
associate-*r/41.6%
Simplified41.6%
Final simplification41.6%
(FPCore (x n) :precision binary64 (/ (/ (+ 1.0 (/ (+ (/ 0.3333333333333333 x) -0.5) x)) x) n))
double code(double x, double n) {
return ((1.0 + (((0.3333333333333333 / x) + -0.5) / x)) / x) / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((1.0d0 + (((0.3333333333333333d0 / x) + (-0.5d0)) / x)) / x) / n
end function
public static double code(double x, double n) {
return ((1.0 + (((0.3333333333333333 / x) + -0.5) / x)) / x) / n;
}
def code(x, n): return ((1.0 + (((0.3333333333333333 / x) + -0.5) / x)) / x) / n
function code(x, n) return Float64(Float64(Float64(1.0 + Float64(Float64(Float64(0.3333333333333333 / x) + -0.5) / x)) / x) / n) end
function tmp = code(x, n) tmp = ((1.0 + (((0.3333333333333333 / x) + -0.5) / x)) / x) / n; end
code[x_, n_] := N[(N[(N[(1.0 + N[(N[(N[(0.3333333333333333 / x), $MachinePrecision] + -0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1 + \frac{\frac{0.3333333333333333}{x} + -0.5}{x}}{x}}{n}
\end{array}
Initial program 51.6%
Taylor expanded in n around inf 57.1%
log1p-define57.1%
Simplified57.1%
log1p-expm1-u48.1%
expm1-undefine48.1%
add-exp-log48.1%
Applied egg-rr48.1%
Taylor expanded in x around inf 41.6%
associate--l+41.6%
unpow241.6%
associate-/r*41.6%
metadata-eval41.6%
associate-*r/41.6%
associate-*r/41.6%
metadata-eval41.6%
div-sub41.6%
sub-neg41.6%
metadata-eval41.6%
+-commutative41.6%
associate-*r/41.6%
metadata-eval41.6%
Simplified41.6%
Final simplification41.6%
(FPCore (x n) :precision binary64 (/ (- 1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) (* n x)))
double code(double x, double n) {
return (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (n * x);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 - ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / (n * x)
end function
public static double code(double x, double n) {
return (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (n * x);
}
def code(x, n): return (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (n * x)
function code(x, n) return Float64(Float64(1.0 - Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / Float64(n * x)) end
function tmp = code(x, n) tmp = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (n * x); end
code[x_, n_] := N[(N[(1.0 - N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{n \cdot x}
\end{array}
Initial program 51.6%
Taylor expanded in n around inf 57.1%
log1p-define57.1%
Simplified57.1%
Taylor expanded in x around -inf 41.6%
Taylor expanded in n around 0 40.7%
Simplified40.7%
Final simplification40.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 51.6%
Taylor expanded in n around inf 57.1%
log1p-define57.1%
Simplified57.1%
Taylor expanded in x around inf 35.8%
*-un-lft-identity35.8%
*-commutative35.8%
associate-/l/34.9%
associate-/r*35.8%
Applied egg-rr35.8%
Final simplification35.8%
(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 51.6%
Taylor expanded in n around inf 57.1%
log1p-define57.1%
Simplified57.1%
Taylor expanded in x around inf 35.8%
(FPCore (x n) :precision binary64 (/ 1.0 (* n x)))
double code(double x, double n) {
return 1.0 / (n * x);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 1.0d0 / (n * x)
end function
public static double code(double x, double n) {
return 1.0 / (n * x);
}
def code(x, n): return 1.0 / (n * x)
function code(x, n) return Float64(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 51.6%
Taylor expanded in n around inf 57.1%
log1p-define57.1%
Simplified57.1%
add-exp-log56.8%
Applied egg-rr56.8%
Taylor expanded in x around inf 34.9%
*-commutative34.9%
Simplified34.9%
Final simplification34.9%
(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 51.6%
Taylor expanded in n around inf 57.1%
log1p-define57.1%
Simplified57.1%
Taylor expanded in x around 0 30.6%
Taylor expanded in x around inf 4.6%
herbie shell --seed 2024113
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))