Jump to content

Rounding to the nearest .5


phpvolution

Recommended Posts

I've looked for a while to find an answer on this and haven't come up with anything.

I have a number, say 6.7

I want it to round in increments of .5, and to the nearest. I'm trying to make a php version of the formula I used in excel, which was the floor() function.. only in excel I used: =FLOOR(SUM(I4:L4)/4,0.5)

So 6.7 should be 6.5, 6.75 should still be 6.5, 6.76 should be 7. And so on.
Any ideas on how I can do this?
Link to comment
https://forums.phpfreaks.com/topic/11958-rounding-to-the-nearest-5/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.