<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 - Incorrect bounds on formula DEC2HEX"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=139173">139173</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incorrect bounds on formula DEC2HEX
          </td>
        </tr>

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

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

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

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>minor
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Calc
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>cameron.pinnegar@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Description:
In MS Excel the formulae DEC2BIN, DEC2OCT, and DEC2HEX have valid inputs as
integers m in the range -2^n <= m < 2^n, where n is given by

DEC2BIN: n=9
DEC2OCT: n=29
DEC2HEX: n=39

LibreOffice Calc gets this right for DEC2BIN and DEC2OCT, but not DEC2HEX.
There, the valid range is erroneously: -2^39 - 1 <= m < 2^39 + 1.

In other words, in Excel we have:

=DEC2HEX(2^39) == #NUM!
=DEC2HEX(-2^39 - 1) == #NUM!

But in LOCalc:

=DEC2HEX(2^39) == "8000000000"
=DEC2HEX(-2^39 - 1) == "7FFFFFFFFF"

This is surprising and does not seem like intended behaviour. I have not yet
investigated whether the other base conversion functions have inconsistent
bounds as well.

Steps to Reproduce:
In a cell do =DEC2HEX(2^39) or DEC2HEX(-2^39 - 1)

Actual Results:
Answers are "8000000000" and "7FFFFFFFFF" respectively.

Expected Results:
Answers should be #NUM! in both cases, in accordance with Excel.


Reproducible: Always


User Profile Reset: No



Additional Info:
OS: Manjaro Linux
LibreOffice Calc version: 6.4.7.2</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>