
(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) -2e-77)
(/ (pow x (+ (/ 1.0 n) -1.0)) n)
(if (<= (/ 1.0 n) 5e-80)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 2e-5)
(/ (+ (/ t_0 n) (* t_0 (/ (+ (/ 0.5 (pow n 2.0)) (/ -0.5 n)) x))) x)
(- (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) <= -2e-77) {
tmp = pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 5e-80) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 2e-5) {
tmp = ((t_0 / n) + (t_0 * (((0.5 / pow(n, 2.0)) + (-0.5 / n)) / x))) / x;
} 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) <= -2e-77) {
tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 5e-80) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 2e-5) {
tmp = ((t_0 / n) + (t_0 * (((0.5 / Math.pow(n, 2.0)) + (-0.5 / n)) / x))) / x;
} 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) <= -2e-77: tmp = math.pow(x, ((1.0 / n) + -1.0)) / n elif (1.0 / n) <= 5e-80: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 2e-5: tmp = ((t_0 / n) + (t_0 * (((0.5 / math.pow(n, 2.0)) + (-0.5 / n)) / x))) / x 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) <= -2e-77) tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n); elseif (Float64(1.0 / n) <= 5e-80) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 2e-5) tmp = Float64(Float64(Float64(t_0 / n) + Float64(t_0 * Float64(Float64(Float64(0.5 / (n ^ 2.0)) + Float64(-0.5 / n)) / x))) / x); 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], -2e-77], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-80], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-5], N[(N[(N[(t$95$0 / n), $MachinePrecision] + N[(t$95$0 * N[(N[(N[(0.5 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision] + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $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 -2 \cdot 10^{-77}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-80}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{t\_0}{n} + t\_0 \cdot \frac{\frac{0.5}{{n}^{2}} + \frac{-0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.9999999999999999e-77Initial program 85.2%
Taylor expanded in x around inf 91.8%
mul-1-neg91.8%
log-rec91.8%
mul-1-neg91.8%
distribute-neg-frac91.8%
mul-1-neg91.8%
remove-double-neg91.8%
*-commutative91.8%
Simplified91.8%
*-un-lft-identity91.8%
associate-/r*92.6%
div-inv92.6%
pow-to-exp92.6%
pow192.6%
pow-div92.6%
Applied egg-rr92.6%
*-lft-identity92.6%
sub-neg92.6%
metadata-eval92.6%
Simplified92.6%
if -1.9999999999999999e-77 < (/.f64 #s(literal 1 binary64) n) < 5e-80Initial program 33.4%
Taylor expanded in n around inf 88.2%
log1p-define88.2%
Simplified88.2%
if 5e-80 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000016e-5Initial program 13.2%
add-log-exp12.9%
pow-to-exp12.9%
un-div-inv12.9%
+-commutative12.9%
log1p-define12.9%
Applied egg-rr12.9%
Taylor expanded in x around inf 85.0%
Simplified85.0%
if 2.00000000000000016e-5 < (/.f64 #s(literal 1 binary64) n) Initial program 67.8%
Taylor expanded in n around 0 67.8%
log1p-define99.9%
Simplified99.9%
Final simplification90.7%
(FPCore (x n)
:precision binary64
(if (<= x 3.5)
(/
(-
(+
(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 x (+ (/ 1.0 n) -1.0)) n)))
double code(double x, double n) {
double tmp;
if (x <= 3.5) {
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(x, ((1.0 / n) + -1.0)) / n;
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if (x <= 3.5) {
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(x, ((1.0 / n) + -1.0)) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 3.5: 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(x, ((1.0 / n) + -1.0)) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 3.5) 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((x ^ Float64(Float64(1.0 / n) + -1.0)) / n); end return tmp end
code[x_, n_] := If[LessEqual[x, 3.5], 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[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.5:\\
\;\;\;\;\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{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\end{array}
\end{array}
if x < 3.5Initial program 40.8%
Taylor expanded in n around -inf 82.0%
Simplified82.0%
if 3.5 < x Initial program 68.0%
Taylor expanded in x around inf 97.7%
mul-1-neg97.7%
log-rec97.7%
mul-1-neg97.7%
distribute-neg-frac97.7%
mul-1-neg97.7%
remove-double-neg97.7%
*-commutative97.7%
Simplified97.7%
*-un-lft-identity97.7%
associate-/r*99.2%
div-inv99.2%
pow-to-exp99.2%
pow199.2%
pow-div99.1%
Applied egg-rr99.1%
*-lft-identity99.1%
sub-neg99.1%
metadata-eval99.1%
Simplified99.1%
Final simplification90.0%
(FPCore (x n)
:precision binary64
(if (<= x 0.52)
(/
(-
(* -0.16666666666666666 (/ (pow (log x) 3.0) (pow n 2.0)))
(+ (log x) (* 0.5 (/ (pow (log x) 2.0) n))))
n)
(/ (pow x (+ (/ 1.0 n) -1.0)) n)))
double code(double x, double n) {
double tmp;
if (x <= 0.52) {
tmp = ((-0.16666666666666666 * (pow(log(x), 3.0) / pow(n, 2.0))) - (log(x) + (0.5 * (pow(log(x), 2.0) / n)))) / n;
} else {
tmp = pow(x, ((1.0 / n) + -1.0)) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.52d0) then
tmp = (((-0.16666666666666666d0) * ((log(x) ** 3.0d0) / (n ** 2.0d0))) - (log(x) + (0.5d0 * ((log(x) ** 2.0d0) / n)))) / n
else
tmp = (x ** ((1.0d0 / n) + (-1.0d0))) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.52) {
tmp = ((-0.16666666666666666 * (Math.pow(Math.log(x), 3.0) / Math.pow(n, 2.0))) - (Math.log(x) + (0.5 * (Math.pow(Math.log(x), 2.0) / n)))) / n;
} else {
tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.52: tmp = ((-0.16666666666666666 * (math.pow(math.log(x), 3.0) / math.pow(n, 2.0))) - (math.log(x) + (0.5 * (math.pow(math.log(x), 2.0) / n)))) / n else: tmp = math.pow(x, ((1.0 / n) + -1.0)) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.52) tmp = Float64(Float64(Float64(-0.16666666666666666 * Float64((log(x) ^ 3.0) / (n ^ 2.0))) - Float64(log(x) + Float64(0.5 * Float64((log(x) ^ 2.0) / n)))) / n); else tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.52) tmp = ((-0.16666666666666666 * ((log(x) ^ 3.0) / (n ^ 2.0))) - (log(x) + (0.5 * ((log(x) ^ 2.0) / n)))) / n; else tmp = (x ^ ((1.0 / n) + -1.0)) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.52], N[(N[(N[(-0.16666666666666666 * N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] + N[(0.5 * N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.52:\\
\;\;\;\;\frac{-0.16666666666666666 \cdot \frac{{\log x}^{3}}{{n}^{2}} - \left(\log x + 0.5 \cdot \frac{{\log x}^{2}}{n}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\end{array}
\end{array}
if x < 0.52000000000000002Initial program 40.8%
Taylor expanded in x around 0 40.1%
Taylor expanded in n around inf 81.4%
if 0.52000000000000002 < x Initial program 68.0%
Taylor expanded in x around inf 97.7%
mul-1-neg97.7%
log-rec97.7%
mul-1-neg97.7%
distribute-neg-frac97.7%
mul-1-neg97.7%
remove-double-neg97.7%
*-commutative97.7%
Simplified97.7%
*-un-lft-identity97.7%
associate-/r*99.2%
div-inv99.2%
pow-to-exp99.2%
pow199.2%
pow-div99.1%
Applied egg-rr99.1%
*-lft-identity99.1%
sub-neg99.1%
metadata-eval99.1%
Simplified99.1%
Final simplification89.7%
(FPCore (x n)
:precision binary64
(if (<= x 0.24)
(/
(-
(/
(+
(* -0.16666666666666666 (/ (pow (log x) 3.0) n))
(* (pow (log x) 2.0) -0.5))
n)
(log x))
n)
(/ (pow x (+ (/ 1.0 n) -1.0)) n)))
double code(double x, double n) {
double tmp;
if (x <= 0.24) {
tmp = ((((-0.16666666666666666 * (pow(log(x), 3.0) / n)) + (pow(log(x), 2.0) * -0.5)) / n) - log(x)) / n;
} else {
tmp = pow(x, ((1.0 / n) + -1.0)) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.24d0) then
tmp = (((((-0.16666666666666666d0) * ((log(x) ** 3.0d0) / n)) + ((log(x) ** 2.0d0) * (-0.5d0))) / n) - log(x)) / n
else
tmp = (x ** ((1.0d0 / n) + (-1.0d0))) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.24) {
tmp = ((((-0.16666666666666666 * (Math.pow(Math.log(x), 3.0) / n)) + (Math.pow(Math.log(x), 2.0) * -0.5)) / n) - Math.log(x)) / n;
} else {
tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.24: tmp = ((((-0.16666666666666666 * (math.pow(math.log(x), 3.0) / n)) + (math.pow(math.log(x), 2.0) * -0.5)) / n) - math.log(x)) / n else: tmp = math.pow(x, ((1.0 / n) + -1.0)) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.24) tmp = Float64(Float64(Float64(Float64(Float64(-0.16666666666666666 * Float64((log(x) ^ 3.0) / n)) + Float64((log(x) ^ 2.0) * -0.5)) / n) - log(x)) / n); else tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.24) tmp = ((((-0.16666666666666666 * ((log(x) ^ 3.0) / n)) + ((log(x) ^ 2.0) * -0.5)) / n) - log(x)) / n; else tmp = (x ^ ((1.0 / n) + -1.0)) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.24], N[(N[(N[(N[(N[(-0.16666666666666666 * N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.24:\\
\;\;\;\;\frac{\frac{-0.16666666666666666 \cdot \frac{{\log x}^{3}}{n} + {\log x}^{2} \cdot -0.5}{n} - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\end{array}
\end{array}
if x < 0.23999999999999999Initial program 40.8%
Taylor expanded in x around 0 40.1%
Taylor expanded in n around -inf 81.4%
mul-1-neg81.4%
Simplified81.4%
if 0.23999999999999999 < x Initial program 68.0%
Taylor expanded in x around inf 97.7%
mul-1-neg97.7%
log-rec97.7%
mul-1-neg97.7%
distribute-neg-frac97.7%
mul-1-neg97.7%
remove-double-neg97.7%
*-commutative97.7%
Simplified97.7%
*-un-lft-identity97.7%
associate-/r*99.2%
div-inv99.2%
pow-to-exp99.2%
pow199.2%
pow-div99.1%
Applied egg-rr99.1%
*-lft-identity99.1%
sub-neg99.1%
metadata-eval99.1%
Simplified99.1%
Final simplification89.7%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -2e-77)
(/ (pow x (+ (/ 1.0 n) -1.0)) n)
(if (<= (/ 1.0 n) 5e-80)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 2e-5)
(/
(/
(+
(+ 1.0 (- (/ 0.3333333333333333 (pow x 2.0)) (/ (log (/ 1.0 x)) n)))
(* 0.5 (/ -1.0 x)))
x)
n)
(- (exp (/ (log1p x) n)) (pow x (/ 1.0 n)))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e-77) {
tmp = pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 5e-80) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 2e-5) {
tmp = (((1.0 + ((0.3333333333333333 / pow(x, 2.0)) - (log((1.0 / x)) / n))) + (0.5 * (-1.0 / x))) / x) / n;
} else {
tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e-77) {
tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 5e-80) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 2e-5) {
tmp = (((1.0 + ((0.3333333333333333 / Math.pow(x, 2.0)) - (Math.log((1.0 / x)) / n))) + (0.5 * (-1.0 / x))) / x) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -2e-77: tmp = math.pow(x, ((1.0 / n) + -1.0)) / n elif (1.0 / n) <= 5e-80: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 2e-5: tmp = (((1.0 + ((0.3333333333333333 / math.pow(x, 2.0)) - (math.log((1.0 / x)) / n))) + (0.5 * (-1.0 / x))) / x) / n else: tmp = math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-77) tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n); elseif (Float64(1.0 / n) <= 5e-80) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 2e-5) tmp = Float64(Float64(Float64(Float64(1.0 + Float64(Float64(0.3333333333333333 / (x ^ 2.0)) - Float64(log(Float64(1.0 / x)) / n))) + Float64(0.5 * Float64(-1.0 / x))) / x) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-77], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-80], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-5], N[(N[(N[(N[(1.0 + N[(N[(0.3333333333333333 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] - N[(N[Log[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-77}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-80}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{\left(1 + \left(\frac{0.3333333333333333}{{x}^{2}} - \frac{\log \left(\frac{1}{x}\right)}{n}\right)\right) + 0.5 \cdot \frac{-1}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.9999999999999999e-77Initial program 85.2%
Taylor expanded in x around inf 91.8%
mul-1-neg91.8%
log-rec91.8%
mul-1-neg91.8%
distribute-neg-frac91.8%
mul-1-neg91.8%
remove-double-neg91.8%
*-commutative91.8%
Simplified91.8%
*-un-lft-identity91.8%
associate-/r*92.6%
div-inv92.6%
pow-to-exp92.6%
pow192.6%
pow-div92.6%
Applied egg-rr92.6%
*-lft-identity92.6%
sub-neg92.6%
metadata-eval92.6%
Simplified92.6%
if -1.9999999999999999e-77 < (/.f64 #s(literal 1 binary64) n) < 5e-80Initial program 33.4%
Taylor expanded in n around inf 88.2%
log1p-define88.2%
Simplified88.2%
if 5e-80 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000016e-5Initial program 13.2%
Taylor expanded in n around inf 27.9%
Simplified27.9%
Taylor expanded in x around inf 83.3%
Taylor expanded in n around inf 83.5%
if 2.00000000000000016e-5 < (/.f64 #s(literal 1 binary64) n) Initial program 67.8%
Taylor expanded in n around 0 67.8%
log1p-define99.9%
Simplified99.9%
Final simplification90.5%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -2e-77)
(/ (pow x (+ (/ 1.0 n) -1.0)) n)
(if (<= (/ 1.0 n) 5e-80)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 2e-5)
(/
(/
(+
(+ 1.0 (- (/ 0.3333333333333333 (pow x 2.0)) (/ (log (/ 1.0 x)) n)))
(* 0.5 (/ -1.0 x)))
x)
n)
(-
(+
1.0
(*
x
(+
(/ 1.0 n)
(* x (+ (* 0.5 (/ 1.0 (pow n 2.0))) (* 0.5 (/ -1.0 n)))))))
(pow x (/ 1.0 n)))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e-77) {
tmp = pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 5e-80) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 2e-5) {
tmp = (((1.0 + ((0.3333333333333333 / pow(x, 2.0)) - (log((1.0 / x)) / n))) + (0.5 * (-1.0 / x))) / x) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * (1.0 / pow(n, 2.0))) + (0.5 * (-1.0 / n))))))) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e-77) {
tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 5e-80) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 2e-5) {
tmp = (((1.0 + ((0.3333333333333333 / Math.pow(x, 2.0)) - (Math.log((1.0 / x)) / n))) + (0.5 * (-1.0 / x))) / 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))))))) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -2e-77: tmp = math.pow(x, ((1.0 / n) + -1.0)) / n elif (1.0 / n) <= 5e-80: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 2e-5: tmp = (((1.0 + ((0.3333333333333333 / math.pow(x, 2.0)) - (math.log((1.0 / x)) / n))) + (0.5 * (-1.0 / x))) / 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))))))) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-77) tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n); elseif (Float64(1.0 / n) <= 5e-80) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 2e-5) tmp = Float64(Float64(Float64(Float64(1.0 + Float64(Float64(0.3333333333333333 / (x ^ 2.0)) - Float64(log(Float64(1.0 / x)) / n))) + Float64(0.5 * Float64(-1.0 / x))) / 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))))))) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-77], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-80], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-5], N[(N[(N[(N[(1.0 + N[(N[(0.3333333333333333 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] - N[(N[Log[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $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] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-77}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-80}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{\left(1 + \left(\frac{0.3333333333333333}{{x}^{2}} - \frac{\log \left(\frac{1}{x}\right)}{n}\right)\right) + 0.5 \cdot \frac{-1}{x}}{x}}{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) - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.9999999999999999e-77Initial program 85.2%
Taylor expanded in x around inf 91.8%
mul-1-neg91.8%
log-rec91.8%
mul-1-neg91.8%
distribute-neg-frac91.8%
mul-1-neg91.8%
remove-double-neg91.8%
*-commutative91.8%
Simplified91.8%
*-un-lft-identity91.8%
associate-/r*92.6%
div-inv92.6%
pow-to-exp92.6%
pow192.6%
pow-div92.6%
Applied egg-rr92.6%
*-lft-identity92.6%
sub-neg92.6%
metadata-eval92.6%
Simplified92.6%
if -1.9999999999999999e-77 < (/.f64 #s(literal 1 binary64) n) < 5e-80Initial program 33.4%
Taylor expanded in n around inf 88.2%
log1p-define88.2%
Simplified88.2%
if 5e-80 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000016e-5Initial program 13.2%
Taylor expanded in n around inf 27.9%
Simplified27.9%
Taylor expanded in x around inf 83.3%
Taylor expanded in n around inf 83.5%
if 2.00000000000000016e-5 < (/.f64 #s(literal 1 binary64) n) Initial program 67.8%
Taylor expanded in x around 0 70.3%
Final simplification87.5%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -2e-77)
(/ (pow x (+ (/ 1.0 n) -1.0)) n)
(if (<= (/ 1.0 n) 5e-80)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 2e-5)
(/
(/
(+
(+ 1.0 (- (/ 0.3333333333333333 (pow x 2.0)) (/ (log (/ 1.0 x)) n)))
(* 0.5 (/ -1.0 x)))
x)
n)
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n)))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e-77) {
tmp = pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 5e-80) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 2e-5) {
tmp = (((1.0 + ((0.3333333333333333 / pow(x, 2.0)) - (log((1.0 / x)) / n))) + (0.5 * (-1.0 / x))) / x) / n;
} else {
tmp = pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -2e-77) {
tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 5e-80) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 2e-5) {
tmp = (((1.0 + ((0.3333333333333333 / Math.pow(x, 2.0)) - (Math.log((1.0 / x)) / n))) + (0.5 * (-1.0 / x))) / x) / n;
} else {
tmp = Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -2e-77: tmp = math.pow(x, ((1.0 / n) + -1.0)) / n elif (1.0 / n) <= 5e-80: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 2e-5: tmp = (((1.0 + ((0.3333333333333333 / math.pow(x, 2.0)) - (math.log((1.0 / x)) / n))) + (0.5 * (-1.0 / x))) / x) / n else: tmp = math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-77) tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n); elseif (Float64(1.0 / n) <= 5e-80) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 2e-5) tmp = Float64(Float64(Float64(Float64(1.0 + Float64(Float64(0.3333333333333333 / (x ^ 2.0)) - Float64(log(Float64(1.0 / x)) / n))) + Float64(0.5 * Float64(-1.0 / x))) / x) / n); else tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-77], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-80], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-5], N[(N[(N[(N[(1.0 + N[(N[(0.3333333333333333 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] - N[(N[Log[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], 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}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-77}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-80}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{\left(1 + \left(\frac{0.3333333333333333}{{x}^{2}} - \frac{\log \left(\frac{1}{x}\right)}{n}\right)\right) + 0.5 \cdot \frac{-1}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.9999999999999999e-77Initial program 85.2%
Taylor expanded in x around inf 91.8%
mul-1-neg91.8%
log-rec91.8%
mul-1-neg91.8%
distribute-neg-frac91.8%
mul-1-neg91.8%
remove-double-neg91.8%
*-commutative91.8%
Simplified91.8%
*-un-lft-identity91.8%
associate-/r*92.6%
div-inv92.6%
pow-to-exp92.6%
pow192.6%
pow-div92.6%
Applied egg-rr92.6%
*-lft-identity92.6%
sub-neg92.6%
metadata-eval92.6%
Simplified92.6%
if -1.9999999999999999e-77 < (/.f64 #s(literal 1 binary64) n) < 5e-80Initial program 33.4%
Taylor expanded in n around inf 88.2%
log1p-define88.2%
Simplified88.2%
if 5e-80 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000016e-5Initial program 13.2%
Taylor expanded in n around inf 27.9%
Simplified27.9%
Taylor expanded in x around inf 83.3%
Taylor expanded in n around inf 83.5%
if 2.00000000000000016e-5 < (/.f64 #s(literal 1 binary64) n) Initial program 67.8%
Final simplification87.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (pow x (+ (/ 1.0 n) -1.0)) n)))
(if (<= (/ 1.0 n) -2e-77)
t_0
(if (<= (/ 1.0 n) 5e-80)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 2e-5)
t_0
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))))))
double code(double x, double n) {
double t_0 = pow(x, ((1.0 / n) + -1.0)) / n;
double tmp;
if ((1.0 / n) <= -2e-77) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-80) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 2e-5) {
tmp = t_0;
} else {
tmp = pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, ((1.0 / n) + -1.0)) / n;
double tmp;
if ((1.0 / n) <= -2e-77) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-80) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 2e-5) {
tmp = t_0;
} else {
tmp = Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, ((1.0 / n) + -1.0)) / n tmp = 0 if (1.0 / n) <= -2e-77: tmp = t_0 elif (1.0 / n) <= 5e-80: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 2e-5: tmp = t_0 else: tmp = math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) t_0 = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-77) tmp = t_0; elseif (Float64(1.0 / n) <= 5e-80) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 2e-5) tmp = t_0; else tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-77], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-80], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-5], t$95$0, 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}
\\
\begin{array}{l}
t_0 := \frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-77}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-80}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-5}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.9999999999999999e-77 or 5e-80 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000016e-5Initial program 71.2%
Taylor expanded in x around inf 90.0%
mul-1-neg90.0%
log-rec90.0%
mul-1-neg90.0%
distribute-neg-frac90.0%
mul-1-neg90.0%
remove-double-neg90.0%
*-commutative90.0%
Simplified90.0%
*-un-lft-identity90.0%
associate-/r*90.9%
div-inv90.9%
pow-to-exp90.9%
pow190.9%
pow-div90.8%
Applied egg-rr90.8%
*-lft-identity90.8%
sub-neg90.8%
metadata-eval90.8%
Simplified90.8%
if -1.9999999999999999e-77 < (/.f64 #s(literal 1 binary64) n) < 5e-80Initial program 33.4%
Taylor expanded in n around inf 88.2%
log1p-define88.2%
Simplified88.2%
if 2.00000000000000016e-5 < (/.f64 #s(literal 1 binary64) n) Initial program 67.8%
Final simplification87.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (pow x (+ (/ 1.0 n) -1.0)) n)))
(if (<= (/ 1.0 n) -2e-77)
t_0
(if (<= (/ 1.0 n) 5e-80)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 2e-5) t_0 (- (+ 1.0 (/ x n)) (pow x (/ 1.0 n))))))))
double code(double x, double n) {
double t_0 = pow(x, ((1.0 / n) + -1.0)) / n;
double tmp;
if ((1.0 / n) <= -2e-77) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-80) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 2e-5) {
tmp = t_0;
} else {
tmp = (1.0 + (x / n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, ((1.0 / n) + -1.0)) / n;
double tmp;
if ((1.0 / n) <= -2e-77) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-80) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 2e-5) {
tmp = t_0;
} else {
tmp = (1.0 + (x / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, ((1.0 / n) + -1.0)) / n tmp = 0 if (1.0 / n) <= -2e-77: tmp = t_0 elif (1.0 / n) <= 5e-80: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 2e-5: tmp = t_0 else: tmp = (1.0 + (x / n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) t_0 = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-77) tmp = t_0; elseif (Float64(1.0 / n) <= 5e-80) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 2e-5) tmp = t_0; else tmp = Float64(Float64(1.0 + Float64(x / n)) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-77], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-80], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-5], t$95$0, N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-77}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-80}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-5}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.9999999999999999e-77 or 5e-80 < (/.f64 #s(literal 1 binary64) n) < 2.00000000000000016e-5Initial program 71.2%
Taylor expanded in x around inf 90.0%
mul-1-neg90.0%
log-rec90.0%
mul-1-neg90.0%
distribute-neg-frac90.0%
mul-1-neg90.0%
remove-double-neg90.0%
*-commutative90.0%
Simplified90.0%
*-un-lft-identity90.0%
associate-/r*90.9%
div-inv90.9%
pow-to-exp90.9%
pow190.9%
pow-div90.8%
Applied egg-rr90.8%
*-lft-identity90.8%
sub-neg90.8%
metadata-eval90.8%
Simplified90.8%
if -1.9999999999999999e-77 < (/.f64 #s(literal 1 binary64) n) < 5e-80Initial program 33.4%
Taylor expanded in n around inf 88.2%
log1p-define88.2%
Simplified88.2%
if 2.00000000000000016e-5 < (/.f64 #s(literal 1 binary64) n) Initial program 67.8%
Taylor expanded in x around 0 66.1%
Final simplification87.1%
(FPCore (x n)
:precision binary64
(let* ((t_0
(/
(+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ (/ 0.3333333333333333 x) n)) x))
x)))
(if (<= n -5.8e+76)
(/ (log x) (- n))
(if (<= n -2.9e+17)
t_0
(if (<= n -330000.0)
(/ -1.0 (/ n (log x)))
(if (<= n 4.9e-202)
(/ 0.3333333333333333 (* n (pow x 3.0)))
(if (<= n 58000.0)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= n 1.7e+79)
t_0
(if (<= n 7.2e+122) (/ (- x (log x)) n) (/ (/ 1.0 n) x))))))))))
double code(double x, double n) {
double t_0 = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / x;
double tmp;
if (n <= -5.8e+76) {
tmp = log(x) / -n;
} else if (n <= -2.9e+17) {
tmp = t_0;
} else if (n <= -330000.0) {
tmp = -1.0 / (n / log(x));
} else if (n <= 4.9e-202) {
tmp = 0.3333333333333333 / (n * pow(x, 3.0));
} else if (n <= 58000.0) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (n <= 1.7e+79) {
tmp = t_0;
} else if (n <= 7.2e+122) {
tmp = (x - log(x)) / n;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = ((1.0d0 / n) + ((((-0.5d0) / n) + ((0.3333333333333333d0 / x) / n)) / x)) / x
if (n <= (-5.8d+76)) then
tmp = log(x) / -n
else if (n <= (-2.9d+17)) then
tmp = t_0
else if (n <= (-330000.0d0)) then
tmp = (-1.0d0) / (n / log(x))
else if (n <= 4.9d-202) then
tmp = 0.3333333333333333d0 / (n * (x ** 3.0d0))
else if (n <= 58000.0d0) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (n <= 1.7d+79) then
tmp = t_0
else if (n <= 7.2d+122) then
tmp = (x - log(x)) / n
else
tmp = (1.0d0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / x;
double tmp;
if (n <= -5.8e+76) {
tmp = Math.log(x) / -n;
} else if (n <= -2.9e+17) {
tmp = t_0;
} else if (n <= -330000.0) {
tmp = -1.0 / (n / Math.log(x));
} else if (n <= 4.9e-202) {
tmp = 0.3333333333333333 / (n * Math.pow(x, 3.0));
} else if (n <= 58000.0) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (n <= 1.7e+79) {
tmp = t_0;
} else if (n <= 7.2e+122) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / x tmp = 0 if n <= -5.8e+76: tmp = math.log(x) / -n elif n <= -2.9e+17: tmp = t_0 elif n <= -330000.0: tmp = -1.0 / (n / math.log(x)) elif n <= 4.9e-202: tmp = 0.3333333333333333 / (n * math.pow(x, 3.0)) elif n <= 58000.0: tmp = 1.0 - math.pow(x, (1.0 / n)) elif n <= 1.7e+79: tmp = t_0 elif n <= 7.2e+122: tmp = (x - math.log(x)) / n else: tmp = (1.0 / n) / x return tmp
function code(x, n) t_0 = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(Float64(0.3333333333333333 / x) / n)) / x)) / x) tmp = 0.0 if (n <= -5.8e+76) tmp = Float64(log(x) / Float64(-n)); elseif (n <= -2.9e+17) tmp = t_0; elseif (n <= -330000.0) tmp = Float64(-1.0 / Float64(n / log(x))); elseif (n <= 4.9e-202) tmp = Float64(0.3333333333333333 / Float64(n * (x ^ 3.0))); elseif (n <= 58000.0) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (n <= 1.7e+79) tmp = t_0; elseif (n <= 7.2e+122) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(1.0 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / x; tmp = 0.0; if (n <= -5.8e+76) tmp = log(x) / -n; elseif (n <= -2.9e+17) tmp = t_0; elseif (n <= -330000.0) tmp = -1.0 / (n / log(x)); elseif (n <= 4.9e-202) tmp = 0.3333333333333333 / (n * (x ^ 3.0)); elseif (n <= 58000.0) tmp = 1.0 - (x ^ (1.0 / n)); elseif (n <= 1.7e+79) tmp = t_0; elseif (n <= 7.2e+122) tmp = (x - log(x)) / n; else tmp = (1.0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(N[(0.3333333333333333 / x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[n, -5.8e+76], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[n, -2.9e+17], t$95$0, If[LessEqual[n, -330000.0], N[(-1.0 / N[(n / N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.9e-202], N[(0.3333333333333333 / N[(n * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 58000.0], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.7e+79], t$95$0, If[LessEqual[n, 7.2e+122], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{\frac{0.3333333333333333}{x}}{n}}{x}}{x}\\
\mathbf{if}\;n \leq -5.8 \cdot 10^{+76}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;n \leq -2.9 \cdot 10^{+17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -330000:\\
\;\;\;\;\frac{-1}{\frac{n}{\log x}}\\
\mathbf{elif}\;n \leq 4.9 \cdot 10^{-202}:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\
\mathbf{elif}\;n \leq 58000:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;n \leq 1.7 \cdot 10^{+79}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 7.2 \cdot 10^{+122}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\end{array}
\end{array}
if n < -5.8000000000000003e76Initial program 30.9%
Taylor expanded in x around 0 30.9%
Taylor expanded in n around inf 65.7%
mul-1-neg65.7%
distribute-neg-frac265.7%
Simplified65.7%
if -5.8000000000000003e76 < n < -2.9e17 or 58000 < n < 1.70000000000000016e79Initial program 12.6%
Taylor expanded in n around inf 33.4%
Simplified33.4%
Taylor expanded in x around inf 78.3%
Taylor expanded in n around inf 73.8%
sub-neg73.8%
+-commutative73.8%
associate-+l+73.8%
associate-*r/73.8%
metadata-eval73.8%
associate-*r/73.8%
metadata-eval73.8%
distribute-neg-frac73.8%
metadata-eval73.8%
*-commutative73.8%
Simplified73.8%
Taylor expanded in x around inf 75.5%
Simplified75.5%
if -2.9e17 < n < -3.3e5Initial program 53.2%
Taylor expanded in x around 0 53.2%
add-cbrt-cube53.2%
pow353.2%
Applied egg-rr53.2%
Taylor expanded in n around inf 69.9%
mul-1-neg69.9%
distribute-neg-frac269.9%
Simplified69.9%
rem-cbrt-cube69.9%
clear-num70.0%
frac-2neg70.0%
metadata-eval70.0%
add-sqr-sqrt70.0%
sqrt-unprod70.0%
sqr-neg70.0%
sqrt-unprod0.0%
add-sqr-sqrt1.6%
distribute-frac-neg1.6%
add-sqr-sqrt1.6%
sqrt-unprod1.6%
sqr-neg1.6%
sqrt-unprod0.0%
add-sqr-sqrt70.0%
Applied egg-rr70.0%
if -3.3e5 < n < 4.9000000000000004e-202Initial program 93.9%
Taylor expanded in n around inf 76.4%
Simplified77.7%
Taylor expanded in x around inf 22.4%
Taylor expanded in n around inf 47.5%
sub-neg47.5%
+-commutative47.5%
associate-+l+47.5%
associate-*r/47.5%
metadata-eval47.5%
associate-*r/47.5%
metadata-eval47.5%
distribute-neg-frac47.5%
metadata-eval47.5%
*-commutative47.5%
Simplified47.5%
Taylor expanded in x around 0 87.3%
if 4.9000000000000004e-202 < n < 58000Initial program 80.8%
Taylor expanded in x around 0 76.2%
if 1.70000000000000016e79 < n < 7.2000000000000005e122Initial program 13.8%
Taylor expanded in x around 0 3.8%
Taylor expanded in n around inf 74.0%
if 7.2000000000000005e122 < n Initial program 40.3%
Taylor expanded in x around inf 54.5%
mul-1-neg54.5%
log-rec54.5%
mul-1-neg54.5%
distribute-neg-frac54.5%
mul-1-neg54.5%
remove-double-neg54.5%
*-commutative54.5%
Simplified54.5%
Taylor expanded in n around inf 54.5%
associate-/r*55.0%
Simplified55.0%
Final simplification73.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- 1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) (* x n))))
(if (<= x 2.7e-226)
(* (log x) (/ -1.0 n))
(if (<= x 3.5e-215)
t_0
(if (<= x 2.05e-129)
(/ -1.0 (/ n (log x)))
(if (<= x 7.8e-125)
t_0
(if (<= x 0.043)
(/ (- x (log x)) n)
(/ (pow x (+ (/ 1.0 n) -1.0)) n))))))))
double code(double x, double n) {
double t_0 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n);
double tmp;
if (x <= 2.7e-226) {
tmp = log(x) * (-1.0 / n);
} else if (x <= 3.5e-215) {
tmp = t_0;
} else if (x <= 2.05e-129) {
tmp = -1.0 / (n / log(x));
} else if (x <= 7.8e-125) {
tmp = t_0;
} else if (x <= 0.043) {
tmp = (x - log(x)) / n;
} else {
tmp = pow(x, ((1.0 / n) + -1.0)) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = (1.0d0 - ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / (x * n)
if (x <= 2.7d-226) then
tmp = log(x) * ((-1.0d0) / n)
else if (x <= 3.5d-215) then
tmp = t_0
else if (x <= 2.05d-129) then
tmp = (-1.0d0) / (n / log(x))
else if (x <= 7.8d-125) then
tmp = t_0
else if (x <= 0.043d0) then
tmp = (x - log(x)) / n
else
tmp = (x ** ((1.0d0 / n) + (-1.0d0))) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n);
double tmp;
if (x <= 2.7e-226) {
tmp = Math.log(x) * (-1.0 / n);
} else if (x <= 3.5e-215) {
tmp = t_0;
} else if (x <= 2.05e-129) {
tmp = -1.0 / (n / Math.log(x));
} else if (x <= 7.8e-125) {
tmp = t_0;
} else if (x <= 0.043) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
}
return tmp;
}
def code(x, n): t_0 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n) tmp = 0 if x <= 2.7e-226: tmp = math.log(x) * (-1.0 / n) elif x <= 3.5e-215: tmp = t_0 elif x <= 2.05e-129: tmp = -1.0 / (n / math.log(x)) elif x <= 7.8e-125: tmp = t_0 elif x <= 0.043: tmp = (x - math.log(x)) / n else: tmp = math.pow(x, ((1.0 / n) + -1.0)) / n return tmp
function code(x, n) t_0 = Float64(Float64(1.0 - Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / Float64(x * n)) tmp = 0.0 if (x <= 2.7e-226) tmp = Float64(log(x) * Float64(-1.0 / n)); elseif (x <= 3.5e-215) tmp = t_0; elseif (x <= 2.05e-129) tmp = Float64(-1.0 / Float64(n / log(x))); elseif (x <= 7.8e-125) tmp = t_0; elseif (x <= 0.043) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n); tmp = 0.0; if (x <= 2.7e-226) tmp = log(x) * (-1.0 / n); elseif (x <= 3.5e-215) tmp = t_0; elseif (x <= 2.05e-129) tmp = -1.0 / (n / log(x)); elseif (x <= 7.8e-125) tmp = t_0; elseif (x <= 0.043) tmp = (x - log(x)) / n; else tmp = (x ^ ((1.0 / n) + -1.0)) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.7e-226], N[(N[Log[x], $MachinePrecision] * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e-215], t$95$0, If[LessEqual[x, 2.05e-129], N[(-1.0 / N[(n / N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.8e-125], t$95$0, If[LessEqual[x, 0.043], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1 - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x \cdot n}\\
\mathbf{if}\;x \leq 2.7 \cdot 10^{-226}:\\
\;\;\;\;\log x \cdot \frac{-1}{n}\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-215}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{-129}:\\
\;\;\;\;\frac{-1}{\frac{n}{\log x}}\\
\mathbf{elif}\;x \leq 7.8 \cdot 10^{-125}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 0.043:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\end{array}
\end{array}
if x < 2.70000000000000014e-226Initial program 42.4%
Taylor expanded in x around 0 42.4%
add-cbrt-cube42.4%
pow342.5%
Applied egg-rr42.5%
Taylor expanded in n around inf 43.7%
mul-1-neg57.9%
distribute-neg-frac257.9%
Simplified43.7%
rem-cbrt-cube57.9%
frac-2neg57.9%
div-inv58.0%
remove-double-neg58.0%
Applied egg-rr58.0%
if 2.70000000000000014e-226 < x < 3.5000000000000002e-215 or 2.05e-129 < x < 7.79999999999999965e-125Initial program 83.9%
Taylor expanded in n around inf 35.8%
Simplified35.8%
Taylor expanded in x around inf 25.0%
Taylor expanded in n around inf 91.9%
sub-neg91.9%
+-commutative91.9%
associate-+l+91.9%
associate-*r/91.9%
metadata-eval91.9%
associate-*r/91.9%
metadata-eval91.9%
distribute-neg-frac91.9%
metadata-eval91.9%
*-commutative91.9%
Simplified91.9%
Taylor expanded in x around -inf 91.9%
mul-1-neg91.9%
unsub-neg91.9%
sub-neg91.9%
associate-*r/91.9%
metadata-eval91.9%
distribute-neg-frac91.9%
metadata-eval91.9%
Simplified91.9%
if 3.5000000000000002e-215 < x < 2.05e-129Initial program 27.1%
Taylor expanded in x around 0 27.1%
add-cbrt-cube27.1%
pow327.1%
Applied egg-rr27.1%
Taylor expanded in n around inf 18.0%
mul-1-neg78.4%
distribute-neg-frac278.4%
Simplified18.0%
rem-cbrt-cube78.4%
clear-num78.5%
frac-2neg78.5%
metadata-eval78.5%
add-sqr-sqrt38.8%
sqrt-unprod14.1%
sqr-neg14.1%
sqrt-unprod1.9%
add-sqr-sqrt3.5%
distribute-frac-neg3.5%
add-sqr-sqrt1.6%
sqrt-unprod17.7%
sqr-neg17.7%
sqrt-unprod39.2%
add-sqr-sqrt78.5%
Applied egg-rr78.5%
if 7.79999999999999965e-125 < x < 0.042999999999999997Initial program 37.7%
Taylor expanded in x around 0 36.1%
Taylor expanded in n around inf 59.8%
if 0.042999999999999997 < x Initial program 68.0%
Taylor expanded in x around inf 97.7%
mul-1-neg97.7%
log-rec97.7%
mul-1-neg97.7%
distribute-neg-frac97.7%
mul-1-neg97.7%
remove-double-neg97.7%
*-commutative97.7%
Simplified97.7%
*-un-lft-identity97.7%
associate-/r*99.2%
div-inv99.2%
pow-to-exp99.2%
pow199.2%
pow-div99.1%
Applied egg-rr99.1%
*-lft-identity99.1%
sub-neg99.1%
metadata-eval99.1%
Simplified99.1%
Final simplification81.7%
(FPCore (x n)
:precision binary64
(if (<= x 1.7e-226)
(* (log x) (/ -1.0 n))
(if (<= x 4.6e-215)
(- (+ 1.0 (/ x n)) (pow x (/ 1.0 n)))
(if (<= x 2.3e-129)
(/ -1.0 (/ n (log x)))
(if (<= x 4.5e-125)
(/ (- 1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) (* x n))
(if (<= x 0.046)
(/ (- x (log x)) n)
(/ (pow x (+ (/ 1.0 n) -1.0)) n)))))))
double code(double x, double n) {
double tmp;
if (x <= 1.7e-226) {
tmp = log(x) * (-1.0 / n);
} else if (x <= 4.6e-215) {
tmp = (1.0 + (x / n)) - pow(x, (1.0 / n));
} else if (x <= 2.3e-129) {
tmp = -1.0 / (n / log(x));
} else if (x <= 4.5e-125) {
tmp = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n);
} else if (x <= 0.046) {
tmp = (x - log(x)) / n;
} else {
tmp = pow(x, ((1.0 / n) + -1.0)) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.7d-226) then
tmp = log(x) * ((-1.0d0) / n)
else if (x <= 4.6d-215) then
tmp = (1.0d0 + (x / n)) - (x ** (1.0d0 / n))
else if (x <= 2.3d-129) then
tmp = (-1.0d0) / (n / log(x))
else if (x <= 4.5d-125) then
tmp = (1.0d0 - ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / (x * n)
else if (x <= 0.046d0) then
tmp = (x - log(x)) / n
else
tmp = (x ** ((1.0d0 / n) + (-1.0d0))) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.7e-226) {
tmp = Math.log(x) * (-1.0 / n);
} else if (x <= 4.6e-215) {
tmp = (1.0 + (x / n)) - Math.pow(x, (1.0 / n));
} else if (x <= 2.3e-129) {
tmp = -1.0 / (n / Math.log(x));
} else if (x <= 4.5e-125) {
tmp = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n);
} else if (x <= 0.046) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.7e-226: tmp = math.log(x) * (-1.0 / n) elif x <= 4.6e-215: tmp = (1.0 + (x / n)) - math.pow(x, (1.0 / n)) elif x <= 2.3e-129: tmp = -1.0 / (n / math.log(x)) elif x <= 4.5e-125: tmp = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n) elif x <= 0.046: tmp = (x - math.log(x)) / n else: tmp = math.pow(x, ((1.0 / n) + -1.0)) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.7e-226) tmp = Float64(log(x) * Float64(-1.0 / n)); elseif (x <= 4.6e-215) tmp = Float64(Float64(1.0 + Float64(x / n)) - (x ^ Float64(1.0 / n))); elseif (x <= 2.3e-129) tmp = Float64(-1.0 / Float64(n / log(x))); elseif (x <= 4.5e-125) tmp = Float64(Float64(1.0 - Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / Float64(x * n)); elseif (x <= 0.046) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.7e-226) tmp = log(x) * (-1.0 / n); elseif (x <= 4.6e-215) tmp = (1.0 + (x / n)) - (x ^ (1.0 / n)); elseif (x <= 2.3e-129) tmp = -1.0 / (n / log(x)); elseif (x <= 4.5e-125) tmp = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n); elseif (x <= 0.046) tmp = (x - log(x)) / n; else tmp = (x ^ ((1.0 / n) + -1.0)) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.7e-226], N[(N[Log[x], $MachinePrecision] * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.6e-215], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.3e-129], N[(-1.0 / N[(n / N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.5e-125], N[(N[(1.0 - N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.046], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.7 \cdot 10^{-226}:\\
\;\;\;\;\log x \cdot \frac{-1}{n}\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{-215}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-129}:\\
\;\;\;\;\frac{-1}{\frac{n}{\log x}}\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-125}:\\
\;\;\;\;\frac{1 - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x \cdot n}\\
\mathbf{elif}\;x \leq 0.046:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\end{array}
\end{array}
if x < 1.70000000000000004e-226Initial program 42.4%
Taylor expanded in x around 0 42.4%
add-cbrt-cube42.4%
pow342.5%
Applied egg-rr42.5%
Taylor expanded in n around inf 43.7%
mul-1-neg57.9%
distribute-neg-frac257.9%
Simplified43.7%
rem-cbrt-cube57.9%
frac-2neg57.9%
div-inv58.0%
remove-double-neg58.0%
Applied egg-rr58.0%
if 1.70000000000000004e-226 < x < 4.5999999999999998e-215Initial program 83.9%
Taylor expanded in x around 0 83.9%
if 4.5999999999999998e-215 < x < 2.3e-129Initial program 27.1%
Taylor expanded in x around 0 27.1%
add-cbrt-cube27.1%
pow327.1%
Applied egg-rr27.1%
Taylor expanded in n around inf 18.0%
mul-1-neg78.4%
distribute-neg-frac278.4%
Simplified18.0%
rem-cbrt-cube78.4%
clear-num78.5%
frac-2neg78.5%
metadata-eval78.5%
add-sqr-sqrt38.8%
sqrt-unprod14.1%
sqr-neg14.1%
sqrt-unprod1.9%
add-sqr-sqrt3.5%
distribute-frac-neg3.5%
add-sqr-sqrt1.6%
sqrt-unprod17.7%
sqr-neg17.7%
sqrt-unprod39.2%
add-sqr-sqrt78.5%
Applied egg-rr78.5%
if 2.3e-129 < x < 4.50000000000000012e-125Initial program 83.9%
Taylor expanded in n around inf 51.8%
Simplified51.8%
Taylor expanded in x around inf 33.3%
Taylor expanded in n around inf 100.0%
sub-neg100.0%
+-commutative100.0%
associate-+l+100.0%
associate-*r/100.0%
metadata-eval100.0%
associate-*r/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
Simplified100.0%
if 4.50000000000000012e-125 < x < 0.045999999999999999Initial program 37.7%
Taylor expanded in x around 0 36.1%
Taylor expanded in n around inf 59.8%
if 0.045999999999999999 < x Initial program 68.0%
Taylor expanded in x around inf 97.7%
mul-1-neg97.7%
log-rec97.7%
mul-1-neg97.7%
distribute-neg-frac97.7%
mul-1-neg97.7%
remove-double-neg97.7%
*-commutative97.7%
Simplified97.7%
*-un-lft-identity97.7%
associate-/r*99.2%
div-inv99.2%
pow-to-exp99.2%
pow199.2%
pow-div99.1%
Applied egg-rr99.1%
*-lft-identity99.1%
sub-neg99.1%
metadata-eval99.1%
Simplified99.1%
Final simplification81.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ -1.0 (/ n (log x))))
(t_1 (/ (- 1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) (* x n))))
(if (<= x 6.1e-226)
t_0
(if (<= x 3.5e-215)
t_1
(if (<= x 2.3e-129)
t_0
(if (<= x 4.5e-125)
t_1
(if (<= x 0.85)
(/ (- x (log x)) n)
(/
(+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ (/ 0.3333333333333333 x) n)) x))
x))))))))
double code(double x, double n) {
double t_0 = -1.0 / (n / log(x));
double t_1 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n);
double tmp;
if (x <= 6.1e-226) {
tmp = t_0;
} else if (x <= 3.5e-215) {
tmp = t_1;
} else if (x <= 2.3e-129) {
tmp = t_0;
} else if (x <= 4.5e-125) {
tmp = t_1;
} else if (x <= 0.85) {
tmp = (x - log(x)) / n;
} else {
tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-1.0d0) / (n / log(x))
t_1 = (1.0d0 - ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / (x * n)
if (x <= 6.1d-226) then
tmp = t_0
else if (x <= 3.5d-215) then
tmp = t_1
else if (x <= 2.3d-129) then
tmp = t_0
else if (x <= 4.5d-125) then
tmp = t_1
else if (x <= 0.85d0) then
tmp = (x - log(x)) / n
else
tmp = ((1.0d0 / n) + ((((-0.5d0) / n) + ((0.3333333333333333d0 / x) / n)) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = -1.0 / (n / Math.log(x));
double t_1 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n);
double tmp;
if (x <= 6.1e-226) {
tmp = t_0;
} else if (x <= 3.5e-215) {
tmp = t_1;
} else if (x <= 2.3e-129) {
tmp = t_0;
} else if (x <= 4.5e-125) {
tmp = t_1;
} else if (x <= 0.85) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / x;
}
return tmp;
}
def code(x, n): t_0 = -1.0 / (n / math.log(x)) t_1 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n) tmp = 0 if x <= 6.1e-226: tmp = t_0 elif x <= 3.5e-215: tmp = t_1 elif x <= 2.3e-129: tmp = t_0 elif x <= 4.5e-125: tmp = t_1 elif x <= 0.85: tmp = (x - math.log(x)) / n else: tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / x return tmp
function code(x, n) t_0 = Float64(-1.0 / Float64(n / log(x))) t_1 = Float64(Float64(1.0 - Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / Float64(x * n)) tmp = 0.0 if (x <= 6.1e-226) tmp = t_0; elseif (x <= 3.5e-215) tmp = t_1; elseif (x <= 2.3e-129) tmp = t_0; elseif (x <= 4.5e-125) tmp = t_1; elseif (x <= 0.85) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(Float64(0.3333333333333333 / x) / n)) / x)) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = -1.0 / (n / log(x)); t_1 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n); tmp = 0.0; if (x <= 6.1e-226) tmp = t_0; elseif (x <= 3.5e-215) tmp = t_1; elseif (x <= 2.3e-129) tmp = t_0; elseif (x <= 4.5e-125) tmp = t_1; elseif (x <= 0.85) tmp = (x - log(x)) / n; else tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(-1.0 / N[(n / N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 6.1e-226], t$95$0, If[LessEqual[x, 3.5e-215], t$95$1, If[LessEqual[x, 2.3e-129], t$95$0, If[LessEqual[x, 4.5e-125], t$95$1, If[LessEqual[x, 0.85], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(N[(0.3333333333333333 / x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-1}{\frac{n}{\log x}}\\
t_1 := \frac{1 - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x \cdot n}\\
\mathbf{if}\;x \leq 6.1 \cdot 10^{-226}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-215}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-129}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-125}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 0.85:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{\frac{0.3333333333333333}{x}}{n}}{x}}{x}\\
\end{array}
\end{array}
if x < 6.0999999999999998e-226 or 3.5000000000000002e-215 < x < 2.3e-129Initial program 35.8%
Taylor expanded in x around 0 35.8%
add-cbrt-cube35.8%
pow335.9%
Applied egg-rr35.9%
Taylor expanded in n around inf 32.6%
mul-1-neg66.7%
distribute-neg-frac266.7%
Simplified32.6%
rem-cbrt-cube66.7%
clear-num66.8%
frac-2neg66.8%
metadata-eval66.8%
add-sqr-sqrt33.1%
sqrt-unprod22.1%
sqr-neg22.1%
sqrt-unprod1.5%
add-sqr-sqrt2.8%
distribute-frac-neg2.8%
add-sqr-sqrt1.3%
sqrt-unprod18.2%
sqr-neg18.2%
sqrt-unprod33.4%
add-sqr-sqrt66.8%
Applied egg-rr66.8%
if 6.0999999999999998e-226 < x < 3.5000000000000002e-215 or 2.3e-129 < x < 4.50000000000000012e-125Initial program 83.9%
Taylor expanded in n around inf 35.8%
Simplified35.8%
Taylor expanded in x around inf 25.0%
Taylor expanded in n around inf 91.9%
sub-neg91.9%
+-commutative91.9%
associate-+l+91.9%
associate-*r/91.9%
metadata-eval91.9%
associate-*r/91.9%
metadata-eval91.9%
distribute-neg-frac91.9%
metadata-eval91.9%
*-commutative91.9%
Simplified91.9%
Taylor expanded in x around -inf 91.9%
mul-1-neg91.9%
unsub-neg91.9%
sub-neg91.9%
associate-*r/91.9%
metadata-eval91.9%
distribute-neg-frac91.9%
metadata-eval91.9%
Simplified91.9%
if 4.50000000000000012e-125 < x < 0.849999999999999978Initial program 37.7%
Taylor expanded in x around 0 36.1%
Taylor expanded in n around inf 59.8%
if 0.849999999999999978 < x Initial program 68.0%
Taylor expanded in n around inf 66.5%
Simplified67.3%
Taylor expanded in x around inf 65.0%
Taylor expanded in n around inf 63.1%
sub-neg63.1%
+-commutative63.1%
associate-+l+63.1%
associate-*r/63.1%
metadata-eval63.1%
associate-*r/63.1%
metadata-eval63.1%
distribute-neg-frac63.1%
metadata-eval63.1%
*-commutative63.1%
Simplified63.1%
Taylor expanded in x around inf 64.3%
Simplified64.3%
Final simplification65.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- 1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) (* x n))))
(if (<= x 5.5e-226)
(* (log x) (/ -1.0 n))
(if (<= x 3.5e-215)
t_0
(if (<= x 2.05e-129)
(/ -1.0 (/ n (log x)))
(if (<= x 4.5e-125)
t_0
(if (<= x 0.85)
(/ (- x (log x)) n)
(/
(+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ (/ 0.3333333333333333 x) n)) x))
x))))))))
double code(double x, double n) {
double t_0 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n);
double tmp;
if (x <= 5.5e-226) {
tmp = log(x) * (-1.0 / n);
} else if (x <= 3.5e-215) {
tmp = t_0;
} else if (x <= 2.05e-129) {
tmp = -1.0 / (n / log(x));
} else if (x <= 4.5e-125) {
tmp = t_0;
} else if (x <= 0.85) {
tmp = (x - log(x)) / n;
} else {
tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / 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 - ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / (x * n)
if (x <= 5.5d-226) then
tmp = log(x) * ((-1.0d0) / n)
else if (x <= 3.5d-215) then
tmp = t_0
else if (x <= 2.05d-129) then
tmp = (-1.0d0) / (n / log(x))
else if (x <= 4.5d-125) then
tmp = t_0
else if (x <= 0.85d0) then
tmp = (x - log(x)) / n
else
tmp = ((1.0d0 / n) + ((((-0.5d0) / n) + ((0.3333333333333333d0 / x) / n)) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n);
double tmp;
if (x <= 5.5e-226) {
tmp = Math.log(x) * (-1.0 / n);
} else if (x <= 3.5e-215) {
tmp = t_0;
} else if (x <= 2.05e-129) {
tmp = -1.0 / (n / Math.log(x));
} else if (x <= 4.5e-125) {
tmp = t_0;
} else if (x <= 0.85) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / x;
}
return tmp;
}
def code(x, n): t_0 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n) tmp = 0 if x <= 5.5e-226: tmp = math.log(x) * (-1.0 / n) elif x <= 3.5e-215: tmp = t_0 elif x <= 2.05e-129: tmp = -1.0 / (n / math.log(x)) elif x <= 4.5e-125: tmp = t_0 elif x <= 0.85: tmp = (x - math.log(x)) / n else: tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / x return tmp
function code(x, n) t_0 = Float64(Float64(1.0 - Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / Float64(x * n)) tmp = 0.0 if (x <= 5.5e-226) tmp = Float64(log(x) * Float64(-1.0 / n)); elseif (x <= 3.5e-215) tmp = t_0; elseif (x <= 2.05e-129) tmp = Float64(-1.0 / Float64(n / log(x))); elseif (x <= 4.5e-125) tmp = t_0; elseif (x <= 0.85) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(Float64(0.3333333333333333 / x) / n)) / x)) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n); tmp = 0.0; if (x <= 5.5e-226) tmp = log(x) * (-1.0 / n); elseif (x <= 3.5e-215) tmp = t_0; elseif (x <= 2.05e-129) tmp = -1.0 / (n / log(x)); elseif (x <= 4.5e-125) tmp = t_0; elseif (x <= 0.85) tmp = (x - log(x)) / n; else tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 5.5e-226], N[(N[Log[x], $MachinePrecision] * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e-215], t$95$0, If[LessEqual[x, 2.05e-129], N[(-1.0 / N[(n / N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.5e-125], t$95$0, If[LessEqual[x, 0.85], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(N[(0.3333333333333333 / x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1 - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x \cdot n}\\
\mathbf{if}\;x \leq 5.5 \cdot 10^{-226}:\\
\;\;\;\;\log x \cdot \frac{-1}{n}\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-215}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{-129}:\\
\;\;\;\;\frac{-1}{\frac{n}{\log x}}\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-125}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 0.85:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{\frac{0.3333333333333333}{x}}{n}}{x}}{x}\\
\end{array}
\end{array}
if x < 5.5e-226Initial program 42.4%
Taylor expanded in x around 0 42.4%
add-cbrt-cube42.4%
pow342.5%
Applied egg-rr42.5%
Taylor expanded in n around inf 43.7%
mul-1-neg57.9%
distribute-neg-frac257.9%
Simplified43.7%
rem-cbrt-cube57.9%
frac-2neg57.9%
div-inv58.0%
remove-double-neg58.0%
Applied egg-rr58.0%
if 5.5e-226 < x < 3.5000000000000002e-215 or 2.05e-129 < x < 4.50000000000000012e-125Initial program 83.9%
Taylor expanded in n around inf 35.8%
Simplified35.8%
Taylor expanded in x around inf 25.0%
Taylor expanded in n around inf 91.9%
sub-neg91.9%
+-commutative91.9%
associate-+l+91.9%
associate-*r/91.9%
metadata-eval91.9%
associate-*r/91.9%
metadata-eval91.9%
distribute-neg-frac91.9%
metadata-eval91.9%
*-commutative91.9%
Simplified91.9%
Taylor expanded in x around -inf 91.9%
mul-1-neg91.9%
unsub-neg91.9%
sub-neg91.9%
associate-*r/91.9%
metadata-eval91.9%
distribute-neg-frac91.9%
metadata-eval91.9%
Simplified91.9%
if 3.5000000000000002e-215 < x < 2.05e-129Initial program 27.1%
Taylor expanded in x around 0 27.1%
add-cbrt-cube27.1%
pow327.1%
Applied egg-rr27.1%
Taylor expanded in n around inf 18.0%
mul-1-neg78.4%
distribute-neg-frac278.4%
Simplified18.0%
rem-cbrt-cube78.4%
clear-num78.5%
frac-2neg78.5%
metadata-eval78.5%
add-sqr-sqrt38.8%
sqrt-unprod14.1%
sqr-neg14.1%
sqrt-unprod1.9%
add-sqr-sqrt3.5%
distribute-frac-neg3.5%
add-sqr-sqrt1.6%
sqrt-unprod17.7%
sqr-neg17.7%
sqrt-unprod39.2%
add-sqr-sqrt78.5%
Applied egg-rr78.5%
if 4.50000000000000012e-125 < x < 0.849999999999999978Initial program 37.7%
Taylor expanded in x around 0 36.1%
Taylor expanded in n around inf 59.8%
if 0.849999999999999978 < x Initial program 68.0%
Taylor expanded in n around inf 66.5%
Simplified67.3%
Taylor expanded in x around inf 65.0%
Taylor expanded in n around inf 63.1%
sub-neg63.1%
+-commutative63.1%
associate-+l+63.1%
associate-*r/63.1%
metadata-eval63.1%
associate-*r/63.1%
metadata-eval63.1%
distribute-neg-frac63.1%
metadata-eval63.1%
*-commutative63.1%
Simplified63.1%
Taylor expanded in x around inf 64.3%
Simplified64.3%
Final simplification65.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) (- n)))
(t_1 (/ (- 1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) (* x n))))
(if (<= x 5.5e-226)
t_0
(if (<= x 3.5e-215)
t_1
(if (<= x 2.3e-129)
t_0
(if (<= x 4.8e-125)
t_1
(if (<= x 0.6)
t_0
(/
(+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ (/ 0.3333333333333333 x) n)) x))
x))))))))
double code(double x, double n) {
double t_0 = log(x) / -n;
double t_1 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n);
double tmp;
if (x <= 5.5e-226) {
tmp = t_0;
} else if (x <= 3.5e-215) {
tmp = t_1;
} else if (x <= 2.3e-129) {
tmp = t_0;
} else if (x <= 4.8e-125) {
tmp = t_1;
} else if (x <= 0.6) {
tmp = t_0;
} else {
tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = log(x) / -n
t_1 = (1.0d0 - ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / (x * n)
if (x <= 5.5d-226) then
tmp = t_0
else if (x <= 3.5d-215) then
tmp = t_1
else if (x <= 2.3d-129) then
tmp = t_0
else if (x <= 4.8d-125) then
tmp = t_1
else if (x <= 0.6d0) then
tmp = t_0
else
tmp = ((1.0d0 / n) + ((((-0.5d0) / n) + ((0.3333333333333333d0 / x) / n)) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(x) / -n;
double t_1 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n);
double tmp;
if (x <= 5.5e-226) {
tmp = t_0;
} else if (x <= 3.5e-215) {
tmp = t_1;
} else if (x <= 2.3e-129) {
tmp = t_0;
} else if (x <= 4.8e-125) {
tmp = t_1;
} else if (x <= 0.6) {
tmp = t_0;
} else {
tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / x;
}
return tmp;
}
def code(x, n): t_0 = math.log(x) / -n t_1 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n) tmp = 0 if x <= 5.5e-226: tmp = t_0 elif x <= 3.5e-215: tmp = t_1 elif x <= 2.3e-129: tmp = t_0 elif x <= 4.8e-125: tmp = t_1 elif x <= 0.6: tmp = t_0 else: tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / x return tmp
function code(x, n) t_0 = Float64(log(x) / Float64(-n)) t_1 = Float64(Float64(1.0 - Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / Float64(x * n)) tmp = 0.0 if (x <= 5.5e-226) tmp = t_0; elseif (x <= 3.5e-215) tmp = t_1; elseif (x <= 2.3e-129) tmp = t_0; elseif (x <= 4.8e-125) tmp = t_1; elseif (x <= 0.6) tmp = t_0; else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(Float64(0.3333333333333333 / x) / n)) / x)) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = log(x) / -n; t_1 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n); tmp = 0.0; if (x <= 5.5e-226) tmp = t_0; elseif (x <= 3.5e-215) tmp = t_1; elseif (x <= 2.3e-129) tmp = t_0; elseif (x <= 4.8e-125) tmp = t_1; elseif (x <= 0.6) tmp = t_0; else tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 5.5e-226], t$95$0, If[LessEqual[x, 3.5e-215], t$95$1, If[LessEqual[x, 2.3e-129], t$95$0, If[LessEqual[x, 4.8e-125], t$95$1, If[LessEqual[x, 0.6], t$95$0, N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(N[(0.3333333333333333 / x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
t_1 := \frac{1 - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x \cdot n}\\
\mathbf{if}\;x \leq 5.5 \cdot 10^{-226}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-215}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-129}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-125}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 0.6:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{\frac{0.3333333333333333}{x}}{n}}{x}}{x}\\
\end{array}
\end{array}
if x < 5.5e-226 or 3.5000000000000002e-215 < x < 2.3e-129 or 4.8000000000000003e-125 < x < 0.599999999999999978Initial program 36.6%
Taylor expanded in x around 0 35.8%
Taylor expanded in n around inf 63.7%
mul-1-neg63.7%
distribute-neg-frac263.7%
Simplified63.7%
if 5.5e-226 < x < 3.5000000000000002e-215 or 2.3e-129 < x < 4.8000000000000003e-125Initial program 83.9%
Taylor expanded in n around inf 35.8%
Simplified35.8%
Taylor expanded in x around inf 25.0%
Taylor expanded in n around inf 91.9%
sub-neg91.9%
+-commutative91.9%
associate-+l+91.9%
associate-*r/91.9%
metadata-eval91.9%
associate-*r/91.9%
metadata-eval91.9%
distribute-neg-frac91.9%
metadata-eval91.9%
*-commutative91.9%
Simplified91.9%
Taylor expanded in x around -inf 91.9%
mul-1-neg91.9%
unsub-neg91.9%
sub-neg91.9%
associate-*r/91.9%
metadata-eval91.9%
distribute-neg-frac91.9%
metadata-eval91.9%
Simplified91.9%
if 0.599999999999999978 < x Initial program 68.0%
Taylor expanded in n around inf 66.5%
Simplified67.3%
Taylor expanded in x around inf 65.0%
Taylor expanded in n around inf 63.1%
sub-neg63.1%
+-commutative63.1%
associate-+l+63.1%
associate-*r/63.1%
metadata-eval63.1%
associate-*r/63.1%
metadata-eval63.1%
distribute-neg-frac63.1%
metadata-eval63.1%
*-commutative63.1%
Simplified63.1%
Taylor expanded in x around inf 64.3%
Simplified64.3%
Final simplification65.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ -1.0 (/ n (log x))))
(t_1 (/ (- 1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) (* x n))))
(if (<= x 6.1e-226)
t_0
(if (<= x 3.5e-215)
t_1
(if (<= x 2.3e-129)
t_0
(if (<= x 1.35e-124)
t_1
(if (<= x 0.6)
(/ (log x) (- n))
(/
(+ (/ 1.0 n) (/ (+ (/ -0.5 n) (/ (/ 0.3333333333333333 x) n)) x))
x))))))))
double code(double x, double n) {
double t_0 = -1.0 / (n / log(x));
double t_1 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n);
double tmp;
if (x <= 6.1e-226) {
tmp = t_0;
} else if (x <= 3.5e-215) {
tmp = t_1;
} else if (x <= 2.3e-129) {
tmp = t_0;
} else if (x <= 1.35e-124) {
tmp = t_1;
} else if (x <= 0.6) {
tmp = log(x) / -n;
} else {
tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-1.0d0) / (n / log(x))
t_1 = (1.0d0 - ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / (x * n)
if (x <= 6.1d-226) then
tmp = t_0
else if (x <= 3.5d-215) then
tmp = t_1
else if (x <= 2.3d-129) then
tmp = t_0
else if (x <= 1.35d-124) then
tmp = t_1
else if (x <= 0.6d0) then
tmp = log(x) / -n
else
tmp = ((1.0d0 / n) + ((((-0.5d0) / n) + ((0.3333333333333333d0 / x) / n)) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = -1.0 / (n / Math.log(x));
double t_1 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n);
double tmp;
if (x <= 6.1e-226) {
tmp = t_0;
} else if (x <= 3.5e-215) {
tmp = t_1;
} else if (x <= 2.3e-129) {
tmp = t_0;
} else if (x <= 1.35e-124) {
tmp = t_1;
} else if (x <= 0.6) {
tmp = Math.log(x) / -n;
} else {
tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / x;
}
return tmp;
}
def code(x, n): t_0 = -1.0 / (n / math.log(x)) t_1 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n) tmp = 0 if x <= 6.1e-226: tmp = t_0 elif x <= 3.5e-215: tmp = t_1 elif x <= 2.3e-129: tmp = t_0 elif x <= 1.35e-124: tmp = t_1 elif x <= 0.6: tmp = math.log(x) / -n else: tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / x return tmp
function code(x, n) t_0 = Float64(-1.0 / Float64(n / log(x))) t_1 = Float64(Float64(1.0 - Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / Float64(x * n)) tmp = 0.0 if (x <= 6.1e-226) tmp = t_0; elseif (x <= 3.5e-215) tmp = t_1; elseif (x <= 2.3e-129) tmp = t_0; elseif (x <= 1.35e-124) tmp = t_1; elseif (x <= 0.6) tmp = Float64(log(x) / Float64(-n)); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(-0.5 / n) + Float64(Float64(0.3333333333333333 / x) / n)) / x)) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = -1.0 / (n / log(x)); t_1 = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n); tmp = 0.0; if (x <= 6.1e-226) tmp = t_0; elseif (x <= 3.5e-215) tmp = t_1; elseif (x <= 2.3e-129) tmp = t_0; elseif (x <= 1.35e-124) tmp = t_1; elseif (x <= 0.6) tmp = log(x) / -n; else tmp = ((1.0 / n) + (((-0.5 / n) + ((0.3333333333333333 / x) / n)) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(-1.0 / N[(n / N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 6.1e-226], t$95$0, If[LessEqual[x, 3.5e-215], t$95$1, If[LessEqual[x, 2.3e-129], t$95$0, If[LessEqual[x, 1.35e-124], t$95$1, If[LessEqual[x, 0.6], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(-0.5 / n), $MachinePrecision] + N[(N[(0.3333333333333333 / x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-1}{\frac{n}{\log x}}\\
t_1 := \frac{1 - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x \cdot n}\\
\mathbf{if}\;x \leq 6.1 \cdot 10^{-226}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-215}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-129}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-124}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 0.6:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{\frac{0.3333333333333333}{x}}{n}}{x}}{x}\\
\end{array}
\end{array}
if x < 6.0999999999999998e-226 or 3.5000000000000002e-215 < x < 2.3e-129Initial program 35.8%
Taylor expanded in x around 0 35.8%
add-cbrt-cube35.8%
pow335.9%
Applied egg-rr35.9%
Taylor expanded in n around inf 32.6%
mul-1-neg66.7%
distribute-neg-frac266.7%
Simplified32.6%
rem-cbrt-cube66.7%
clear-num66.8%
frac-2neg66.8%
metadata-eval66.8%
add-sqr-sqrt33.1%
sqrt-unprod22.1%
sqr-neg22.1%
sqrt-unprod1.5%
add-sqr-sqrt2.8%
distribute-frac-neg2.8%
add-sqr-sqrt1.3%
sqrt-unprod18.2%
sqr-neg18.2%
sqrt-unprod33.4%
add-sqr-sqrt66.8%
Applied egg-rr66.8%
if 6.0999999999999998e-226 < x < 3.5000000000000002e-215 or 2.3e-129 < x < 1.35000000000000009e-124Initial program 83.9%
Taylor expanded in n around inf 35.8%
Simplified35.8%
Taylor expanded in x around inf 25.0%
Taylor expanded in n around inf 91.9%
sub-neg91.9%
+-commutative91.9%
associate-+l+91.9%
associate-*r/91.9%
metadata-eval91.9%
associate-*r/91.9%
metadata-eval91.9%
distribute-neg-frac91.9%
metadata-eval91.9%
*-commutative91.9%
Simplified91.9%
Taylor expanded in x around -inf 91.9%
mul-1-neg91.9%
unsub-neg91.9%
sub-neg91.9%
associate-*r/91.9%
metadata-eval91.9%
distribute-neg-frac91.9%
metadata-eval91.9%
Simplified91.9%
if 1.35000000000000009e-124 < x < 0.599999999999999978Initial program 37.7%
Taylor expanded in x around 0 35.8%
Taylor expanded in n around inf 59.6%
mul-1-neg59.6%
distribute-neg-frac259.6%
Simplified59.6%
if 0.599999999999999978 < x Initial program 68.0%
Taylor expanded in n around inf 66.5%
Simplified67.3%
Taylor expanded in x around inf 65.0%
Taylor expanded in n around inf 63.1%
sub-neg63.1%
+-commutative63.1%
associate-+l+63.1%
associate-*r/63.1%
metadata-eval63.1%
associate-*r/63.1%
metadata-eval63.1%
distribute-neg-frac63.1%
metadata-eval63.1%
*-commutative63.1%
Simplified63.1%
Taylor expanded in x around inf 64.3%
Simplified64.3%
Final simplification65.3%
(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(Float64(0.3333333333333333 / 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[(N[(0.3333333333333333 / x), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n} + \frac{\frac{-0.5}{n} + \frac{\frac{0.3333333333333333}{x}}{n}}{x}}{x}
\end{array}
Initial program 53.6%
Taylor expanded in n around inf 70.1%
Simplified70.5%
Taylor expanded in x around inf 37.5%
Taylor expanded in n around inf 44.9%
sub-neg44.9%
+-commutative44.9%
associate-+l+44.9%
associate-*r/44.9%
metadata-eval44.9%
associate-*r/44.9%
metadata-eval44.9%
distribute-neg-frac44.9%
metadata-eval44.9%
*-commutative44.9%
Simplified44.9%
Taylor expanded in x around inf 37.6%
Simplified45.5%
Final simplification45.5%
(FPCore (x n) :precision binary64 (/ (- 1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) (* x n)))
double code(double x, double n) {
return (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n);
}
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)) / (x * n)
end function
public static double code(double x, double n) {
return (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n);
}
def code(x, n): return (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n)
function code(x, n) return Float64(Float64(1.0 - Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / Float64(x * n)) end
function tmp = code(x, n) tmp = (1.0 - ((0.5 + (-0.3333333333333333 / x)) / x)) / (x * n); end
code[x_, n_] := N[(N[(1.0 - N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 - \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{x \cdot n}
\end{array}
Initial program 53.6%
Taylor expanded in n around inf 70.1%
Simplified70.5%
Taylor expanded in x around inf 37.5%
Taylor expanded in n around inf 44.9%
sub-neg44.9%
+-commutative44.9%
associate-+l+44.9%
associate-*r/44.9%
metadata-eval44.9%
associate-*r/44.9%
metadata-eval44.9%
distribute-neg-frac44.9%
metadata-eval44.9%
*-commutative44.9%
Simplified44.9%
Taylor expanded in x around -inf 44.9%
mul-1-neg44.9%
unsub-neg44.9%
sub-neg44.9%
associate-*r/44.9%
metadata-eval44.9%
distribute-neg-frac44.9%
metadata-eval44.9%
Simplified44.9%
Final simplification44.9%
(FPCore (x n) :precision binary64 (/ 1.0 (* x n)))
double code(double x, double n) {
return 1.0 / (x * n);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 1.0d0 / (x * n)
end function
public static double code(double x, double n) {
return 1.0 / (x * n);
}
def code(x, n): return 1.0 / (x * n)
function code(x, n) return Float64(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 53.6%
Taylor expanded in x around inf 60.0%
mul-1-neg60.0%
log-rec60.0%
mul-1-neg60.0%
distribute-neg-frac60.0%
mul-1-neg60.0%
remove-double-neg60.0%
*-commutative60.0%
Simplified60.0%
Taylor expanded in n around inf 39.4%
Final simplification39.4%
(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 53.6%
Taylor expanded in x around inf 60.0%
mul-1-neg60.0%
log-rec60.0%
mul-1-neg60.0%
distribute-neg-frac60.0%
mul-1-neg60.0%
remove-double-neg60.0%
*-commutative60.0%
Simplified60.0%
Taylor expanded in n around inf 39.4%
associate-/r*40.0%
Simplified40.0%
Final simplification40.0%
(FPCore (x n) :precision binary64 (/ x n))
double code(double x, double n) {
return x / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = x / n
end function
public static double code(double x, double n) {
return x / n;
}
def code(x, n): return x / n
function code(x, n) return Float64(x / n) end
function tmp = code(x, n) tmp = x / n; end
code[x_, n_] := N[(x / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{n}
\end{array}
Initial program 53.6%
Taylor expanded in x around 0 28.5%
Taylor expanded in x around inf 4.2%
Final simplification4.2%
herbie shell --seed 2024095
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))