c# - Understanding the result of the decimal constructor with 5 arguments -


Can you tell me how this output is? I do not understand this reasoning behind the curtain ..: P

Here is my code:

  using the system; Public class main program {public static zero main (string [] args) {decimal d = new decimals (1234, 12121, 5454, false, 5); Console.WriteLine (d); }}  

Output:

  1006085422300711931.09714 Press any key to continue. . . It is using decimal which allows you to specify different parts of decimal value. From the linked document:  

Low - Less 32 bit of 96-bit integer.

Middle - Between 96-bit integer 32 bits

Hello - High 32 bit of 96-bit integer.

isNegative - correct to indicate a negative number;

scale - a power from 10 to 0 to 28.

Taking a few simple examples, you can see how the different values ​​affect the creation of a decimal value:

  console. WrightLine (new decimals (0, 0, 0, wrong, 0)); // 0 console.light line (new decimals (1, 0, 0, wrong, 0)); // 1 console.light line (new decimal (0, 1, 0, wrong, 0)); // 4294967296 console.light line (new decimals (0, 0, 1, wrong, 0)); // 18446744073709551616 console.light line (new decimals (1, 0, 0, wrong, 1)); //0.1 console. Light line (new decimals (1, 0, 0, true, 1)); //-0.1  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -