I need to round a float to the nearest .5, for example:
1.1 = 1
1.5 = 1.5
1.6 = 1.5
1.8 = 2
and so on. I really don't know how to do it. Any help would be greatly appreciated.
For positive numbers Multiply by 2, add 0.5, truncate, divide by 2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With