Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
:
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
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
s your right the answer is 26364461.5 only
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 ?
= ROUND(26364461.46,0.1) change here .45 to .46
u will get like 26364461.5 ,
small fractions caculation ,
may be its a bug
You are right Kent ... there have been inconsistencies reported before. Its inconsistent with the documentation and buggy.
Hi Jonathan,
Unable to access the link you have provided to read about the inconsistencies for Round.
Best Regards,
Chinna
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
No idea yar, its a bug.
jonthan provided a link based on this
i am able to see that link