Description: Consider the following double in BASIC: 691.2 The nearest double representation is according to IEEE 754 is 691.200000000000045474735088646411895751953125 Currently, a double value will be converted in basic/source/sbx/sbxdbl.cxx using 17 significant digits with ImpCvtNum( n, 17, *p->pOUString, bCoreString ); Steps to Reproduce: Insert the following macro: Sub Test MsgBox 691.2 End Sub Actual Results: 691.2000000000001 Expected Results: 691.2 Reproducible: Always User Profile Reset: No Additional Info: This bug is a follow up of 107953. Prior versions are not affected due to reduced precision.
This in fact may relate both to conversion of string to double, or double to string (so that a correctly imported number might be represented using wrong digits). See also tdf#130725. I wonder when we will be able to use elementary string conversion functions from C++17 [1] and if they will help us in such a non-standard thing as Basic's import and formatting. Also interesting if tdf#143193 is related, with its unobvious non-standard extensions to LO usual number formatter code. [1] https://en.cppreference.com/w/cpp/utility#Elementary_string_conversions
Andreas Heinisch committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/ed166025123a403fbd679377387a45e097f09d6e tdf#143575, tdf#143974 - Use rtl::math::doubleToUString to convert numbers to strings It will be available in 7.3.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Andreas Heinisch committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/8294268307d98d3ea04f18a2ed89212cec516845 tdf#143575, tdf#143974 - Remove custom precision format in BASIC It will be available in 7.3.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Andreas Heinisch committed a patch related to this issue. It has been pushed to "libreoffice-7-2": https://git.libreoffice.org/core/commit/da0d6541b29f4dd3cd223e15be14dabc2704fb83 tdf#143575, tdf#143974 - Use rtl::math::doubleToUString to convert numbers to strings It will be available in 7.2.3. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Andreas Heinisch committed a patch related to this issue. It has been pushed to "libreoffice-7-2": https://git.libreoffice.org/core/commit/bc2896c98795d356d2c1b690d431b94aebd5b5bb tdf#143575, tdf#143974 - Remove custom precision format in BASIC It will be available in 7.2.3. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.