Bug 93627

Summary: new version of DEC2BIN() and HEX2BIN() with support of more than 10 binary digits
Product: LibreOffice Reporter: Valerio Messina <efa>
Component: CalcAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: enhancement CC: erack, jmadero.dev
Priority: lowest    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 108827    

Description Valerio Messina 2015-08-24 15:17:59 UTC
DEC2BIN() and HEX2BIN() support 10 binary digits only.
While 10 digit are enough for decimal and hex numbers, 10 bit are very few for
a binary number. Consider that as two's complement representation, the range is
restricted to -512 / +511 only. Binary numbers should be supported up to 32 or 64 bit.
As current DEC2BIN() and HEX2BIN() are stuck to 10 binary digits for compatibility reason (see https://bugs.documentfoundation.org/show_bug.cgi?id=45950), we need new (related) functions to generate more than 10 binary digits.
Comment 1 Joel Madero 2015-08-24 15:35:15 UTC
Opening a new bug report is not the right way to go here. An expert developer on the other issue closed it and said it would be "even worse" to create yet another formula. Please keep comments to the original bug report and discuss this with the expert developer (Eike) on that bug report. Closing this as a duplicate.

*** This bug has been marked as a duplicate of bug 45950 ***
Comment 2 Valerio Messina 2015-08-24 17:21:48 UTC
there should be an error.
Where did you read 'said it would be "even worse" to create yet another formula'?

At the opposite, the conclusion by Eike was that we need to implement two new functions, because the old one must be remain untouched for compatibility.
This is why I opened this new bug, to ask two new functions with support for more binary digits. I propose DEC2BINARY() and HEX2BINARY()
Comment 3 Joel Madero 2015-08-24 17:32:46 UTC
Eike - thoughts here? Valid enhancement or did I read your previous comments right from bug 45950?
Comment 4 Eike Rathke 2015-08-25 10:29:23 UTC
Well, it is of course a valid RFE, but with very low priority, and as such not exactly a duplicate of bug 45950.

Note that for positive numbers there's always the possibility to convert using the BASE() and DECIMAL() functions, e.g. BASE(DECIMAL("beef",16),2) for hex2bin.