<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - Hex value gives negative long / single / double number"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=131241">131241</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Hex value gives negative long / single / double number
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>6.4.1.2 release
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>BASIC
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>libreoffice-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sng@hellug.gr
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Description:
A hex value assigned to a long variable gives a negative number, instead of a
correct number.

LO 6.1.5 debian:  aLong = &HFFE0
                     (aLong = 65,504)

LO 6.4.1 manjaro: aLong = &HFFE0
                     (aLong = -32)


Steps to Reproduce:
Just run this and get an overflow error

Sub aLetterExample
        Dim aLetter As Long
        aLetter = &HFFE0
        msgbox chr(aLetter)
End Sub


This would work on both versions

Sub aLetterExampleFix
        Dim aLetter As Long
        aLetter = CLng("&HFFE0")
        msgbox chr(aLetter)
End Sub


Actual Results:
-32

Expected Results:
65504


Reproducible: Always


User Profile Reset: No



Additional Info:
assign 65504 tp variable</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>