What's the difference between the pair of functions floor()/ceil() and min()/max()? - Stack Overflow
What's the difference between round/fix/foor and ceil these four functions
what is difference between ceiling and roundup server in sql server - Stack Overflow
Whats the difference between Round, Ceiling and Floor?
Videos
Math.round is underspecified, and I believe its behavior has actually changed in the past -- see http://bugs.java.com/view_bug.do?bug_id=6430675 -- but generally speaking it behaves like RoundingMode.HALF_UP, which has an extensive table of its differences from RoundingMode.CEILING or RoundingMode.FLOOR.
Round will convert 3.3 into 3 while ceil will convert the same into 4. Hope you understood.
This is apples vs. oranges. In most languages/APIs, min/max take two (or more) inputs, and return the smallest/biggest. floor/ceil take one argument, and round it down or up to the nearest integer.
To my knowledge max and min are used on a collection, say an array of numbers. Floor and ceiling are used for single numbers. For example:
min(1, 2, 3, 4) => 1
max(1, 2, 3, 4) => 4
floor(3.5) => 3
ceiling(3.5) => 4
The answer is here
Round does a standard rounding. If value is .5 or over then you get back 1. If it’s less than .5 you get back 0
Ceiling returns the integer equal to or higher than the value passed in.
SELECT ROUND(235.400,0);
Answer= 235.000
SELECT CAST(ROUND(235.400,0) as int)
Answer= 235
ROUND let's you round values in a standard way (round up from values 5 or higher, round down otherwise). It also takes number of decimal places you want to round to, so if you want to get an integer, you just pass 0 as number of decimal places. See documentation.
CEILING is operation, which return the smallest integer greater than passed number, so it rounds up to next integer.
CONLUSION:
So basic difference: CEILING rounds up, while ROUND rounds number in standard way.
Another key difference is that ROUND let's you specify number of decimal places you want round to.
John wrote:
I am looking for a single function that will do EITHER a ROUNDUP or ROUNDOWN based on the value. (i.e. on a scale from 1-10, if the value is 1-4, I want to round the value down; if value is 5-10, I want to round the value up). Is there such a function that will do this in a single calculation?
That's the very definition of ROUND. But your example is ambiguous insofar as it is unclear what digit you are talking about rounding.
If you want 1.4 in A1 to round to 1 and 1.5 to round to 2, use ROUND(A1,0).
If you want 14 to round to 10 and 15 to round to 20, use ROUND(A1,-1).
See the ROUND help page for more details.
PS: For future reference, when you have a question, start a new discussion instead of piggybacking an old discussion, much less a discusion marked "answer".
First, usually no two questions are every identical in all details. So your specifics might require a completely different direction.
Second, some helpful people might never see your new "response" because they do not look at discussions marked "answer".
Finally, since you are not the original poster, you have no way to mark responses to your question as "answer".
Thank you joeu2004 for the help with this function and for the blog etiquette tips. Sorry, I'm a newbie learning. Have a blessed day.