tags:

views:

1485

answers:

6

What is the double type(C++) in C#?

double experience;

At first,I thought its UInt32,but its not. How to declare it in C#?

+2  A: 

Double in C# is Double.

double var1 = 0.123;

Jon
+1  A: 

C# has the double type as well.

double experience;

should compile and work just fine in C#.

Jonathan
+3  A: 

It is just double or Double. More specific double is a C# specific alias for System.Double.

Daniel Brückner
+2  A: 

Not sure what the question is. A double in C# is the same as a double in C++. double is not an integral number in any mainstream language that I'm aware of.

Adam Robinson
+2  A: 

I don't remember much about C++, but there is a double type in C#.

If you just want larger whole numbers, though, look at long.

Matt Grande
+14  A: 

This is a question that is dependent upon the particular C++ compiler implementation you are using. The double type can be either 4 or 8 bytes according to the C++ standard. Most compilers do use 8 bytes though. Here are the closest representations

  • 4 bytes: float
  • 8 bytes: double

Reference: http://msdn.microsoft.com/en-us/library/cc953fe1.aspx

JaredPar
and 16 bytes: decimalAlso of note, float and double are IEEE, decimal is not.
Richard Szalay
decimal floating point is IEEE nowadays. Thank IBM; they've managed to standardize their mainframe stuff.
MSalters
THe C++ standard does not specify 4 or 8 bytes at all. It sets some requirements on minimum ranges and precision. But 7 bytes with 9 bits each would be OK.
MSalters