How do I round to the nearest 0.5?
eg. I have the number 0.6, how do I round it to 0.5? Or 0.8 to 1? 0.6 to 0.5?
Thanks.
-Git
Printable View
How do I round to the nearest 0.5?
eg. I have the number 0.6, how do I round it to 0.5? Or 0.8 to 1? 0.6 to 0.5?
Thanks.
-Git
try this
MyNumber = Int(MyNumber)
Chris Davidsen
Nope, that's not quite what I want. I want it to round to the nearest 0.5.
So 0.7 would goto 0.5, 0.9 would goto 1, 0.3 would goto 0.5, 0.1 would goto 0, etc...
Thanks anyway.
-Git
If you use VB6 you can use the Round function to round a number...
Nope - I meant so it will round in intervals of 0.5, not 1.
I've figured it out now anyway.
-Git
How did you managed that? I want to see because I'm unsure of you're trying to acomplish, it may be handy for me sometime!
You can try
Unfortunately all these round down, so 0.9 is 0.5.Code:Fix(number) + 0.5
Have a look at these threads:
http://forums.vb-world.net/showthrea...threadid=28747
http://forums.vb-world.net/showthrea...threadid=27446