Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Ceil Function

Hi!

I'm working with the Ceil() function to round up some numbers, but I get unwanted results.

I want to round just numbers with 3 decimal positions, and if the number has 2 decimal positions, no round must be made.

So:

2.285 should be : 2.29

2.28 should be 2.28.

I am using the ceil function, which works well when I have 3 decimal positions. With 3 decimal positions I don't understand what it does:

Ceil(2.21,0.01,0) =2.21 -> Right

Ceil(2.22,0.01,0) =2.23 -> Wrong! Why rounded?

Ceil(2.23,0.01,0) =2.23 -> Right!

Ceil(2.24,0.01,0) =2.25 -> Wrong again! Why rounded?

Why is that happening? Is there some way to know how many decimal positions a number has, so I can use that function only for numbers with 3 decimal positions?

Thank you!

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Have a look at this excellent blog post by HIC, Rounding Errors

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Have a look at this excellent blog post by HIC, Rounding Errors

Not applicable
Author

Thank you very much for pointing out the reason of why this is happening. I will try to find another way then.