The BASIC function Function TestFunc() As Currency Dim Result As Currency Result = 5.50 TestFunc = Result End Function used in a spreadsheet as =TESTFUNC() returns a text string result instead of number, hence number formatting (e.g. currency format) and further calculations with the value don't yield the expected results.
Actually of the list of available SbxDataType only SbxINTEGER, SbxLONG, SbxSINGLE and SbxDOUBLE are accepted as number, all other result in text string.
I'm interested in fixing this. (I'm the guy who asked the question) What methods are related to this problem?
I already fixed it, will commit soon. For interest, it's in sc/source/core/tool/interpr4.cxx ScInterpreter::ScMacro()
Eike Rathke committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=9a283e44ca7de2f2fa276544b4d49cff495bd53d Resolves: tdf#105558 accept numeric BASIC return types as numeric It will be available in 5.4.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.
Pending review https://gerrit.libreoffice.org/33616 for 3-5
Eike Rathke committed a patch related to this issue. It has been pushed to "libreoffice-5-3": http://cgit.freedesktop.org/libreoffice/core/commit/?id=ea525e91338a164bbc76954869295f1e939095ae&h=libreoffice-5-3 Resolves: tdf#105558 accept numeric BASIC return types as numeric It will be available in 5.3.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.
I can confirm that this issue is fixed in the master branch of the git repo.
rounak committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/7a3a21657bbbf7c4187fc4ff6a45dda5512951a2 tdf#105558: sc_macros: Add unittest It will be available in 7.2.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.