Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Ceil,Floor

Hi Community Experts,

Can you please help me out in understanding below functions. 

When we use ceil,floor,round functions with parameters like below, giving the results mentioned. But I am not getting how it working. Can you give some explanation for those with parameters.    Like   Ceil(2.6,0.25) ,Floor(2.6,0.25)  etc

Ceil(2.5)                  3

Ceil(2.6, 0.25)         2.75

Floor(2.5)                2

Floor(2.6, 0.25)        2.5

Round(3.14)            3

Round(3.16, 0.1)     3.20

Round(3.14, 0.1)     3.10

Thanks

Suneela

1 Solution

Accepted Solutions
kumarnatarajan
Partner - Specialist
Partner - Specialist

Hi,

Ceil(2.6,0.25)=2.75   

If apply the offset 0.25, you get 0.25, 0.50, 0.75, 1.00, 1.25

The nearest higher number for 2.6 is 2.75  and so  ceil returns 2.75 

View solution in original post

6 Replies
kumarnatarajan
Partner - Specialist
Partner - Specialist

anandathome
Creator
Creator

Hi Suneela,

       You can refer pages 304,305 and 804,805 in the Qlikview Reference manual for a good explanation.

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 [ , step [ , offset ]])

-->Rounding of x upwards or downwards n number of steps with an offset of offset. The result is a number. If x is exactly in the middle of an interval, it is rounded upwards. The function complies with the IEEE standard

64-bit floating point numbers.

-Anand.

Not applicable
Author

Guys that was really very helpful, it works in my project. I was seeking for this months ago. anti fatigue comfort mats

Not applicable
Author

thanks all.

It really helped. But can you explain when we given expression like below.

It does not have base. Then how it will work.What will it assume for base, or whether 0.5 is base or offset?

Ceil(2.6,0.25)=2.75   

anandathome
Creator
Creator

Here 0.25 is just the base with no offset.

So your result will be in multiples of 0.25

kumarnatarajan
Partner - Specialist
Partner - Specialist

Hi,

Ceil(2.6,0.25)=2.75   

If apply the offset 0.25, you get 0.25, 0.50, 0.75, 1.00, 1.25

The nearest higher number for 2.6 is 2.75  and so  ceil returns 2.75