Consider the following code:
// Float
Console.WriteLine(123.0f); // 123
// Double
Console.WriteLine(123.0); // 123
// Decimal
Console.WriteLine(123.0m); // 123.0
Questions
- Why does
decimal
maintain a single digit precision, butfloat
anddouble
do not? - Is there a way to preserve this information for
float
anddouble
, even if when zero?