C# which is the best data type for precision 3


I want to store a number with the following 0.000 which is the best data type to use.

A double?

Also I guess an INT is just out of the question?

Best Solution

The decimal type is the best for fixed point math.

From the C# Spec Section 4.1.7:

Contrary to the float and double data types, decimal fractional numbers such as 0.1 can be represented exactly in the decimal representation. In the float and double representations, such numbers are often infinite fractions, making those representations more prone to round-off errors.