I want to round this with 2 decimal places value in c#. Here is my code.  IList&lt;CartModel&gt; CartItems = (from c in db.tblCart                                               where c.User_ID == UID                                               &amp;&amp; c.Is_Active == true                                               select new CartModel                                               {                                                   CartID = c.Cart_ID,                                                   UserID = (c.User_ID == null ? 0 : (int)c.User_ID),                                                   SellerID = (c.Seller_ID == null ? 0 : (int)c.Seller_ID),                                                   BuyerID = (c.Buyer_ID == null ? 0 : (int)c.Buyer_ID),                                                   Quantiy = (c.Quantity == null ? 0 : (int)c.Quantity),                                                   Price = (c.Price == null ? 0 :((float)((c.Price*ConversionRate) * c.Quantity))),                                                   Match = (c.Match == null ? 0 : (int)c.Match),                                                                                                 }).ToList();                 return CartItems;  Price = (c.Price == null ? 0 :((float)((c.Price*ConversionRate) * c.Quantity))) How to apply math.round function on this? Price datatype is float.
I want to do this using the Math.Round function
A contractive mapping on $M$ is a function $f$ from the metric space $(M,d)$ into itself satisfying $$d(f(x),f(y))&lt;d(x,y)$$ whenever $x,y\in M$ with $x\ne y$. Prove that if $f$ is a contractive mapping on a compact metric space $M$, there exists a unique point $x\in M$ with $f(x)=x$.   Consider the function $g(x)=d(f(x),x)$. Note that   \begin{align*}d(f(x),x)-d(f(y),y)&amp;\leq (d(x,y)+d(y,f(x))-(d(y,f(x)-d(f(x),f(y)) \\ &amp;=d(x,y)+d(f(x),f(y)) \\ &amp;&lt;2d(x,y)  \end{align*}  And similarly for $d(f(y),y)-d(f(x),x)$, so we have $|d(f(x),x)-d(f(y),y)|&lt;2d(x,y)$. This means $g(x)$ is continuous.  So $g(x)$ is a real-valued continuous function on a compact space, so must be bounded and has a minimum $c$, i.e. there exists $x_0$ such that $d(f(x_0),x_0)$ equals the minimum $c$. What then? Consider an inviscid Burgers equation:  $u_t + u u_x = 0.$  With the initial data:  $ u(x,0) = \left\{ \begin{array}{ll}              0  \quad  &amp; \text{if} \quad x &lt; 0, \\[0.5em]              1  &amp; \text{if} \quad x &gt; 0.\end{array} \right. $  Possible weak solutions to this problem include, for example:  $ u_1(x,t) = \left\{ \begin{array}{ll}              0  \quad  &amp; \text{if} \quad x &lt; t/2, \\[0.5em]              1  &amp; \text{if} \quad x &gt; t/2.\end{array} \right. \hspace{10mm} $   $ u_2(x,t) = \left\{ \begin{array}{lll}              0  \quad  &amp; \text{if} \quad x &lt; 0, \\[0.5em]                      x/t &amp; 0 &lt; x &lt; t,\\[0.5em]              1  &amp; \text{if} \quad x &gt; t.\end{array} \right. $  Every material that provides such examples states that it is easy to check that these are both solutions of our problem. I do not see how that is done.  I know how to obtain the equation:  $ \int_{0}^\infty \int_{-\infty}^\infty [ q \phi_t + f(q) \phi_x ] dx dt + \int_{-\infty}^\infty q(x,0) \phi(x,0) dx = 0,  $  But I do not see how to "test" if the weak solutions provided above satisfy this. I tried writing the solutions as Heavside functions and integrating them, but I am not sure how to handle an arbitrary test function.  I assume there are some solution I could construct that would not be the weak solution to our initial data, how to check that? Understanding the proof for $\gcd (F_n, F_{n+k}) = 1$ where $F_n$ is a Fermat number I'm trying to understand the following proof of why      No two Fermat numbers have a common divisor greater than $1$.   Hardy and Wright show the following proofs:   If $x = 2^{2^n}$, we have  $$\frac{F_{n+k} - 2}{F_n}(\circ) = \frac{2^{2^{n+k}}-1}{2^{2^n}+1} = \frac{x^{2^k}-1}{x+1} = x^{2^k-1} - x^{2^k-2} + \ldots -1$$  The main issue I'm having is the $\circ$ part. I don't understand how they get that. The rest of the proof makes sense but the first part is really confusing me. Can someone please explain where they get that fraction?  Thanks a bunch! How do I format a number to a dollar amount in PHP Prove that if $p \equiv 3 \pmod{4}$ then $x^2+y^2 \not \equiv 0 \pmod{p}$ Let $x$ and $y$ be integers not congruent to $0$ modulo $p$ where $p$ is a prime. Prove that if $p \equiv 3 \pmod{4}$ then $x^2+y^2 \not \equiv 0 \pmod{p}$.   I thought about proving this algebraically and by contradiction. So we say $x^2+y^2 = pz$ and have to show this is impossible. What's the point in adding a new line to the end of a file? Some compilers (especially C or C++ ones) give you warnings about:  No new line at end of file   I thought this would be a C-programmers-only problem, but github displays a message in the commit view:  \ No newline at end of file   for a PHP file.  I understand the preprocessor thing explained in , but what has this to do with PHP? Is it the same include() thing or is it related to the \r\n vs \n topic?   What is the point in having a new line at the end of a file? Compactness of $\operatorname{Spec}(A)$ In an exercise in Atiyah-Macdonald it asks to prove that the prime spectrum $\operatorname{Spec}(A)$ of a commutative ring $A$ as a topological space $X$ (with the Zariski Topology) is compact.   Now because the basic open sets $X_f = \{\mathfrak{p} \in \operatorname{Spec} (A) : \{f\} \not\subseteq \mathfrak{p} \}$ form a basis for the Zariski Topology it suffices to consider the case when   $$X = \bigcup_{i \in I} X_{f_i}$$   where $I$ is some index set. Then taking the complement on both sides we get that   $$\emptyset = \bigcap_{i \in I} X_{f_i}^c$$  so there is no prime ideal $\mathfrak{p}$ of $A$ such that all the $f_i$'s are in $\mathfrak{p}$. Now from here I am able to show that the ideal generated by the $f_i$'s is the whole ring as follows. Since there is no prime ideal $\mathfrak{p}$ such that all the $f_i \in \mathfrak{p}$, it is clear that there is no $\mathfrak{p}$ such that $(f_i) \subseteq \mathfrak{p}$ for all $i \in I.$ Taking a sum over all the $i$ then gives $$\sum_{i \in I} (f_i) = (1).$$  Now here's the problem:          How do I show from here that there is an equation of the form $1 = \sum_{i \in J} f_ig_i,$ where $g_i \in A$ and $J$ some finite subset of $I$?       This part has been giving me a headache. I am not sure if the finiteness bit has to do with algebra, topology or the fact that we are dealing with prime ideals.  This is not a homework problem but rather for self-study.  $\textbf{Edit:}$ I have posted my answer below after the discussion with Dylan and Pierre. I want to simplify the following:  $\sum_{n=0}^x 1 - (1 - I[a \ne 0] * I[a \ge b]) * (1 - I[b \ne 0] * I[b \ge c]) * (1 - I[c \ne 0] * I[c \ge d]) * (1 - I[d = 0])$ I'm really having a hard time with this topic in probability theory and I was wondering if someone has any tricks, tips or anything useful to help me understand it. In my notes I am told that $X\sim$Uniform$[0,1]$ and $Y\sim$Uniform$[0,1]$. My professor wrote:      $f_{X+Y}(Z) = \int_0^Z f_X(x) f_Y(Z-x)\;dx \neq Z$   Then somehow he came up with these cases where $Z$ is defined, and used that in making the pdf. I'm just not sure of how he did this or how he also came to find $P(X_1+X_2\le 2)$. Can someone help me fill in the blanks? I went to him directly but he just said the same thing as in lecture and wasn't helpful. Consider repeated measures ANOVA (RM-ANOVA) with one within-subject factor A and several measurements per subject for each level of A.  It is closely related to two-way ANOVA with two factors: A and subject. They use identical decomposition of the sum of squares into four parts: A, subject, A⋅subject, and residual. However, two-way ANOVA tests the effect of A by comparing SS of A with the residual SS, while RM-ANOVA tests the effect of A by comparing SS of A with the A$\cdot$subject interaction SS.   Why the difference?    Does this difference automatically follow from the repeated-measures structure of the data, or is it some convention?  Does this difference between two-way ANOVA and RM-ANOVA correspond to testing two different nulls? If so, what exactly are they and why would we use different nulls in these two cases? Two-way ANOVA's test can be understood as an F-test between two nested models: the full model, and the model without A. Can RM-ANOVA be understood in a similar way?   (If there is only one measurement per subject for each level of A, then the distinction sort of disappears because A$\cdot$subject and residual variation cannot be disentangled: )    Demonstration  I will use toy data d2 generated in . The same webpage shows correct syntax for RM-ANOVA.  # Discarding between-subject factors and leaving only one within-subject factor d = d2[d2$Xb1=='CG' &amp; d2$Xb2 == 'f', c(1,4,6)]   (See reproducible version .) Data look like that:       id Xw1     Y 1    s1   A  28.6 2    s1   A  96.6 3    s1   A  64.8 4    s1   B 107.5 5    s1   B  77.3 6    s1   B 120.9 7    s1   C 141.2 8    s1   C 124.1 9    s1   C  88.0 10   s2   A  86.7 ...   Here is two-way ANOVA: summary(aov(Y ~ Xw1*id, d))               Df Sum Sq Mean Sq F value   Pr(&gt;F)     Xw1           2  95274   47637  16.789 3.73e-07 *** id           19  31359    1650   0.582    0.913     Xw1:id       38  71151    1872   0.660    0.929     Residuals   120 340490    2837                    Here is RM-ANOVA: summary(aov(Y ~ Xw1 + Error(id/Xw1), d))  Error: id           Df Sum Sq Mean Sq F value Pr(&gt;F) Residuals 19  31359    1650                 Error: id:Xw1           Df Sum Sq Mean Sq F value   Pr(&gt;F)     Xw1        2  95274   47637   25.44 9.73e-08 *** Residuals 38  71151    1872                       Error: Within            Df Sum Sq Mean Sq F value Pr(&gt;F) Residuals 120 340490    2837               Note the identical SS decomposition, but two-way ANOVA tests Xw1 against the residual, while RM-ANOVA tests Xw1 against the Xw1:id interaction.  Why?  This question is related to . If we try using Error(id) instead of Error(id/Xw1) in the example above, then Xw1 will get tested against Xw1:id interaction lumped together with the residual variation.  (The same issue arises in factorial RM-ANOVA with multiple within-subject factors, where each factor or interaction is tested against its own "error term" aka "error stratum". These error strata are always given by the corresponding interaction with the block/plot/subject variable id.) How to reorder /etc/resolv.conf at load time I have a CentOS system that retrieves its upstream DNS servers via DHCP.  I want to run DNSMasq on this box and use it as a server to resolve some hostnames for development.  The problem is when my system starts, the upstream DNS servers are loaded into /etc/resolv.conf and THEN the DNS1 entry from my ifcfg-enp0s3 setup gets loaded.   That's a problem because when I query for the internal dev names, it tries to go out to the upstream DNS server instead of checking DNSMasq first.  I need the DNSMasq server to be at the TOP of the /etc/resolv.conf and the dhcp loaded ones at the bottom of the resolv.conf so that DNSMasq will work properly.  Any simple way to do that? How can I make a more realistic glass shader? Javascript and PHP functions Prove $x \equiv a \pmod{p}$ and $x \equiv a \pmod{q}$ then $x \equiv a\pmod{pq}$ All Stack Exchange data dumps Can I connect copper wire to aluminum wire? Proving a function is constant, under certain conditions? The problem:  Assume $f: \mathbb{R} \rightarrow \mathbb{R}$ satisfies $|f(t) - f(x)| \leq |t - x|^2$ for all $t, x$. Prove $f$ is constant.  I believe I have some intuition about why this is the case; i.e. if $t$ and $x$ are very close, ($|t - x| = \epsilon$), then $\sqrt{\epsilon}$ will converge to 0, so $|f(t) - f(x)|$ will also converge to zero if you keep taking $t$ and $x$ closer and closer to each other. However, how do I formalize this argument? Thanks. I've noticed this issue on a handful of other communities, but making the browser window narrow (mine is 1080x960) makes the .post-layout and #sidebar elements overlap. Maybe something to do with the grid CSS? The #mainbar element seems to be the correct width and changing the .post-layout's overflow-x to auto seems to "fix" it  From retrocomputing:    From this post, because we are meta after all:    Specs:   Google Chrome Version 78.0.3904.108 (Official Build) (64-bit) Ubuntu 18.04.3 LTS How do I know if food left at room temperature is still safe to eat? I am an Indian citizen studying in Italy on an Italian visa that expires 19 November, 2015. I have permesso di soggiorno. I want to visit the United Kingdom for my vacations for a week during March. I know the procedures already, however I am a little bit confused about the amount that I must show as a proof of support with my bank statements. I will stay for a week with my friends who are also students in Italy and will be in London for 5 days. What would be the amount in Euros that I need to show for my visit to UK?