[Libreoffice-bugs] [Bug 143974] Basic function CStr is failing to properly convert integers after 41 steps in a for loop

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Fri Aug 20 15:50:45 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=143974

--- Comment #1 from Uwe Auer <uwe at franke-auer.de> ---
The title of this report mentions "...convert integers..." but obviously
variable "i" is not an integer, but a floating point value. Explicitly using
"Dim i As Long" prevents the observed behavior to occur, i.e. use modified
macro:

Sub Main
Dim Txt As String
Dim i As Long

    For i = 1 To 50
        Txt = Txt + CStr(i)
        If (i mod 10 = 0) Then
            Txt = Txt + CHR(10)
        Else
            Txt = Txt + ", "
        End If
    Next i
    MsgBox Txt
End Sub


Not sure, whether variables having no explicit type declaration are correctly
assumed to have a floating point type. Hence this is not a statement "bug or
not a bug".

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210820/9ed51388/attachment.htm>


More information about the Libreoffice-bugs mailing list