Precision of double after decimal point

As stated by the C# reference, the precision is from 15 to 16 digits (depending on the decimal values represented) before or after the decimal point.

In short, you are right, it depends on the values before and after the decimal point.

For example:

  • 12345678.1234567D //Next digit to the right will get rounded up
  • 1234567.12345678D //Next digit to the right will get rounded up

Full sample at: http://ideone.com/eXvz3

Also, trying to think about double value as fixed decimal values is not a good idea.


You're both wrong. A normal double has 53 bits of precision. That's roughly equivalent to 16 decimal digits, but thinking of double values as though they were decimals leads to no end of confusion, and is best avoided.

That said, you are much closer to correct than your colleague--the precision is relative to the value being represented; sufficiently large doubles have no fractional digits of precision.

For example, the next double larger than 4503599627370496.0 is 4503599627370497.0.