Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
kentliao66
Partner - Contributor II
Partner - Contributor II

Function Round Question.

Hi, Expert:

When we use function round, we found a strange status:

= ROUND(26364461.43,0.1) = 26364461.4
= ROUND(26364461.44,0.1)

= 26364461.4

But when the number is 26364461.45 , the answer become 26364461.4, In my mind, it should be 26364461.5.

= ROUND(26364461.45,0.1)

= 26364461.4

When we use the follow number , 26364461.46, 26364461.47 the answer is correct "26364461.5"

= ROUND(26364461.46,0.1) = 26364461.5
= ROUND(26364461.47,0.1) = 26364461.5

so, is ROUND(26364461.45,0.1) = 26364461.4 correct ?

I'm using Qlikview x64 11.20.SR9 Desktop.

Many thnaks

 

    Kent

:

13 Replies
kentliao66
Partner - Contributor II
Partner - Contributor II
Author

Hi, Jonathan:

How do I get provided to access this link --

num() rounds differently to round() for half-step values

http://community.qlik.com/message/423596#423596

or

have any workaround solution ?

Many thanks.

   Kent Liao

JonnyPoole
Employee
Employee

This provides better context on the inconsistencies.

http://community.qlik.com/blogs/qlikviewdesignblog/2013/12/17/rounding-errors

The suggestion is to avoid rounding to sub-integer fractions.  Like rounding to .5 or .6 etc...

In your case, instead of rounding to a sub-integer fraction, multiply by 10 and round to an integer, than divide by 10 as follows:

= ROUND(26364461.45 * 10) / 10

kentliao66
Partner - Contributor II
Partner - Contributor II
Author

HI, Manojqlik & Jonathan:

Thanks a lot, I'll try it.

by the way, is this Bug possible to fix, when?

Best Regards...

   Kent Liao

Not applicable

Hi kent,

that we need to ask  qliktech,  but i am not sure how much time it takes,

pls make this thread close