Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Partner
Partner

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
Highlighted
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

Highlighted
Partner
Partner

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

Highlighted
Not applicable

s your right the answer is 26364461.5 only

Highlighted
Partner
Partner

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 ?

Highlighted
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

Highlighted
Employee
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

Highlighted
Specialist
Specialist

Hi Jonathan,

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

Best Regards,

Chinna

Highlighted
Partner
Partner

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

Highlighted
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