Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7802703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:20:03+00:00 2026-06-02T01:20:03+00:00

MSDN says: Without the suffix m, the number is treated as a double, thus

  • 0

MSDN says:

“Without the suffix m, the number is treated as a double, thus generating a compiler error.”

What does the “M” in:

decimal current = 10.99M;

stand for?

Is it any different than:

decimal current = (decimal)10.99
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T01:20:05+00:00Added an answer on June 2, 2026 at 1:20 am

    M makes the number a decimal representation in code.

    To answer the second part of your question, yes they are different.

    decimal current = (decimal)10.99
    

    is the same as

    double tmp = 10.99;
    decimal current = (decimal)tmp;
    

    Now for numbers larger than sigma it should not be a problem but if you meant decimal you should specify decimal.


    Update:

    Wow, i was wrong. I went to go check the IL to prove my point and the compiler optimized it away.


    Update 2:

    I was right after all!, you still need to be careful. Compare the output of these two functions.

    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(Test1());
            Console.WriteLine(Test2());
            Console.ReadLine();
        }
    
        static decimal Test1()
        {
            return 10.999999999999999999999M;
        }
        static decimal Test2()
        {
            return (decimal)10.999999999999999999999;
        }
    }
    

    The first returns 10.999999999999999999999 but the seccond returns 11


    Just as a side note, double will get you 15 decimal digits of precision but decimal will get you 96 bits of precision with a scaling factor from 0 to 28. So you can represent any number in the range ((-296 to 296) / 10(0 to 28))

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

MSDN says : The default implementation of the GetHashCode method does not guarantee unique
MSDN says about precision and scale of decimal multiplicatuion result : The result precision
MSDN says If you provide no path, the DLL must be in the current
Class Random can be instantiated using a constructor without parameters and MSDN says that
MSDN says that public static members of System.Windows.Application are thread safe. But when I
The MSDN says that using ReadDirectoryChangesW implies the calling process having the Backup and
Could anyone point exactly where MSDN says thet every user stored procedure returns 0
I've made a simple test with a MemoryMappedFile as msdn says : 2 processes,
XmlAttributeOverrides is a good way to override some attributes for serialization. MSDN says: You
What is the significance of the Thread.Join method in C#? MSDN says that it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.