How can I get an integer NOT to round? i.e. 1.88 I want to be 1 and not round up to 2. Or should it be a double? If so, I do I now show the decimal places?
You guys are mostly right - assuming you are using positive numbers. Floor behaves differently for negative numbers. If you do Math.Floor(-1.88) you'll get 2 (weird, but true). To do that properly using the math functions, you need to check for < 0 and use Math.Ceiling. Casting as (int) works in both cases.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.