
Re: Doubts in understanding the ceil and floor functions
Nagaian Krishnamoorthy Apr 14, 2013 5:17 PM (in response to Penchala Prasad)ceil(x [ , base [ , offset ]])
Rounding of x upwards to the nearest multiple of base with an offset of offset. The result is a number.
Examples:
ceil( 1.1 , 1 , 0.5 ) returns 1.5
Multiples of 1 are 0, 1, 2, 3, 4
If apply the offset 0.5, you get 0.5, 1.5, 2.5, 3.5, 4.5
The nearest higher number for 1.1 is 1.5 and so ceil returns 1.5
floor(x [ , base [ , offset ]])
Rounding of x downwards to the nearest multiple of base with an offset of offset. The result is a number.
Examples:
floor( 3.88 , 5 ) returns 0
multiple of 5 are 0,5,10,15
In this list, the nearest lower number for 3.88 is 0 and so floor() returns 0
Hope this helps.

Re: Doubts in understanding the ceil and floor functions
Satti Aluri Jun 25, 2013 9:53 AM (in response to Nagaian Krishnamoorthy)Hi ,
let x=ceil(5.3,2,8);
As per your logic ,
Multiples of 2 are 0,2,4,6,8
If apply the offset 8 you get 8,10,12....
output will be 8 .
But i'm getting 6. Do you know why ? Am i missing anything ??
Thanks and Regards
Satti

Re: Doubts in understanding the ceil and floor functions
Stefan Wühl Jun 25, 2013 5:09 PM (in response to Satti Aluri)The intervals are not only created by using positive integral numbers as factor for the increments, but also negative. So intervals start not only from 0,2,4,6,8,... but from ...4, 2,0,2,4,6 ....
So 6 is indeed the nearest interval upper limit to 5.3.

Re: Doubts in understanding the ceil and floor functions
Satti Aluri Jun 27, 2013 4:10 AM (in response to Stefan Wühl )Thanks and Perfect ..




Re: Doubts in understanding the ceil and floor functions
Stefan Wühl Apr 14, 2013 6:22 PM (in response to Penchala Prasad)floor(), ceil() [and not to forget round()] all have the same possible arguments:
ceil(x [ , base [ , offset ]])
Rounding of x upwards to the nearest multiple of base with an offset of offset. The result is a number.
floor(x [ , base [ , offset ]])
Rounding of x downwards to the nearest multiple of base with an offset of offset. The result is a number.
round( x [ , base [ , offset ]])
Rounding of x upwards or downwards to the nearest multiple of base with an offset of offset. The result is a number. If x is exactly in the middle of an interval, it is rounded upwards.
'x' is your input number. 'offset' is the number your intervals start from. base is the interval increment.
So ex2.floor( 1.1 , 1 , 0.5 ) creates intervals like [0.5, 1.5]; [1.5, 2.5]; [2.5, 3.5] ...
If your input is 1.1, the first interval is the matching one. floor() now returns the lower limit and ceil() the upper limit of the matching interval.
Hope this helps,
Stefan

Re: Doubts in understanding the ceil and floor functions
Joaqu�n L�zaro Apr 19, 2013 10:34 AM (in response to Penchala Prasad)Hi:
Good help from krishnamoorthy & swuehl .
... but with QV 11 SR2 64bits there is a problem with Round and Floor, both not working as expected.
See Support cases 00170986 & 00170987.
I could write a little trick but of course have other problems behind!!!