difference between floor() and rounddown() function

Certified Lead Developer

what is the difference between floor() and rounddown() function or ceiling() and roundup() function ?

  Discussion posts and replies are publicly visible

Parents
  • floor:
    In floor(20,5) will give the nearest multiple of 5 which is less than or equal to the given number ie 20
    for floor(13,5) it gives 10
    ceiling:
    ceiling(12.8) round to the next integer ie 13
    rounddown:
    roundup:
    roundup( number, [num_digits] )
    roundup(2.123456, 1) will round to 2.2
    roundup(2.123456, 2) will round to 2.13
    roundup(2.123456, 3) will round to 2.124
    roundup(2.123456, 4) will round to 2.1235
    roundup(2.123456, 5) will round to 2.12346
    it rounds the nth digit after the decimal point to the next value and displays the same value till that nth precision
    ex:roundup(2.123456, 3)-->2.124
    but
    if [num digits] is grater-than or equal to the max precision it will give the same number
    ex:
    roundup(2.123456, 6) will round to 2.123456
    roundup(2.123456, 9) will round to 2.123456

    rounddown:
    rounddown( number, [num_digits] )
    it simply display till the nth precision
    ex:
    rounddown( 2.123456,3) rounds to 2.123
Reply
  • floor:
    In floor(20,5) will give the nearest multiple of 5 which is less than or equal to the given number ie 20
    for floor(13,5) it gives 10
    ceiling:
    ceiling(12.8) round to the next integer ie 13
    rounddown:
    roundup:
    roundup( number, [num_digits] )
    roundup(2.123456, 1) will round to 2.2
    roundup(2.123456, 2) will round to 2.13
    roundup(2.123456, 3) will round to 2.124
    roundup(2.123456, 4) will round to 2.1235
    roundup(2.123456, 5) will round to 2.12346
    it rounds the nth digit after the decimal point to the next value and displays the same value till that nth precision
    ex:roundup(2.123456, 3)-->2.124
    but
    if [num digits] is grater-than or equal to the max precision it will give the same number
    ex:
    roundup(2.123456, 6) will round to 2.123456
    roundup(2.123456, 9) will round to 2.123456

    rounddown:
    rounddown( number, [num_digits] )
    it simply display till the nth precision
    ex:
    rounddown( 2.123456,3) rounds to 2.123
Children
No Data