What does M mean just after a number?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tundra999@yahoo.com

    What does M mean just after a number?

    Such as this:

    return base.CalculateP rice() * 0.9M;

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

    Thanks,
    Tom

  • Tom Shelton

    #2
    Re: What does M mean just after a number?

    On Mar 30, 10:35 pm, tundra...@yahoo .com wrote:
    Such as this:
    >
    return base.CalculateP rice() * 0.9M;
    >
    What data type does the 'M' stand for? I can't find a listing of these
    shorthand notations anywhere.
    >
    Thanks,
    Tom
    decimal.

    --
    Tom Shelton

    Comment

    • rossum

      #3
      Re: What does M mean just after a number?

      On 30 Mar 2007 21:35:36 -0700, tundra999@yahoo .com wrote:
      >Such as this:
      >
      >return base.CalculateP rice() * 0.9M;
      >
      >What data type does the 'M' stand for? I can't find a listing of these
      >shorthand notations anywhere.
      >
      >Thanks,
      >Tom
      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

      Comment

      • tundra999@yahoo.com

        #4
        Re: What does M mean just after a number?

        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


        Comment

        • Peter Duniho

          #5
          Re: What does M mean just after a number?

          On Sat, 31 Mar 2007 10:58:48 -0700, <tundra999@yaho o.comwrote:
          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?
          From the post you just replied to:

          On Sat, 31 Mar 2007 01:59:16 -0700, rossum <rossum48@coldm ail.comwrote:
          [...]
          Real type suffixes are: F, D, M, f, d, m where F/f = float, D/d =
          double. M/m = Decimal
          I think that pretty much sums it up.

          Comment

          • rossum

            #6
            Re: What does M mean just after a number?

            On 31 Mar 2007 10:58:48 -0700, tundra999@yahoo .com wrote:
            >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
            >
            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

            Comment

            • MBR

              #7
              Re: What does M mean just after a number?

              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.)



              m

              <tundra999@yaho o.comwrote in message
              news:1175363928 .937217.216520@ y80g2000hsf.goo glegroups.com.. .
              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
              >
              >


              --
              Posted via a free Usenet account from http://www.teranews.com

              Comment

              • Jon Skeet [C# MVP]

                #8
                Re: What does M mean just after a number?

                MBR <notme@nospam.c omwrote:
                To be more clear, M = Money, which is typcically what the type is used for
                <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.co m>
                http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
                If replying to the group, please do not mail me too

                Comment

                Working...