Rounding difference between 11.20 and 12.10Article Number: 000043177 | Last Modified: 2019/01/08
QlikView November 2017 (12.20)
QlikView November 2018 (12.30)
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().
Have a Question?
Search Qlik's Support Knowledge database or request assisted support for highly complex issues.Submit a case
Experiencing a serious issue, please contact us by phone. View phone numbers and hours by region.