Bug 45952 - Format Cells: Binary and Hex with digit grouping
Summary: Format Cells: Binary and Hex with digit grouping
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Spreadsheet (show other bugs)
Version: 3.5.0 release
Hardware: All All
: low enhancement
Assignee: Not Assigned
QA Contact:
URL:
Whiteboard: NeedsDevEval
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-12 05:04 UTC by Valerio Messina
Modified: 2014-02-27 22:55 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Basic macro which has needed functionality (20.46 KB, application/vnd.oasis.opendocument.spreadsheet)
2012-12-13 12:59 UTC, sasha.libreoffice
Details

Description Valerio Messina 2012-02-12 05:04:55 UTC
Menu Format, Cells, tab Numbers, Category list: Binary and Hex

Binary should postpend a small 'b', hex should prepend a '0x'.

Both should have "digit grouping" that is similar to decimal thousand
separator, but happen every 4 digit.
Comment 1 Joel Madero 2012-12-11 19:13:21 UTC
Confirmed. 

Marking as:
New (confirmed)
Enhancement (leave it as is)
Priority (low, won't be useful for most users but for a limited group will be useful)

Whiteboard status: ProposedEasyHack

Thanks for the suggestion and for helping us make LibO a better office suite for everyone
Comment 2 Valerio Messina 2012-12-12 17:10:01 UTC
for "Version:" field, we should set 3.6 or next?
Comment 3 Joel Madero 2012-12-12 17:12:35 UTC
Version is always the version that the bug was originally found in OR the version that the enhancement was first thought of. If this was 3.5 go ahead and leave it. There is always confusion about what version means but it does mean the oldest, not the newest or latest, version, where the request was made against
Comment 4 Valerio Messina 2012-12-12 17:23:31 UTC
anyway thank you for considering this enhancement useful for electronics
Comment 5 sasha.libreoffice 2012-12-13 12:59:30 UTC
Created attachment 71444 [details]
Basic macro which has needed functionality

I have written formula on Basic Macro. It produces text that looks like correct hex and bin numbers. But because of it is text, no further calculations with such numbers are possible. Intended only for final output.
Only 31 bit numbers allowed. Alas. No 64 bit.
Comment 6 Lionel Elie Mamane 2013-05-31 05:15:04 UTC
(In reply to comment #0)
> Menu Format, Cells, tab Numbers, Category list: Binary and Hex
 
> Binary should postpend a small 'b', hex should prepend a '0x'.

IMHO the "binary" and "hexadecimal" format characters should not prepend anything by themselves; any constant string can be added in the format as such.

E.g., if we make the "binary digit" format character "b" and the "hex digit" format character "x", then the effect you want to achieve can be had by:

"b"b
"0x"x

But if one wants Ruby-compatible formatting, one can use:

"0b"b
"0x"x

And if one wants "like Fortran", one can use:

\B\"b\"
\Z\"x\"

Like ADA? Easy peasy:

"2#"b\#
"16#"x\#

etc, etc.

If we implement that, we could as well add octal (base 8) to the mix.

Actually, we could take inspiration from Ada and just allow an arbitrary base in number formats...

> Both should have "digit grouping" that is similar to decimal thousand
> separator, but happen every 4 digit.

Hmm... That's more difficult to achieve with my "arbitrary base" idea, but maybe this should also be arbitrarily configurable? <shrug>
Comment 7 Valerio Messina 2013-05-31 10:47:33 UTC
a general base solution is best but maybe hard, while hex and binary are very useful in engineering and not too hard to implement, many could settle for those
Comment 8 Eike Rathke 2013-06-28 15:04:36 UTC
Keep in mind that if this was implemented we'd also need to define how to store it in ODF. Does Excel have such thing in its number formats?
Comment 9 Joel Madero 2013-06-28 16:00:11 UTC
Indeed - we may need to close this and recommend Valerio get in touch with the ODF committee to see if they want to implement his.

Eike - agree with this? Really we can't do anything until ODF supports it.
Comment 10 Joel Madero 2014-02-27 22:55:11 UTC
In order to limit the confusion between ProposedEasyHack and EasyHack and to make queries much easier we are changing ProposedEasyHack to NeedsDevEval.

Thank you and apologies for the noise


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.