Derleek Posted September 1, 2008 Share Posted September 1, 2008 Is there a simple way to round up a number? only catch is I want to ALWAYS round up. Link to comment https://forums.phpfreaks.com/topic/122172-solved-rounding-up/ Share on other sites More sharing options...
Derleek Posted September 1, 2008 Author Share Posted September 1, 2008 ok, found this chunk of code. if (X % 1 <.50 && X % 1 > 0) { result.value == round(X / 100) + 1 } else { result.value == round(X / 100) } } Link to comment https://forums.phpfreaks.com/topic/122172-solved-rounding-up/#findComment-630735 Share on other sites More sharing options...
Psycho Posted September 1, 2008 Share Posted September 1, 2008 You don't need that - there is a built-in function to always round up (and there is one for rounding down as well) result.value = Math.ceil(x); Link to comment https://forums.phpfreaks.com/topic/122172-solved-rounding-up/#findComment-630741 Share on other sites More sharing options...
Derleek Posted September 1, 2008 Author Share Posted September 1, 2008 cool, thx. Thats what i was looking for Link to comment https://forums.phpfreaks.com/topic/122172-solved-rounding-up/#findComment-630748 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.