Well 12
and 12.00
have exactly the same representation as double
values. Are you trying to end up with a double
or something else? (For example, you could cast to int
, if you were convinced the value would be in the right range, and if the truncation effect is what you want.)
You might want to look at these methods too:
Math.Floor
Math.Ceiling
Math.Round
(with variations for how to handle midpoints)Math.Truncate