Precision of double after decimal point

c#, double, ieee-754

Solution

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.

Problem

In the lunch break we started debating about the precision of the `double` value type. My colleague thinks, it always has 15 places after the decimal point. In my opinion one can't tell, because IEEE 754 does not make assumptions about this and it depends on where the first `1` is in the binary representation. (i.e. the size of the number before the decimal point counts, too) How can one make a more qualified statement?

Original source