all groups > c# > march 2007 >
You're in the

c#

group:

What does M mean just after a number?


What does M mean just after a number? tundra999 NO[at]SPAM yahoo.com
3/30/2007 9:35:36 PM
c#:
Such as this:

return base.CalculatePrice() * 0.9M;

What data type does the 'M' stand for? I can't find a listing of these
shorthand notations anywhere.

Thanks,
Tom
Re: What does M mean just after a number? Tom Shelton
3/30/2007 10:03:42 PM
[quoted text, click to view]

decimal.

--
Tom Shelton
Re: What does M mean just after a number? rossum
3/31/2007 12:00:00 AM
[quoted text, click to view]
They are called type suffixes.

Integer type suffixes are: U, L, UL, LU, u, l, ul, lu, Ul, uL, Lu, lU
where U/u = unsigned and L/l = long. Lowercase l is not recommended
unless you want to obfuscate your source code.

Real type suffixes are: F, D, M, f, d, m where F/f = float, D/d =
double. M/m = Decimal

rossum
Re: What does M mean just after a number? tundra999 NO[at]SPAM yahoo.com
3/31/2007 10:58:48 AM
Thanks I appreciate it. But if 'M' means Decimal, then what does 'D'
stand for? Are both 'D' and 'M' decimal? If so why have both? Is
there a difference?

Thanks,
Tom

Re: What does M mean just after a number? Peter Duniho
3/31/2007 11:21:31 AM
[quoted text, click to view]

From the post you just replied to:

On Sat, 31 Mar 2007 01:59:16 -0700, rossum <rossum48@coldmail.com> wrote=
:

[quoted text, click to view]

Re: What does M mean just after a number? rossum
4/1/2007 12:00:00 AM
[quoted text, click to view]
The L, U, F, and D suffixes are used in C, C++, Java and probably
elsewhere. When C# introduced the Decimal type the D suffix was
already in use for Double so they picked M instead.

rossum
Re: What does M mean just after a number? MBR
4/1/2007 9:38:01 AM
To be more clear, M = Money, which is typcically what the type is used for,
becuase it avoids the round-off errors you get when using floating-point
representations like float and double. If you want to have numbers that are
quick to compute and can be super tiny or astronomically large but don't
care if some error is introduced (typically applications like games,
simulations, etc.) then use a float/double. If your want #'s in a
"reasonable" ranage but care about more presision and less error, then use a
decimal/money. (SQL also supports a similar type and it should always be
used for monetary amounts.)

http://en.csharp-online.net/ECMA-334:_11.1.7_The_decimal_type

m

[quoted text, click to view]



--
Posted via a free Usenet account from http://www.teranews.com
Re: What does M mean just after a number? Jon Skeet [C# MVP]
4/1/2007 8:00:11 PM
[quoted text, click to view]

<snip>

I believe that while M=Money is a good way of remembering it, Peter
Golde recalls it being picked just as the next appropriate character
from "decimal". I suspect that there'll never be any proof either way.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
AddThis Social Bookmark Button