.NET Framework - What does M mean just after a number?

Asked By tundra99 on 30-Mar-07 11:35 PM
Such as this:

return base.CalculatePrice() * 0.9M;

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

Thanks,
Tom




Tom Shelton replied on 31-Mar-07 12:03 AM
decimal.

--
Tom Shelton
rossum replied on 31-Mar-07 03:59 AM
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
tundra99 replied on 31-Mar-07 12:58 PM
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
Peter Duniho replied on 31-Mar-07 01:21 PM
From the post you just replied to:



I think that pretty much sums it up.
rossum replied on 01-Apr-07 04:45 AM
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
MBR replied on 01-Apr-07 12:38 PM
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
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




--
Posted via a free Usenet account from http://www.teranews.com
Jon Skeet [C# MVP] replied on 01-Apr-07 03:00 PM
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
If replying to the group, please do not mail me too
jeff hardy replied on 30-Jan-09 08:42 PM
1 M = 1.000.000

1 K = 1.000