
(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 21 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) -3.2e-79)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 1e-16)
(/ (log (+ 1.0 (/ 1.0 x))) n)
(pow (sqrt (- (exp (/ (log1p x) n)) t_0)) 2.0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -3.2e-79) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 1e-16) {
tmp = log((1.0 + (1.0 / x))) / n;
} else {
tmp = pow(sqrt((exp((log1p(x) / n)) - t_0)), 2.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) <= -3.2e-79) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 1e-16) {
tmp = Math.log((1.0 + (1.0 / x))) / n;
} else {
tmp = Math.pow(Math.sqrt((Math.exp((Math.log1p(x) / n)) - t_0)), 2.0);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -3.2e-79: tmp = (t_0 / n) / x elif (1.0 / n) <= 1e-16: tmp = math.log((1.0 + (1.0 / x))) / n else: tmp = math.pow(math.sqrt((math.exp((math.log1p(x) / n)) - t_0)), 2.0) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -3.2e-79) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 1e-16) tmp = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n); else tmp = sqrt(Float64(exp(Float64(log1p(x) / n)) - t_0)) ^ 2.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], -3.2e-79], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-16], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[Power[N[Sqrt[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -3.2 \cdot 10^{-79}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-16}:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0}\right)}^{2}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.19999999999999988e-79Initial program 90.2%
Taylor expanded in x around inf 25.3%
Simplified25.3%
Taylor expanded in x around inf 96.4%
mul-1-neg96.4%
log-rec96.4%
distribute-neg-frac96.4%
remove-double-neg96.4%
Simplified96.4%
Taylor expanded in x around inf 96.4%
mul-1-neg96.4%
log-rec96.4%
distribute-frac-neg96.4%
remove-double-neg96.4%
*-rgt-identity96.4%
associate-*r/96.4%
exp-to-pow96.4%
Simplified96.4%
if -3.19999999999999988e-79 < (/.f64 #s(literal 1 binary64) n) < 9.9999999999999998e-17Initial program 31.8%
Taylor expanded in n around inf 80.0%
log1p-define80.0%
Simplified80.0%
expm1-log1p-u79.4%
Applied egg-rr79.4%
expm1-log1p-u80.0%
log1p-undefine80.0%
diff-log80.3%
Applied egg-rr80.3%
+-commutative80.3%
Simplified80.3%
Taylor expanded in x around inf 80.3%
if 9.9999999999999998e-17 < (/.f64 #s(literal 1 binary64) n) Initial program 64.4%
add-sqr-sqrt64.4%
pow264.4%
pow-to-exp64.2%
un-div-inv64.3%
+-commutative64.3%
log1p-define91.4%
Applied egg-rr91.4%
(FPCore (x n)
:precision binary64
(if (<= x 2200.0)
(/
(-
(+
(log1p x)
(/
(+
(* 0.5 (- (pow (log1p x) 2.0) (pow (log x) 2.0)))
(*
0.16666666666666666
(/ (- (pow (log1p x) 3.0) (pow (log x) 3.0)) n)))
n))
(log x))
n)
(/ (/ (pow E (/ (log x) n)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 2200.0) {
tmp = ((log1p(x) + (((0.5 * (pow(log1p(x), 2.0) - pow(log(x), 2.0))) + (0.16666666666666666 * ((pow(log1p(x), 3.0) - pow(log(x), 3.0)) / n))) / n)) - log(x)) / n;
} else {
tmp = (pow(((double) M_E), (log(x) / n)) / n) / x;
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if (x <= 2200.0) {
tmp = ((Math.log1p(x) + (((0.5 * (Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0))) + (0.16666666666666666 * ((Math.pow(Math.log1p(x), 3.0) - Math.pow(Math.log(x), 3.0)) / n))) / n)) - Math.log(x)) / n;
} else {
tmp = (Math.pow(Math.E, (Math.log(x) / n)) / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2200.0: tmp = ((math.log1p(x) + (((0.5 * (math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0))) + (0.16666666666666666 * ((math.pow(math.log1p(x), 3.0) - math.pow(math.log(x), 3.0)) / n))) / n)) - math.log(x)) / n else: tmp = (math.pow(math.e, (math.log(x) / n)) / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 2200.0) tmp = Float64(Float64(Float64(log1p(x) + Float64(Float64(Float64(0.5 * Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0))) + Float64(0.16666666666666666 * Float64(Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0)) / n))) / n)) - log(x)) / n); else tmp = Float64(Float64((exp(1) ^ Float64(log(x) / n)) / n) / x); end return tmp end
code[x_, n_] := If[LessEqual[x, 2200.0], N[(N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[Power[E, N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2200:\\
\;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{0.5 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) + 0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}}{n}\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{e}^{\left(\frac{\log x}{n}\right)}}{n}}{x}\\
\end{array}
\end{array}
if x < 2200Initial program 47.8%
Taylor expanded in n around -inf 76.8%
Simplified76.8%
if 2200 < x Initial program 67.2%
Taylor expanded in x around inf 81.8%
Simplified81.8%
Taylor expanded in x around inf 98.7%
mul-1-neg98.7%
log-rec98.7%
distribute-neg-frac98.7%
remove-double-neg98.7%
Simplified98.7%
*-un-lft-identity98.7%
exp-prod98.7%
Applied egg-rr98.7%
*-un-lft-identity98.7%
exp-1-e98.7%
Applied egg-rr98.7%
*-lft-identity98.7%
Simplified98.7%
Final simplification86.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -3.2e-79)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 1e-16)
(/ (log (+ 1.0 (/ 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) <= -3.2e-79) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 1e-16) {
tmp = log((1.0 + (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) <= -3.2e-79) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 1e-16) {
tmp = Math.log((1.0 + (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) <= -3.2e-79: tmp = (t_0 / n) / x elif (1.0 / n) <= 1e-16: tmp = math.log((1.0 + (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) <= -3.2e-79) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 1e-16) tmp = Float64(log(Float64(1.0 + 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], -3.2e-79], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-16], N[(N[Log[N[(1.0 + 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 -3.2 \cdot 10^{-79}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-16}:\\
\;\;\;\;\frac{\log \left(1 + \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) < -3.19999999999999988e-79Initial program 90.2%
Taylor expanded in x around inf 25.3%
Simplified25.3%
Taylor expanded in x around inf 96.4%
mul-1-neg96.4%
log-rec96.4%
distribute-neg-frac96.4%
remove-double-neg96.4%
Simplified96.4%
Taylor expanded in x around inf 96.4%
mul-1-neg96.4%
log-rec96.4%
distribute-frac-neg96.4%
remove-double-neg96.4%
*-rgt-identity96.4%
associate-*r/96.4%
exp-to-pow96.4%
Simplified96.4%
if -3.19999999999999988e-79 < (/.f64 #s(literal 1 binary64) n) < 9.9999999999999998e-17Initial program 31.8%
Taylor expanded in n around inf 80.0%
log1p-define80.0%
Simplified80.0%
expm1-log1p-u79.4%
Applied egg-rr79.4%
expm1-log1p-u80.0%
log1p-undefine80.0%
diff-log80.3%
Applied egg-rr80.3%
+-commutative80.3%
Simplified80.3%
Taylor expanded in x around inf 80.3%
if 9.9999999999999998e-17 < (/.f64 #s(literal 1 binary64) n) Initial program 64.4%
Taylor expanded in n around 0 64.4%
log1p-define91.4%
*-rgt-identity91.4%
associate-/l*91.3%
exp-to-pow91.3%
Simplified91.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -3.2e-79)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 5e-11)
(/ (log (+ 1.0 (/ 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) <= -3.2e-79) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 5e-11) {
tmp = log((1.0 + (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) <= (-3.2d-79)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 5d-11) then
tmp = log((1.0d0 + (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) <= -3.2e-79) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 5e-11) {
tmp = Math.log((1.0 + (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) <= -3.2e-79: tmp = (t_0 / n) / x elif (1.0 / n) <= 5e-11: tmp = math.log((1.0 + (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) <= -3.2e-79) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 5e-11) tmp = Float64(log(Float64(1.0 + 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) <= -3.2e-79) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 5e-11) tmp = log((1.0 + (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], -3.2e-79], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-11], N[(N[Log[N[(1.0 + 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 -3.2 \cdot 10^{-79}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-11}:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.19999999999999988e-79Initial program 90.2%
Taylor expanded in x around inf 25.3%
Simplified25.3%
Taylor expanded in x around inf 96.4%
mul-1-neg96.4%
log-rec96.4%
distribute-neg-frac96.4%
remove-double-neg96.4%
Simplified96.4%
Taylor expanded in x around inf 96.4%
mul-1-neg96.4%
log-rec96.4%
distribute-frac-neg96.4%
remove-double-neg96.4%
*-rgt-identity96.4%
associate-*r/96.4%
exp-to-pow96.4%
Simplified96.4%
if -3.19999999999999988e-79 < (/.f64 #s(literal 1 binary64) n) < 5.00000000000000018e-11Initial program 31.6%
Taylor expanded in n around inf 79.4%
log1p-define79.4%
Simplified79.4%
expm1-log1p-u78.8%
Applied egg-rr78.8%
expm1-log1p-u79.4%
log1p-undefine79.4%
diff-log79.7%
Applied egg-rr79.7%
+-commutative79.7%
Simplified79.7%
Taylor expanded in x around inf 79.7%
if 5.00000000000000018e-11 < (/.f64 #s(literal 1 binary64) n) Initial program 66.0%
Taylor expanded in n around 0 66.0%
log1p-define93.8%
*-rgt-identity93.8%
associate-/l*93.8%
exp-to-pow93.8%
Simplified93.8%
Taylor expanded in x around 0 93.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) -2e+206)
(/ (log (/ x x)) n)
(if (<= (/ 1.0 n) -1e+24)
t_0
(if (<= (/ 1.0 n) 5e-11)
(/ (log (+ 1.0 (/ 1.0 x))) n)
(if (<= (/ 1.0 n) 2e+142)
t_0
(/
(+ (/ (- (/ (/ 0.25 (* x n)) x) (/ 0.5 n)) x) (/ -1.0 n))
x)))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e+206) {
tmp = log((x / x)) / n;
} else if ((1.0 / n) <= -1e+24) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-11) {
tmp = log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e+142) {
tmp = t_0;
} else {
tmp = (((((0.25 / (x * n)) / x) - (0.5 / n)) / x) + (-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) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
if ((1.0d0 / n) <= (-2d+206)) then
tmp = log((x / x)) / n
else if ((1.0d0 / n) <= (-1d+24)) then
tmp = t_0
else if ((1.0d0 / n) <= 5d-11) then
tmp = log((1.0d0 + (1.0d0 / x))) / n
else if ((1.0d0 / n) <= 2d+142) then
tmp = t_0
else
tmp = (((((0.25d0 / (x * n)) / x) - (0.5d0 / n)) / x) + ((-1.0d0) / n)) / x
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 tmp;
if ((1.0 / n) <= -2e+206) {
tmp = Math.log((x / x)) / n;
} else if ((1.0 / n) <= -1e+24) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-11) {
tmp = Math.log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e+142) {
tmp = t_0;
} else {
tmp = (((((0.25 / (x * n)) / x) - (0.5 / n)) / x) + (-1.0 / n)) / x;
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e+206: tmp = math.log((x / x)) / n elif (1.0 / n) <= -1e+24: tmp = t_0 elif (1.0 / n) <= 5e-11: tmp = math.log((1.0 + (1.0 / x))) / n elif (1.0 / n) <= 2e+142: tmp = t_0 else: tmp = (((((0.25 / (x * n)) / x) - (0.5 / n)) / x) + (-1.0 / n)) / x return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (Float64(1.0 / n) <= -2e+206) tmp = Float64(log(Float64(x / x)) / n); elseif (Float64(1.0 / n) <= -1e+24) tmp = t_0; elseif (Float64(1.0 / n) <= 5e-11) tmp = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n); elseif (Float64(1.0 / n) <= 2e+142) tmp = t_0; else tmp = Float64(Float64(Float64(Float64(Float64(Float64(0.25 / Float64(x * n)) / x) - Float64(0.5 / n)) / x) + Float64(-1.0 / n)) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if ((1.0 / n) <= -2e+206) tmp = log((x / x)) / n; elseif ((1.0 / n) <= -1e+24) tmp = t_0; elseif ((1.0 / n) <= 5e-11) tmp = log((1.0 + (1.0 / x))) / n; elseif ((1.0 / n) <= 2e+142) tmp = t_0; else tmp = (((((0.25 / (x * n)) / x) - (0.5 / n)) / x) + (-1.0 / n)) / x; 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]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+206], N[(N[Log[N[(x / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+24], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-11], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+142], t$95$0, N[(N[(N[(N[(N[(N[(0.25 / N[(x * n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(-1.0 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{+206}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{+24}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-11}:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+142}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\frac{0.25}{x \cdot n}}{x} - \frac{0.5}{n}}{x} + \frac{-1}{n}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.0000000000000001e206Initial program 100.0%
Taylor expanded in n around inf 55.8%
log1p-define55.8%
Simplified55.8%
expm1-log1p-u55.8%
Applied egg-rr55.8%
expm1-log1p-u55.8%
log1p-undefine55.8%
diff-log55.8%
Applied egg-rr55.8%
+-commutative55.8%
Simplified55.8%
Taylor expanded in x around inf 61.5%
if -2.0000000000000001e206 < (/.f64 #s(literal 1 binary64) n) < -9.9999999999999998e23 or 5.00000000000000018e-11 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e142Initial program 93.0%
Taylor expanded in x around 0 69.1%
*-rgt-identity69.1%
associate-/l*69.1%
exp-to-pow69.1%
Simplified69.1%
if -9.9999999999999998e23 < (/.f64 #s(literal 1 binary64) n) < 5.00000000000000018e-11Initial program 33.6%
Taylor expanded in n around inf 77.0%
log1p-define77.0%
Simplified77.0%
expm1-log1p-u76.4%
Applied egg-rr76.4%
expm1-log1p-u77.0%
log1p-undefine77.0%
diff-log77.3%
Applied egg-rr77.3%
+-commutative77.3%
Simplified77.3%
Taylor expanded in x around inf 77.3%
if 2.0000000000000001e142 < (/.f64 #s(literal 1 binary64) n) Initial program 24.7%
Taylor expanded in n around inf 5.6%
log1p-define5.6%
Simplified5.6%
Taylor expanded in x around -inf 0.1%
mul-1-neg0.1%
Simplified0.1%
add-sqr-sqrt0.0%
sqrt-unprod78.5%
sqr-neg78.5%
sqrt-unprod78.5%
add-sqr-sqrt78.5%
Applied egg-rr78.5%
Taylor expanded in x around 0 78.5%
Final simplification73.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -3.2e-79)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 5e-11)
(/ (log (+ 1.0 (/ 1.0 x))) n)
(if (<= (/ 1.0 n) 2e+142)
(- (+ 1.0 (/ x n)) t_0)
(/ (+ (/ (- (/ (/ 0.25 (* x n)) x) (/ 0.5 n)) x) (/ -1.0 n)) x))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -3.2e-79) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 5e-11) {
tmp = log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e+142) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = (((((0.25 / (x * n)) / x) - (0.5 / n)) / x) + (-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) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-3.2d-79)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 5d-11) then
tmp = log((1.0d0 + (1.0d0 / x))) / n
else if ((1.0d0 / n) <= 2d+142) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = (((((0.25d0 / (x * n)) / x) - (0.5d0 / n)) / x) + ((-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 tmp;
if ((1.0 / n) <= -3.2e-79) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 5e-11) {
tmp = Math.log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e+142) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = (((((0.25 / (x * n)) / x) - (0.5 / n)) / x) + (-1.0 / n)) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -3.2e-79: tmp = (t_0 / n) / x elif (1.0 / n) <= 5e-11: tmp = math.log((1.0 + (1.0 / x))) / n elif (1.0 / n) <= 2e+142: tmp = (1.0 + (x / n)) - t_0 else: tmp = (((((0.25 / (x * n)) / x) - (0.5 / n)) / x) + (-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) <= -3.2e-79) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 5e-11) tmp = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n); elseif (Float64(1.0 / n) <= 2e+142) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(Float64(Float64(Float64(Float64(Float64(0.25 / Float64(x * n)) / x) - Float64(0.5 / n)) / x) + Float64(-1.0 / n)) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -3.2e-79) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 5e-11) tmp = log((1.0 + (1.0 / x))) / n; elseif ((1.0 / n) <= 2e+142) tmp = (1.0 + (x / n)) - t_0; else tmp = (((((0.25 / (x * n)) / x) - (0.5 / n)) / x) + (-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]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -3.2e-79], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-11], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+142], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(N[(N[(N[(N[(0.25 / N[(x * n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(-1.0 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -3.2 \cdot 10^{-79}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-11}:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+142}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\frac{0.25}{x \cdot n}}{x} - \frac{0.5}{n}}{x} + \frac{-1}{n}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.19999999999999988e-79Initial program 90.2%
Taylor expanded in x around inf 25.3%
Simplified25.3%
Taylor expanded in x around inf 96.4%
mul-1-neg96.4%
log-rec96.4%
distribute-neg-frac96.4%
remove-double-neg96.4%
Simplified96.4%
Taylor expanded in x around inf 96.4%
mul-1-neg96.4%
log-rec96.4%
distribute-frac-neg96.4%
remove-double-neg96.4%
*-rgt-identity96.4%
associate-*r/96.4%
exp-to-pow96.4%
Simplified96.4%
if -3.19999999999999988e-79 < (/.f64 #s(literal 1 binary64) n) < 5.00000000000000018e-11Initial program 31.6%
Taylor expanded in n around inf 79.4%
log1p-define79.4%
Simplified79.4%
expm1-log1p-u78.8%
Applied egg-rr78.8%
expm1-log1p-u79.4%
log1p-undefine79.4%
diff-log79.7%
Applied egg-rr79.7%
+-commutative79.7%
Simplified79.7%
Taylor expanded in x around inf 79.7%
if 5.00000000000000018e-11 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e142Initial program 80.3%
Taylor expanded in x around 0 73.5%
if 2.0000000000000001e142 < (/.f64 #s(literal 1 binary64) n) Initial program 24.7%
Taylor expanded in n around inf 5.6%
log1p-define5.6%
Simplified5.6%
Taylor expanded in x around -inf 0.1%
mul-1-neg0.1%
Simplified0.1%
add-sqr-sqrt0.0%
sqrt-unprod78.5%
sqr-neg78.5%
sqrt-unprod78.5%
add-sqr-sqrt78.5%
Applied egg-rr78.5%
Taylor expanded in x around 0 78.5%
Final simplification84.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -3.2e-79)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 5e-11)
(/ (log (+ 1.0 (/ 1.0 x))) n)
(if (<= (/ 1.0 n) 2e+142)
(- 1.0 t_0)
(/ (+ (/ (- (/ (/ 0.25 (* x n)) x) (/ 0.5 n)) x) (/ -1.0 n)) x))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -3.2e-79) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 5e-11) {
tmp = log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e+142) {
tmp = 1.0 - t_0;
} else {
tmp = (((((0.25 / (x * n)) / x) - (0.5 / n)) / x) + (-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) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-3.2d-79)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 5d-11) then
tmp = log((1.0d0 + (1.0d0 / x))) / n
else if ((1.0d0 / n) <= 2d+142) then
tmp = 1.0d0 - t_0
else
tmp = (((((0.25d0 / (x * n)) / x) - (0.5d0 / n)) / x) + ((-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 tmp;
if ((1.0 / n) <= -3.2e-79) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 5e-11) {
tmp = Math.log((1.0 + (1.0 / x))) / n;
} else if ((1.0 / n) <= 2e+142) {
tmp = 1.0 - t_0;
} else {
tmp = (((((0.25 / (x * n)) / x) - (0.5 / n)) / x) + (-1.0 / n)) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -3.2e-79: tmp = (t_0 / n) / x elif (1.0 / n) <= 5e-11: tmp = math.log((1.0 + (1.0 / x))) / n elif (1.0 / n) <= 2e+142: tmp = 1.0 - t_0 else: tmp = (((((0.25 / (x * n)) / x) - (0.5 / n)) / x) + (-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) <= -3.2e-79) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 5e-11) tmp = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n); elseif (Float64(1.0 / n) <= 2e+142) tmp = Float64(1.0 - t_0); else tmp = Float64(Float64(Float64(Float64(Float64(Float64(0.25 / Float64(x * n)) / x) - Float64(0.5 / n)) / x) + Float64(-1.0 / n)) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -3.2e-79) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 5e-11) tmp = log((1.0 + (1.0 / x))) / n; elseif ((1.0 / n) <= 2e+142) tmp = 1.0 - t_0; else tmp = (((((0.25 / (x * n)) / x) - (0.5 / n)) / x) + (-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]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -3.2e-79], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-11], N[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+142], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(N[(N[(N[(N[(0.25 / N[(x * n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(-1.0 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -3.2 \cdot 10^{-79}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-11}:\\
\;\;\;\;\frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+142}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\frac{0.25}{x \cdot n}}{x} - \frac{0.5}{n}}{x} + \frac{-1}{n}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -3.19999999999999988e-79Initial program 90.2%
Taylor expanded in x around inf 25.3%
Simplified25.3%
Taylor expanded in x around inf 96.4%
mul-1-neg96.4%
log-rec96.4%
distribute-neg-frac96.4%
remove-double-neg96.4%
Simplified96.4%
Taylor expanded in x around inf 96.4%
mul-1-neg96.4%
log-rec96.4%
distribute-frac-neg96.4%
remove-double-neg96.4%
*-rgt-identity96.4%
associate-*r/96.4%
exp-to-pow96.4%
Simplified96.4%
if -3.19999999999999988e-79 < (/.f64 #s(literal 1 binary64) n) < 5.00000000000000018e-11Initial program 31.6%
Taylor expanded in n around inf 79.4%
log1p-define79.4%
Simplified79.4%
expm1-log1p-u78.8%
Applied egg-rr78.8%
expm1-log1p-u79.4%
log1p-undefine79.4%
diff-log79.7%
Applied egg-rr79.7%
+-commutative79.7%
Simplified79.7%
Taylor expanded in x around inf 79.7%
if 5.00000000000000018e-11 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e142Initial program 80.3%
Taylor expanded in x around 0 72.7%
*-rgt-identity72.7%
associate-/l*72.7%
exp-to-pow72.7%
Simplified72.7%
if 2.0000000000000001e142 < (/.f64 #s(literal 1 binary64) n) Initial program 24.7%
Taylor expanded in n around inf 5.6%
log1p-define5.6%
Simplified5.6%
Taylor expanded in x around -inf 0.1%
mul-1-neg0.1%
Simplified0.1%
add-sqr-sqrt0.0%
sqrt-unprod78.5%
sqr-neg78.5%
sqrt-unprod78.5%
add-sqr-sqrt78.5%
Applied egg-rr78.5%
Taylor expanded in x around 0 78.5%
Final simplification84.7%
(FPCore (x n)
:precision binary64
(if (<= x 1.15e-94)
(/ (log x) (- n))
(if (<= x 8.6e-7)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 2.2e+164)
(/ (/ (+ (/ (+ 0.5 (/ -0.3333333333333333 x)) x) -1.0) (- x)) n)
(/ (log (/ x x)) n)))))
double code(double x, double n) {
double tmp;
if (x <= 1.15e-94) {
tmp = log(x) / -n;
} else if (x <= 8.6e-7) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 2.2e+164) {
tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n;
} else {
tmp = log((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 <= 1.15d-94) then
tmp = log(x) / -n
else if (x <= 8.6d-7) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 2.2d+164) then
tmp = ((((0.5d0 + ((-0.3333333333333333d0) / x)) / x) + (-1.0d0)) / -x) / n
else
tmp = log((x / x)) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.15e-94) {
tmp = Math.log(x) / -n;
} else if (x <= 8.6e-7) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 2.2e+164) {
tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n;
} else {
tmp = Math.log((x / x)) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.15e-94: tmp = math.log(x) / -n elif x <= 8.6e-7: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 2.2e+164: tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n else: tmp = math.log((x / x)) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.15e-94) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 8.6e-7) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 2.2e+164) tmp = Float64(Float64(Float64(Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x) + -1.0) / Float64(-x)) / n); else tmp = Float64(log(Float64(x / x)) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.15e-94) tmp = log(x) / -n; elseif (x <= 8.6e-7) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 2.2e+164) tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n; else tmp = log((x / x)) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.15e-94], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 8.6e-7], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.2e+164], N[(N[(N[(N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + -1.0), $MachinePrecision] / (-x)), $MachinePrecision] / n), $MachinePrecision], N[(N[Log[N[(x / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.15 \cdot 10^{-94}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 8.6 \cdot 10^{-7}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+164}:\\
\;\;\;\;\frac{\frac{\frac{0.5 + \frac{-0.3333333333333333}{x}}{x} + -1}{-x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x}\right)}{n}\\
\end{array}
\end{array}
if x < 1.15e-94Initial program 44.5%
Taylor expanded in n around inf 56.7%
log1p-define56.7%
Simplified56.7%
Taylor expanded in x around 0 56.7%
neg-mul-156.7%
Simplified56.7%
if 1.15e-94 < x < 8.6000000000000002e-7Initial program 60.0%
Taylor expanded in x around 0 54.9%
*-rgt-identity54.9%
associate-/l*54.9%
exp-to-pow54.9%
Simplified54.9%
if 8.6000000000000002e-7 < x < 2.20000000000000006e164Initial program 50.4%
Taylor expanded in n around inf 53.6%
log1p-define53.6%
Simplified53.6%
expm1-log1p-u53.6%
Applied egg-rr53.6%
Taylor expanded in x around -inf 69.3%
mul-1-neg69.3%
distribute-neg-frac269.3%
sub-neg69.3%
associate-*r/69.3%
sub-neg69.3%
metadata-eval69.3%
distribute-lft-in69.3%
neg-mul-169.3%
associate-*r/69.3%
metadata-eval69.3%
distribute-neg-frac69.3%
metadata-eval69.3%
metadata-eval69.3%
metadata-eval69.3%
Simplified69.3%
if 2.20000000000000006e164 < x Initial program 83.7%
Taylor expanded in n around inf 83.7%
log1p-define83.7%
Simplified83.7%
expm1-log1p-u83.7%
Applied egg-rr83.7%
expm1-log1p-u83.7%
log1p-undefine83.7%
diff-log83.7%
Applied egg-rr83.7%
+-commutative83.7%
Simplified83.7%
Taylor expanded in x around inf 83.7%
Final simplification65.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (+ (/ (+ -0.3333333333333333 (/ 0.25 x)) (* x n)) (/ -0.5 n))))
(if (<= x 5e-96)
(/ (log x) (- n))
(if (<= x 0.62)
(/ (/ (- n (/ x t_0)) (/ (* x n) t_0)) x)
(if (<= x 9.5e+163)
(/
(/
(+
1.0
(/ (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5) x))
x)
n)
(/ (log (/ x x)) n))))))
double code(double x, double n) {
double t_0 = ((-0.3333333333333333 + (0.25 / x)) / (x * n)) + (-0.5 / n);
double tmp;
if (x <= 5e-96) {
tmp = log(x) / -n;
} else if (x <= 0.62) {
tmp = ((n - (x / t_0)) / ((x * n) / t_0)) / x;
} else if (x <= 9.5e+163) {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = log((x / 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 = (((-0.3333333333333333d0) + (0.25d0 / x)) / (x * n)) + ((-0.5d0) / n)
if (x <= 5d-96) then
tmp = log(x) / -n
else if (x <= 0.62d0) then
tmp = ((n - (x / t_0)) / ((x * n) / t_0)) / x
else if (x <= 9.5d+163) then
tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
else
tmp = log((x / x)) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = ((-0.3333333333333333 + (0.25 / x)) / (x * n)) + (-0.5 / n);
double tmp;
if (x <= 5e-96) {
tmp = Math.log(x) / -n;
} else if (x <= 0.62) {
tmp = ((n - (x / t_0)) / ((x * n) / t_0)) / x;
} else if (x <= 9.5e+163) {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
} else {
tmp = Math.log((x / x)) / n;
}
return tmp;
}
def code(x, n): t_0 = ((-0.3333333333333333 + (0.25 / x)) / (x * n)) + (-0.5 / n) tmp = 0 if x <= 5e-96: tmp = math.log(x) / -n elif x <= 0.62: tmp = ((n - (x / t_0)) / ((x * n) / t_0)) / x elif x <= 9.5e+163: tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n else: tmp = math.log((x / x)) / n return tmp
function code(x, n) t_0 = Float64(Float64(Float64(-0.3333333333333333 + Float64(0.25 / x)) / Float64(x * n)) + Float64(-0.5 / n)) tmp = 0.0 if (x <= 5e-96) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 0.62) tmp = Float64(Float64(Float64(n - Float64(x / t_0)) / Float64(Float64(x * n) / t_0)) / x); elseif (x <= 9.5e+163) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n); else tmp = Float64(log(Float64(x / x)) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = ((-0.3333333333333333 + (0.25 / x)) / (x * n)) + (-0.5 / n); tmp = 0.0; if (x <= 5e-96) tmp = log(x) / -n; elseif (x <= 0.62) tmp = ((n - (x / t_0)) / ((x * n) / t_0)) / x; elseif (x <= 9.5e+163) tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n; else tmp = log((x / x)) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(N[(-0.3333333333333333 + N[(0.25 / x), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 5e-96], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 0.62], N[(N[(N[(n - N[(x / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(N[(x * n), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 9.5e+163], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], N[(N[Log[N[(x / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-0.3333333333333333 + \frac{0.25}{x}}{x \cdot n} + \frac{-0.5}{n}\\
\mathbf{if}\;x \leq 5 \cdot 10^{-96}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 0.62:\\
\;\;\;\;\frac{\frac{n - \frac{x}{t\_0}}{\frac{x \cdot n}{t\_0}}}{x}\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+163}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\log \left(\frac{x}{x}\right)}{n}\\
\end{array}
\end{array}
if x < 4.99999999999999995e-96Initial program 44.5%
Taylor expanded in n around inf 56.7%
log1p-define56.7%
Simplified56.7%
Taylor expanded in x around 0 56.7%
neg-mul-156.7%
Simplified56.7%
if 4.99999999999999995e-96 < x < 0.619999999999999996Initial program 57.2%
Taylor expanded in n around inf 35.8%
log1p-define35.8%
Simplified35.8%
Taylor expanded in x around -inf 0.9%
mul-1-neg0.9%
Simplified0.9%
add-sqr-sqrt0.4%
sqrt-unprod14.1%
sqr-neg14.1%
sqrt-unprod9.0%
add-sqr-sqrt36.3%
Applied egg-rr36.3%
clear-num36.3%
frac-sub50.8%
*-un-lft-identity50.8%
associate-/l/50.8%
sub-neg50.8%
metadata-eval50.8%
Applied egg-rr50.8%
*-rgt-identity50.8%
sub-neg50.8%
*-lft-identity50.8%
*-lft-identity50.8%
metadata-eval50.8%
associate-*r/50.8%
+-commutative50.8%
associate-*r/50.8%
metadata-eval50.8%
distribute-neg-frac50.8%
metadata-eval50.8%
Simplified50.8%
if 0.619999999999999996 < x < 9.50000000000000053e163Initial program 51.9%
Taylor expanded in n around inf 52.0%
log1p-define52.0%
Simplified52.0%
Taylor expanded in x around -inf 71.3%
if 9.50000000000000053e163 < x Initial program 83.7%
Taylor expanded in n around inf 83.7%
log1p-define83.7%
Simplified83.7%
expm1-log1p-u83.7%
Applied egg-rr83.7%
expm1-log1p-u83.7%
log1p-undefine83.7%
diff-log83.7%
Applied egg-rr83.7%
+-commutative83.7%
Simplified83.7%
Taylor expanded in x around inf 83.7%
Final simplification64.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (+ (/ (+ -0.3333333333333333 (/ 0.25 x)) (* x n)) (/ -0.5 n))))
(if (<= x 1.2e-94)
(/ (log x) (- n))
(if (<= x 0.62)
(/ (/ (- n (/ x t_0)) (/ (* x n) t_0)) x)
(/
(/
(+ 1.0 (/ (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5) x))
x)
n)))))
double code(double x, double n) {
double t_0 = ((-0.3333333333333333 + (0.25 / x)) / (x * n)) + (-0.5 / n);
double tmp;
if (x <= 1.2e-94) {
tmp = log(x) / -n;
} else if (x <= 0.62) {
tmp = ((n - (x / t_0)) / ((x * n) / t_0)) / x;
} else {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / 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 = (((-0.3333333333333333d0) + (0.25d0 / x)) / (x * n)) + ((-0.5d0) / n)
if (x <= 1.2d-94) then
tmp = log(x) / -n
else if (x <= 0.62d0) then
tmp = ((n - (x / t_0)) / ((x * n) / t_0)) / x
else
tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = ((-0.3333333333333333 + (0.25 / x)) / (x * n)) + (-0.5 / n);
double tmp;
if (x <= 1.2e-94) {
tmp = Math.log(x) / -n;
} else if (x <= 0.62) {
tmp = ((n - (x / t_0)) / ((x * n) / t_0)) / x;
} else {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
}
return tmp;
}
def code(x, n): t_0 = ((-0.3333333333333333 + (0.25 / x)) / (x * n)) + (-0.5 / n) tmp = 0 if x <= 1.2e-94: tmp = math.log(x) / -n elif x <= 0.62: tmp = ((n - (x / t_0)) / ((x * n) / t_0)) / x else: tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n return tmp
function code(x, n) t_0 = Float64(Float64(Float64(-0.3333333333333333 + Float64(0.25 / x)) / Float64(x * n)) + Float64(-0.5 / n)) tmp = 0.0 if (x <= 1.2e-94) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 0.62) tmp = Float64(Float64(Float64(n - Float64(x / t_0)) / Float64(Float64(x * n) / t_0)) / x); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = ((-0.3333333333333333 + (0.25 / x)) / (x * n)) + (-0.5 / n); tmp = 0.0; if (x <= 1.2e-94) tmp = log(x) / -n; elseif (x <= 0.62) tmp = ((n - (x / t_0)) / ((x * n) / t_0)) / x; else tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(N[(-0.3333333333333333 + N[(0.25 / x), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.2e-94], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 0.62], N[(N[(N[(n - N[(x / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(N[(x * n), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-0.3333333333333333 + \frac{0.25}{x}}{x \cdot n} + \frac{-0.5}{n}\\
\mathbf{if}\;x \leq 1.2 \cdot 10^{-94}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 0.62:\\
\;\;\;\;\frac{\frac{n - \frac{x}{t\_0}}{\frac{x \cdot n}{t\_0}}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\
\end{array}
\end{array}
if x < 1.2e-94Initial program 44.5%
Taylor expanded in n around inf 56.7%
log1p-define56.7%
Simplified56.7%
Taylor expanded in x around 0 56.7%
neg-mul-156.7%
Simplified56.7%
if 1.2e-94 < x < 0.619999999999999996Initial program 57.2%
Taylor expanded in n around inf 35.8%
log1p-define35.8%
Simplified35.8%
Taylor expanded in x around -inf 0.9%
mul-1-neg0.9%
Simplified0.9%
add-sqr-sqrt0.4%
sqrt-unprod14.1%
sqr-neg14.1%
sqrt-unprod9.0%
add-sqr-sqrt36.3%
Applied egg-rr36.3%
clear-num36.3%
frac-sub50.8%
*-un-lft-identity50.8%
associate-/l/50.8%
sub-neg50.8%
metadata-eval50.8%
Applied egg-rr50.8%
*-rgt-identity50.8%
sub-neg50.8%
*-lft-identity50.8%
*-lft-identity50.8%
metadata-eval50.8%
associate-*r/50.8%
+-commutative50.8%
associate-*r/50.8%
metadata-eval50.8%
distribute-neg-frac50.8%
metadata-eval50.8%
Simplified50.8%
if 0.619999999999999996 < x Initial program 66.7%
Taylor expanded in n around inf 66.8%
log1p-define66.8%
Simplified66.8%
Taylor expanded in x around -inf 66.2%
Final simplification60.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (+ (/ (+ -0.3333333333333333 (/ 0.25 x)) (* x n)) (/ -0.5 n))))
(if (<= x 0.62)
(/ (/ (- n (/ x t_0)) (/ (* x n) t_0)) x)
(/
(/
(+ 1.0 (/ (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5) x))
x)
n))))
double code(double x, double n) {
double t_0 = ((-0.3333333333333333 + (0.25 / x)) / (x * n)) + (-0.5 / n);
double tmp;
if (x <= 0.62) {
tmp = ((n - (x / t_0)) / ((x * n) / t_0)) / x;
} else {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / 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 = (((-0.3333333333333333d0) + (0.25d0 / x)) / (x * n)) + ((-0.5d0) / n)
if (x <= 0.62d0) then
tmp = ((n - (x / t_0)) / ((x * n) / t_0)) / x
else
tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = ((-0.3333333333333333 + (0.25 / x)) / (x * n)) + (-0.5 / n);
double tmp;
if (x <= 0.62) {
tmp = ((n - (x / t_0)) / ((x * n) / t_0)) / x;
} else {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
}
return tmp;
}
def code(x, n): t_0 = ((-0.3333333333333333 + (0.25 / x)) / (x * n)) + (-0.5 / n) tmp = 0 if x <= 0.62: tmp = ((n - (x / t_0)) / ((x * n) / t_0)) / x else: tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n return tmp
function code(x, n) t_0 = Float64(Float64(Float64(-0.3333333333333333 + Float64(0.25 / x)) / Float64(x * n)) + Float64(-0.5 / n)) tmp = 0.0 if (x <= 0.62) tmp = Float64(Float64(Float64(n - Float64(x / t_0)) / Float64(Float64(x * n) / t_0)) / x); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = ((-0.3333333333333333 + (0.25 / x)) / (x * n)) + (-0.5 / n); tmp = 0.0; if (x <= 0.62) tmp = ((n - (x / t_0)) / ((x * n) / t_0)) / x; else tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(N[(-0.3333333333333333 + N[(0.25 / x), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 0.62], N[(N[(N[(n - N[(x / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(N[(x * n), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-0.3333333333333333 + \frac{0.25}{x}}{x \cdot n} + \frac{-0.5}{n}\\
\mathbf{if}\;x \leq 0.62:\\
\;\;\;\;\frac{\frac{n - \frac{x}{t\_0}}{\frac{x \cdot n}{t\_0}}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\
\end{array}
\end{array}
if x < 0.619999999999999996Initial program 48.1%
Taylor expanded in n around inf 50.9%
log1p-define50.9%
Simplified50.9%
Taylor expanded in x around -inf 0.8%
mul-1-neg0.8%
Simplified0.8%
add-sqr-sqrt0.4%
sqrt-unprod8.5%
sqr-neg8.5%
sqrt-unprod6.8%
add-sqr-sqrt30.8%
Applied egg-rr30.8%
clear-num30.8%
frac-sub34.9%
*-un-lft-identity34.9%
associate-/l/34.9%
sub-neg34.9%
metadata-eval34.9%
Applied egg-rr34.9%
*-rgt-identity34.9%
sub-neg34.9%
*-lft-identity34.9%
*-lft-identity34.9%
metadata-eval34.9%
associate-*r/34.9%
+-commutative34.9%
associate-*r/34.9%
metadata-eval34.9%
distribute-neg-frac34.9%
metadata-eval34.9%
Simplified34.9%
if 0.619999999999999996 < x Initial program 66.7%
Taylor expanded in n around inf 66.8%
log1p-define66.8%
Simplified66.8%
Taylor expanded in x around -inf 66.2%
Final simplification48.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ x (/ (+ -0.3333333333333333 (/ 0.25 x)) n))))
(if (<= x 0.45)
(/ (+ (/ (/ (- n (* 0.5 t_0)) (* n t_0)) x) (/ -1.0 n)) x)
(/
(/
(+ 1.0 (/ (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5) x))
x)
n))))
double code(double x, double n) {
double t_0 = x / ((-0.3333333333333333 + (0.25 / x)) / n);
double tmp;
if (x <= 0.45) {
tmp = ((((n - (0.5 * t_0)) / (n * t_0)) / x) + (-1.0 / n)) / x;
} else {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / 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 / (((-0.3333333333333333d0) + (0.25d0 / x)) / n)
if (x <= 0.45d0) then
tmp = ((((n - (0.5d0 * t_0)) / (n * t_0)) / x) + ((-1.0d0) / n)) / x
else
tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = x / ((-0.3333333333333333 + (0.25 / x)) / n);
double tmp;
if (x <= 0.45) {
tmp = ((((n - (0.5 * t_0)) / (n * t_0)) / x) + (-1.0 / n)) / x;
} else {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
}
return tmp;
}
def code(x, n): t_0 = x / ((-0.3333333333333333 + (0.25 / x)) / n) tmp = 0 if x <= 0.45: tmp = ((((n - (0.5 * t_0)) / (n * t_0)) / x) + (-1.0 / n)) / x else: tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n return tmp
function code(x, n) t_0 = Float64(x / Float64(Float64(-0.3333333333333333 + Float64(0.25 / x)) / n)) tmp = 0.0 if (x <= 0.45) tmp = Float64(Float64(Float64(Float64(Float64(n - Float64(0.5 * t_0)) / Float64(n * t_0)) / x) + Float64(-1.0 / n)) / x); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = x / ((-0.3333333333333333 + (0.25 / x)) / n); tmp = 0.0; if (x <= 0.45) tmp = ((((n - (0.5 * t_0)) / (n * t_0)) / x) + (-1.0 / n)) / x; else tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(x / N[(N[(-0.3333333333333333 + N[(0.25 / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 0.45], N[(N[(N[(N[(N[(n - N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(n * t$95$0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(-1.0 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{\frac{-0.3333333333333333 + \frac{0.25}{x}}{n}}\\
\mathbf{if}\;x \leq 0.45:\\
\;\;\;\;\frac{\frac{\frac{n - 0.5 \cdot t\_0}{n \cdot t\_0}}{x} + \frac{-1}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\
\end{array}
\end{array}
if x < 0.450000000000000011Initial program 48.1%
Taylor expanded in n around inf 50.9%
log1p-define50.9%
Simplified50.9%
Taylor expanded in x around -inf 0.8%
mul-1-neg0.8%
Simplified0.8%
add-sqr-sqrt0.4%
sqrt-unprod8.5%
sqr-neg8.5%
sqrt-unprod6.8%
add-sqr-sqrt30.8%
Applied egg-rr30.8%
clear-num30.8%
frac-sub34.1%
*-un-lft-identity34.1%
sub-neg34.1%
metadata-eval34.1%
sub-neg34.1%
metadata-eval34.1%
Applied egg-rr34.1%
if 0.450000000000000011 < x Initial program 66.7%
Taylor expanded in n around inf 66.8%
log1p-define66.8%
Simplified66.8%
Taylor expanded in x around -inf 66.2%
Final simplification48.2%
(FPCore (x n)
:precision binary64
(if (<= x 0.45)
(/
(+
(/
(/
(- (* n (+ -0.3333333333333333 (/ 0.25 x))) (* 0.5 (* x n)))
(* n (* x n)))
x)
(/ -1.0 n))
x)
(/
(/
(+ 1.0 (/ (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5) x))
x)
n)))
double code(double x, double n) {
double tmp;
if (x <= 0.45) {
tmp = (((((n * (-0.3333333333333333 + (0.25 / x))) - (0.5 * (x * n))) / (n * (x * n))) / x) + (-1.0 / n)) / x;
} else {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / 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.45d0) then
tmp = (((((n * ((-0.3333333333333333d0) + (0.25d0 / x))) - (0.5d0 * (x * n))) / (n * (x * n))) / x) + ((-1.0d0) / n)) / x
else
tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.45) {
tmp = (((((n * (-0.3333333333333333 + (0.25 / x))) - (0.5 * (x * n))) / (n * (x * n))) / x) + (-1.0 / n)) / x;
} else {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.45: tmp = (((((n * (-0.3333333333333333 + (0.25 / x))) - (0.5 * (x * n))) / (n * (x * n))) / x) + (-1.0 / n)) / x else: tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.45) tmp = Float64(Float64(Float64(Float64(Float64(Float64(n * Float64(-0.3333333333333333 + Float64(0.25 / x))) - Float64(0.5 * Float64(x * n))) / Float64(n * Float64(x * n))) / x) + Float64(-1.0 / n)) / x); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.45) tmp = (((((n * (-0.3333333333333333 + (0.25 / x))) - (0.5 * (x * n))) / (n * (x * n))) / x) + (-1.0 / n)) / x; else tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.45], N[(N[(N[(N[(N[(N[(n * N[(-0.3333333333333333 + N[(0.25 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(n * N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(-1.0 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.45:\\
\;\;\;\;\frac{\frac{\frac{n \cdot \left(-0.3333333333333333 + \frac{0.25}{x}\right) - 0.5 \cdot \left(x \cdot n\right)}{n \cdot \left(x \cdot n\right)}}{x} + \frac{-1}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\
\end{array}
\end{array}
if x < 0.450000000000000011Initial program 48.1%
Taylor expanded in n around inf 50.9%
log1p-define50.9%
Simplified50.9%
Taylor expanded in x around -inf 0.8%
mul-1-neg0.8%
Simplified0.8%
add-sqr-sqrt0.4%
sqrt-unprod8.5%
sqr-neg8.5%
sqrt-unprod6.8%
add-sqr-sqrt30.8%
Applied egg-rr30.8%
associate-/l/30.8%
frac-sub32.5%
sub-neg32.5%
metadata-eval32.5%
Applied egg-rr32.5%
if 0.450000000000000011 < x Initial program 66.7%
Taylor expanded in n around inf 66.8%
log1p-define66.8%
Simplified66.8%
Taylor expanded in x around -inf 66.2%
Final simplification47.3%
(FPCore (x n)
:precision binary64
(if (<= x 0.46)
(/
(+ (/ (/ (- (/ (+ -0.3333333333333333 (/ 0.25 x)) x) 0.5) n) x) (/ -1.0 n))
x)
(/
(/
(+ 1.0 (/ (- (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x) 0.5) x))
x)
n)))
double code(double x, double n) {
double tmp;
if (x <= 0.46) {
tmp = ((((((-0.3333333333333333 + (0.25 / x)) / x) - 0.5) / n) / x) + (-1.0 / n)) / x;
} else {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / 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.46d0) then
tmp = (((((((-0.3333333333333333d0) + (0.25d0 / x)) / x) - 0.5d0) / n) / x) + ((-1.0d0) / n)) / x
else
tmp = ((1.0d0 + ((((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x) - 0.5d0) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.46) {
tmp = ((((((-0.3333333333333333 + (0.25 / x)) / x) - 0.5) / n) / x) + (-1.0 / n)) / x;
} else {
tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.46: tmp = ((((((-0.3333333333333333 + (0.25 / x)) / x) - 0.5) / n) / x) + (-1.0 / n)) / x else: tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.46) tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.3333333333333333 + Float64(0.25 / x)) / x) - 0.5) / n) / x) + Float64(-1.0 / n)) / x); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x) - 0.5) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.46) tmp = ((((((-0.3333333333333333 + (0.25 / x)) / x) - 0.5) / n) / x) + (-1.0 / n)) / x; else tmp = ((1.0 + ((((0.3333333333333333 + (0.25 * (-1.0 / x))) / x) - 0.5) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.46], N[(N[(N[(N[(N[(N[(N[(-0.3333333333333333 + N[(0.25 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision] + N[(-1.0 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.46:\\
\;\;\;\;\frac{\frac{\frac{\frac{-0.3333333333333333 + \frac{0.25}{x}}{x} - 0.5}{n}}{x} + \frac{-1}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \frac{\frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x} - 0.5}{x}}{x}}{n}\\
\end{array}
\end{array}
if x < 0.46000000000000002Initial program 48.1%
Taylor expanded in n around inf 50.9%
log1p-define50.9%
Simplified50.9%
Taylor expanded in x around -inf 0.8%
mul-1-neg0.8%
Simplified0.8%
add-sqr-sqrt0.4%
sqrt-unprod8.5%
sqr-neg8.5%
sqrt-unprod6.8%
add-sqr-sqrt30.8%
Applied egg-rr30.8%
Taylor expanded in n around -inf 30.8%
mul-1-neg30.8%
distribute-neg-frac230.8%
mul-1-neg30.8%
unsub-neg30.8%
sub-neg30.8%
metadata-eval30.8%
+-commutative30.8%
associate-*r/30.8%
metadata-eval30.8%
Simplified30.8%
if 0.46000000000000002 < x Initial program 66.7%
Taylor expanded in n around inf 66.8%
log1p-define66.8%
Simplified66.8%
Taylor expanded in x around -inf 66.2%
Final simplification46.3%
(FPCore (x n) :precision binary64 (if (<= x 1.4e-24) (/ (+ (/ (- (/ (/ 0.25 (* x n)) x) (/ 0.5 n)) x) (/ -1.0 n)) x) (/ (/ (+ (/ (+ 0.5 (/ -0.3333333333333333 x)) x) -1.0) (- x)) n)))
double code(double x, double n) {
double tmp;
if (x <= 1.4e-24) {
tmp = (((((0.25 / (x * n)) / x) - (0.5 / n)) / x) + (-1.0 / n)) / x;
} else {
tmp = ((((0.5 + (-0.3333333333333333 / x)) / 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 (x <= 1.4d-24) then
tmp = (((((0.25d0 / (x * n)) / x) - (0.5d0 / n)) / x) + ((-1.0d0) / n)) / x
else
tmp = ((((0.5d0 + ((-0.3333333333333333d0) / x)) / x) + (-1.0d0)) / -x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.4e-24) {
tmp = (((((0.25 / (x * n)) / x) - (0.5 / n)) / x) + (-1.0 / n)) / x;
} else {
tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.4e-24: tmp = (((((0.25 / (x * n)) / x) - (0.5 / n)) / x) + (-1.0 / n)) / x else: tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.4e-24) tmp = Float64(Float64(Float64(Float64(Float64(Float64(0.25 / Float64(x * n)) / x) - Float64(0.5 / n)) / x) + Float64(-1.0 / n)) / x); else tmp = Float64(Float64(Float64(Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x) + -1.0) / Float64(-x)) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.4e-24) tmp = (((((0.25 / (x * n)) / x) - (0.5 / n)) / x) + (-1.0 / n)) / x; else tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.4e-24], N[(N[(N[(N[(N[(N[(0.25 / N[(x * n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(-1.0 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + -1.0), $MachinePrecision] / (-x)), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.4 \cdot 10^{-24}:\\
\;\;\;\;\frac{\frac{\frac{\frac{0.25}{x \cdot n}}{x} - \frac{0.5}{n}}{x} + \frac{-1}{n}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{0.5 + \frac{-0.3333333333333333}{x}}{x} + -1}{-x}}{n}\\
\end{array}
\end{array}
if x < 1.4000000000000001e-24Initial program 47.3%
Taylor expanded in n around inf 51.2%
log1p-define51.2%
Simplified51.2%
Taylor expanded in x around -inf 0.8%
mul-1-neg0.8%
Simplified0.8%
add-sqr-sqrt0.3%
sqrt-unprod8.2%
sqr-neg8.2%
sqrt-unprod7.1%
add-sqr-sqrt32.9%
Applied egg-rr32.9%
Taylor expanded in x around 0 32.9%
if 1.4000000000000001e-24 < x Initial program 65.8%
Taylor expanded in n around inf 65.1%
log1p-define65.1%
Simplified65.1%
expm1-log1p-u65.0%
Applied egg-rr65.0%
Taylor expanded in x around -inf 60.9%
mul-1-neg60.9%
distribute-neg-frac260.9%
sub-neg60.9%
associate-*r/60.9%
sub-neg60.9%
metadata-eval60.9%
distribute-lft-in60.9%
neg-mul-160.9%
associate-*r/60.9%
metadata-eval60.9%
distribute-neg-frac60.9%
metadata-eval60.9%
metadata-eval60.9%
metadata-eval60.9%
Simplified60.9%
Final simplification46.3%
(FPCore (x n) :precision binary64 (/ (/ (+ x (* n (- (/ (/ (- (/ 0.25 x) 0.3333333333333333) n) x) (/ 0.5 n)))) (* x n)) x))
double code(double x, double n) {
return ((x + (n * (((((0.25 / x) - 0.3333333333333333) / n) / x) - (0.5 / n)))) / (x * n)) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + (n * (((((0.25d0 / x) - 0.3333333333333333d0) / n) / x) - (0.5d0 / n)))) / (x * n)) / x
end function
public static double code(double x, double n) {
return ((x + (n * (((((0.25 / x) - 0.3333333333333333) / n) / x) - (0.5 / n)))) / (x * n)) / x;
}
def code(x, n): return ((x + (n * (((((0.25 / x) - 0.3333333333333333) / n) / x) - (0.5 / n)))) / (x * n)) / x
function code(x, n) return Float64(Float64(Float64(x + Float64(n * Float64(Float64(Float64(Float64(Float64(0.25 / x) - 0.3333333333333333) / n) / x) - Float64(0.5 / n)))) / Float64(x * n)) / x) end
function tmp = code(x, n) tmp = ((x + (n * (((((0.25 / x) - 0.3333333333333333) / n) / x) - (0.5 / n)))) / (x * n)) / x; end
code[x_, n_] := N[(N[(N[(x + N[(n * N[(N[(N[(N[(N[(0.25 / x), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{x + n \cdot \left(\frac{\frac{\frac{0.25}{x} - 0.3333333333333333}{n}}{x} - \frac{0.5}{n}\right)}{x \cdot n}}{x}
\end{array}
Initial program 56.2%
Taylor expanded in n around inf 57.8%
log1p-define57.8%
Simplified57.8%
Taylor expanded in x around -inf 29.4%
mul-1-neg29.4%
Simplified29.4%
distribute-neg-frac29.4%
frac-sub28.3%
Applied egg-rr45.2%
Final simplification45.2%
(FPCore (x n) :precision binary64 (/ (- (/ 1.0 n) (/ (- (/ 0.5 n) (/ 0.3333333333333333 (* x n))) x)) x))
double code(double x, double n) {
return ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (x * n))) / x)) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((1.0d0 / n) - (((0.5d0 / n) - (0.3333333333333333d0 / (x * n))) / x)) / x
end function
public static double code(double x, double n) {
return ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (x * n))) / x)) / x;
}
def code(x, n): return ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (x * n))) / x)) / x
function code(x, n) return Float64(Float64(Float64(1.0 / n) - Float64(Float64(Float64(0.5 / n) - Float64(0.3333333333333333 / Float64(x * n))) / x)) / x) end
function tmp = code(x, n) tmp = ((1.0 / n) - (((0.5 / n) - (0.3333333333333333 / (x * n))) / x)) / x; end
code[x_, n_] := N[(N[(N[(1.0 / n), $MachinePrecision] - N[(N[(N[(0.5 / n), $MachinePrecision] - N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n} - \frac{\frac{0.5}{n} - \frac{0.3333333333333333}{x \cdot n}}{x}}{x}
\end{array}
Initial program 56.2%
Taylor expanded in n around inf 57.8%
log1p-define57.8%
Simplified57.8%
Taylor expanded in x around -inf 29.4%
mul-1-neg29.4%
Simplified29.4%
Taylor expanded in x around inf 44.2%
associate-*r/44.2%
metadata-eval44.2%
associate-*r/44.2%
metadata-eval44.2%
*-commutative44.2%
Simplified44.2%
Final simplification44.2%
(FPCore (x n) :precision binary64 (/ (/ (+ (/ (+ 0.5 (/ -0.3333333333333333 x)) x) -1.0) (- x)) n))
double code(double x, double n) {
return ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((((0.5d0 + ((-0.3333333333333333d0) / x)) / x) + (-1.0d0)) / -x) / n
end function
public static double code(double x, double n) {
return ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n;
}
def code(x, n): return ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n
function code(x, n) return Float64(Float64(Float64(Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x) + -1.0) / Float64(-x)) / n) end
function tmp = code(x, n) tmp = ((((0.5 + (-0.3333333333333333 / x)) / x) + -1.0) / -x) / n; end
code[x_, n_] := N[(N[(N[(N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + -1.0), $MachinePrecision] / (-x)), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\frac{0.5 + \frac{-0.3333333333333333}{x}}{x} + -1}{-x}}{n}
\end{array}
Initial program 56.2%
Taylor expanded in n around inf 57.8%
log1p-define57.8%
Simplified57.8%
expm1-log1p-u57.5%
Applied egg-rr57.5%
Taylor expanded in x around -inf 44.2%
mul-1-neg44.2%
distribute-neg-frac244.2%
sub-neg44.2%
associate-*r/44.2%
sub-neg44.2%
metadata-eval44.2%
distribute-lft-in44.2%
neg-mul-144.2%
associate-*r/44.2%
metadata-eval44.2%
distribute-neg-frac44.2%
metadata-eval44.2%
metadata-eval44.2%
metadata-eval44.2%
Simplified44.2%
Final simplification44.2%
(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 56.2%
Taylor expanded in n around inf 57.8%
log1p-define57.8%
Simplified57.8%
Taylor expanded in x around inf 40.2%
(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 56.2%
Taylor expanded in x around inf 36.3%
Simplified36.2%
Taylor expanded in x around inf 61.0%
mul-1-neg61.0%
log-rec61.0%
distribute-neg-frac61.0%
remove-double-neg61.0%
Simplified61.0%
Taylor expanded in n around inf 40.1%
(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(1.0 / Float64(x * n)) end
function tmp = code(x, n) tmp = 1.0 / (x * n); end
code[x_, n_] := N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x \cdot n}
\end{array}
Initial program 56.2%
Taylor expanded in n around inf 57.8%
log1p-define57.8%
Simplified57.8%
Taylor expanded in x around inf 39.1%
*-commutative39.1%
Simplified39.1%
herbie shell --seed 2024144
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))