c++ - Using the ceil() function more advanced -


i aware of ceil function does, rounds numbers up. so; 1.3 2.0 , 5.9 6.0. want round steps of 0.5. so; 1.3 1.5 , 5.9 6.0. possible? thanks!!!

y = ceil(x * 2.0)/2.0; 

should need:

x     x*2.0   ceil(x*2.0)  y ------------------------------ 1.3    2.6     3.0         1.5 1.6    3.2     4.0         2.0 5.9   11.8    12.0         6.0 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -