rarebit Posted June 18, 2008 Share Posted June 18, 2008 I'm wanting to round up to the nearest pence... ceil works with ints not floats, so i'm adding half a unit, which eventually didn't work, so i'm now using just under half a unit, e.g. $a1 = round(($cost2+0.0049),2); any other way... merci... Link to comment https://forums.phpfreaks.com/topic/110754-solved-ceil-for-floats/ Share on other sites More sharing options...
Jabop Posted June 18, 2008 Share Posted June 18, 2008 What is wrong with round? Link to comment https://forums.phpfreaks.com/topic/110754-solved-ceil-for-floats/#findComment-568163 Share on other sites More sharing options...
rarebit Posted June 18, 2008 Author Share Posted June 18, 2008 if it was 1.49, then it would round down, not up, same for 1.01... I used to add 0.5, but if it is 1.0 then php round does that up also, if I remember correctly certain other languages wouldn't in that instance (i'm not mentioning a language 'cos i'm partial to my head!) Link to comment https://forums.phpfreaks.com/topic/110754-solved-ceil-for-floats/#findComment-568165 Share on other sites More sharing options...
rarebit Posted June 18, 2008 Author Share Posted June 18, 2008 I'll class this as so.... Link to comment https://forums.phpfreaks.com/topic/110754-solved-ceil-for-floats/#findComment-568224 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.