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
  • Hi paragk998,

    1) floor() : Rounds the number down to the nearest multiple of the specified significance.
    It takes two parameters, floor( number, significance)
    For Example:
    floor(35.254698) returns 35.
    If we specify the significance , then the number will be rounded to the highest multiple of the significance that is less than the number.
    For example, floor(-7,5) = -10, because -10 is the highest multiple of 5 that is less than -7. The default value is 1.0.

    Examples:
    floor(35.2546,10) returns 30
    floor(35.2546,2) returns 34
    floor(35.2546,6) returns 30
    floor(35.2546,4) returns 32

    2) rounddown(): Rounds the number down to the specified digit

    Examples:
    rounddown(54.22255,0) returns 54
    rounddown(54.22255,1) returns 54.2
    rounddown(54.22255,2) returns 54.22
    rounddown(54.22255,5) returns 54.22255
    rounddown(54.22255,6) returns 54.22255

    3) ceiling(): Rounds the number up to the nearest multiple of the specified significance.

    Eaxmples:
    ceiling(2.3) returns 3
    ceiling(7.32,.5) returns 7.5
    ceiling(35.254698) returns 36

    4) roundup() : Rounds the number up to the specified digit.

    Examples:
    round(2.8888, 1) returns 2.9
    roundup(7.36819) returns 7.37
    roundup(7.36819, 3) returns 7.369
    roundup(7.36819, 4) returns 7.3682

    Once check the documentaion on Mathematical Functions so that you will get clear information.

    Hope this helpful.

    Regards,

    Aswini
Reply
  • Hi paragk998,

    1) floor() : Rounds the number down to the nearest multiple of the specified significance.
    It takes two parameters, floor( number, significance)
    For Example:
    floor(35.254698) returns 35.
    If we specify the significance , then the number will be rounded to the highest multiple of the significance that is less than the number.
    For example, floor(-7,5) = -10, because -10 is the highest multiple of 5 that is less than -7. The default value is 1.0.

    Examples:
    floor(35.2546,10) returns 30
    floor(35.2546,2) returns 34
    floor(35.2546,6) returns 30
    floor(35.2546,4) returns 32

    2) rounddown(): Rounds the number down to the specified digit

    Examples:
    rounddown(54.22255,0) returns 54
    rounddown(54.22255,1) returns 54.2
    rounddown(54.22255,2) returns 54.22
    rounddown(54.22255,5) returns 54.22255
    rounddown(54.22255,6) returns 54.22255

    3) ceiling(): Rounds the number up to the nearest multiple of the specified significance.

    Eaxmples:
    ceiling(2.3) returns 3
    ceiling(7.32,.5) returns 7.5
    ceiling(35.254698) returns 36

    4) roundup() : Rounds the number up to the specified digit.

    Examples:
    round(2.8888, 1) returns 2.9
    roundup(7.36819) returns 7.37
    roundup(7.36819, 3) returns 7.369
    roundup(7.36819, 4) returns 7.3682

    Once check the documentaion on Mathematical Functions so that you will get clear information.

    Hope this helpful.

    Regards,

    Aswini
Children
No Data