Article Number: 000043177 | Last Modified: 2019/01/08
Description
There is a difference in how rounding is done between QlikView 11.20 and QlikView 12.10. The effect happens when rounding decimals ending with five.
Environment:
QlikView 12.10 QlikView November 2017 (12.20) QlikView November 2018 (12.30)
Resolution
This is an intentional change in behavior when rounding decimals in the Qlik Engine.
This is the result of a project that changes how Engine rounds decimal when formatting double values as strings. The change was driven by the need to get consistent behavior between Windows, Linux and iOS.
The change means that numbers ending with 49999999.. will be rounded up instead of down when converted to a string. E.g. if a user enters 20.145, its binary representation corresponds to 20.14499999999999957367… Formatting 20.145 with 2 decimals would give 20.14 with the old behavior but will give 20.15 with the new behavior.
The library Qlik uses for formatting (David Gay’s dtoa) produces the shortest string that still converts back to the binary representation, and “20.145” is shorter than “20.144999…”. This also has the benefit of reducing the bandwidth when encoding Json, since e.g. 13.55 is formatted with 18 significant digits as “13.55”, not “13.5500000000000007”.
Using this library is also 2-3 times faster than using sprint().
Get Answers
Find Answers
Qlik Community
Collaborate with over 60,000 Qlik technologists and members around the world to get answers to your questions, and maximize success.
Experiencing a serious issue, please contact us by phone. For Data Integration related issues please refer to your onboarding documentation for current phone number.