When assigning a string variable containing a number formatted as scientific notation, to a double variable, the conversion fails and zero is assigned. See example code below: Sub Main dim d as double dim s as string s="1.0E-5" d=s msgbox "Value of d is: "+str(d) End Sub However, if s is set equal to "0.00001" then it works correctly. A workaround is to use the val() function, but this often requires numerous changes to legacy code that worked fine in OpenOffice Basic. I haven't checked any versions earlier than the one listed here (4.4.7.2). So, I don't know how far back this problem existed.
reproducible with Version: 5.2.0.0.alpha0+ (x64) and Version: 4.3.0.0.alpha1+ LO 3.5: value of d is:1 - not correct result. OpenOffice 4.1.2: value of d is:1.0E-5 - correct result
There is also a related bug with CDbl() and CSng() converting a string with scientific notation. These functions convert using the locale decimal separator, so I use a localized string to work for any value. dim d as double dim s1 as string s1 = 1.0e-5 ' implicit conversion to string msgbox s1 ' the string is correct d = CDbl(s1) ' error : data type mismatch msgbox d dim sf as single sf = CSng(s1) ' error : data type mismatch msgbox sf
This appears to have gone wrong with... commit 9e9f39d171cafa035d7b8e74187e25c3581cb89d Author: Eike Rathke <erack@redhat.com> Date: Tue Mar 19 23:23:16 2013 +0100 resolved rhbz#919020 Basic CDbl() and CSng() scan localized number
https://gerrit.libreoffice.org/#/c/27342/ makes it work for me
*** Bug 93193 has been marked as a duplicate of this bug. ***
Caolán McNamara committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=2aed0d49d7891b9360916b65771222810aeeac96 Resolves: tdf#98778 fix parsing of exponents It will be available in 5.3.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Caolán McNamara committed a patch related to this issue. It has been pushed to "libreoffice-5-2": http://cgit.freedesktop.org/libreoffice/core/commit/?id=ff5e57d2292b548d7f8607c47a38d9e39753d5fa&h=libreoffice-5-2 Resolves: tdf#98778 fix parsing of exponents It will be available in 5.2.1. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Caolán McNamara committed a patch related to this issue. It has been pushed to "libreoffice-5-1": http://cgit.freedesktop.org/libreoffice/core/commit/?id=43d1f9bfd4300e8bf5bcb631dcc2d849b4490d3a&h=libreoffice-5-1 Resolves: tdf#98778 fix parsing of exponents It will be available in 5.1.6. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Caolán McNamara committed a patch related to this issue. It has been pushed to "libreoffice-5-1-5": http://cgit.freedesktop.org/libreoffice/core/commit/?id=a6649901d3e01b3751b3e1660ac29b2248bf3c25&h=libreoffice-5-1-5 Resolves: tdf#98778 fix parsing of exponents It will be available in 5.1.5. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Caolán McNamara committed a patch related to this issue. It has been pushed to "libreoffice-5-2-0": http://cgit.freedesktop.org/libreoffice/core/commit/?id=854e4a714d9abea5d66ed34f73f1b05c06b62b86&h=libreoffice-5-2-0 Resolves: tdf#98778 fix parsing of exponents It will be available in 5.2.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Hi Verified on windows 7/64 & Version: 5.3.0.0.alpha1+ Build ID: 8a796410ec8f440b4163b15b928347c499da7a8f CPU Threads: 2; OS Version: Windows 6.1; UI Render: default; TinderBox: Win-x86@42, Branch:master, Time: 2016-10-20_23:07:21 Locale: fr-FR (fr_FR); Calc: group Thank you Regards Pierre-Yves
*** Bug 67394 has been marked as a duplicate of this bug. ***
Xisco Fauli committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/f7d128f1223a28d5fdae53ceaad55bf3166a9036 tdf#98778: basic_macros: Add unittest 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.