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: 
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
Not applicable

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.

Examples:

round( 2.4 ) returns 2

round( 2.6 ) returns 3

round( 2.5 ) returns 3

round( 3.88 , 0.1 ) returns 3.9

round( 3.88 , 5 ) returns 5

round( 1.1 , 1 , 0.5 ) returns 1.5

it may help u

kentliao66
Partner - Contributor II
Partner - Contributor II
Author

Hi , Manojqlik:

I know the syntax,

but the Function ROUND(26364461.45,0.1) ,  if follow the rule, the answer should be 26364461.5, not 26364461.4, Am I right ?

Thanks for your reply.

   Kent

Not applicable

s your right the answer is 26364461.5 only

kentliao66
Partner - Contributor II
Partner - Contributor II
Author

Hi, Manojqlik:

so, the founction ROUND(26364461.45,0.1) the return value is wrong (26364461.4), thus, is it the bug or just I miss something ?

Not applicable

= ROUND(26364461.46,0.1)        change here   .45  to .46

u will get  like 26364461.5       ,

small fractions caculation    ,

may be its a bug

JonnyPoole
Former Employee
Former Employee

You are right Kent ... there have been inconsistencies reported before.  Its inconsistent with the documentation and buggy.

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

Anonymous
Not applicable

Hi Jonathan,

Unable to access the link you have provided to read about the inconsistencies for Round.

Best Regards,

Chinna

kentliao66
Partner - Contributor II
Partner - Contributor II
Author

Hi Manojqlik:

Yes, change the .45 to .46 can fix the problem, but it raise another question, these value is in the 10 million records, if I add this "if-then" condition, the performance should be not good. thus, have any good idea ?

Best Regards...

  Kent Liao

Not applicable

No idea  yar, its a bug.

jonthan provided a  link based on this

i am able to see that link

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