Bug 68930

Summary: bin2dec function limited
Product: LibreOffice Reporter: dederocks
Component: SpreadsheetAssignee: Not Assigned <libreoffice-bugs>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: medium CC: gerard.fargeot, qubit
Version: 4.0.4.2 release   
Hardware: x86 (IA32)   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description dederocks 2013-09-04 12:04:36 UTC
The bindec function has a limited range for the input parameter, which in my view doesn't make sense.
For example: BINDEC(101110) yields 46, but BINDEC(10111110111) yields err:502.
Comment 1 Philipp Weissenbacher 2014-07-18 21:10:40 UTC
I think you mean BIN2DEC(). As documented here it takes 10 digits (https://help.libreoffice.org/Calc/Add-in_Functions,_List_of_Analysis_Functions_Part_One#BIN2DEC).

This is due to the fact that SCA_MAXPLACES is set to 10 (see http://opengrok.libreoffice.org/xref/core/scaddins/source/analysis/analysis.cxx#SCA_MAXPLACES).

No idea whether we can raise that limit to SAL_MAX_INT32.
Comment 2 GerardF 2014-09-30 12:23:54 UTC
BIN2DEC have the same limitation in Excel too.
ODF specifications have also the same limitation.
I don't know why this limit.

You can use DECIMAL function in replacement of (whatever)2DEC which have higher limits or BASE for DEC2(whatever).
Comment 3 Robinson Tryon (qubit) 2014-11-12 23:08:18 UTC
(In reply to Philipp Weissenbacher from comment #1)
> I think you mean BIN2DEC(). As documented here it takes 10 digits
> (https://help.libreoffice.org/Calc/Add-in_Functions,
> _List_of_Analysis_Functions_Part_One#BIN2DEC).
> 
> This is due to the fact that SCA_MAXPLACES is set to 10 (see
> http://opengrok.libreoffice.org/xref/core/scaddins/source/analysis/analysis.
> cxx#SCA_MAXPLACES).
> 
> No idea whether we can raise that limit to SAL_MAX_INT32.

It sounds like
1) This is a pretty straightforward improvement to the codebase
2) There's no clearcut reason why we wouldn't want to increase the bound

I'll toss it in NEW for now. If a dev has a good explanation about why we can't/shouldn't bother with this one, please feel free to RESOLVE it appropriately.

Thanks!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.