decimal

The C# number type that stores base-10 digits exactly, with 28 to 29 significant digits, which makes it the right type for money.

In more detail

Write decimal literals with an m suffix, such as 19.90m. Decimal keeps the scale you give it, so 19.90m * 3 prints 59.70, and 0.1m + 0.2m equals 0.3m exactly.

Example

decimal price = 19.90m;

Related terms

Taught in

References