Bug 88835 - Formatting: Default scientific format should contains fewer digits in exponent
Summary: Formatting: Default scientific format should contains fewer digits in exponent
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: medium enhancement
Assignee: Laurent BP
QA Contact:
URL:
Whiteboard: target:5.0.0
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-27 21:29 UTC by Laurent BP
Modified: 2015-04-22 18:48 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent BP 2015-01-27 21:29:28 UTC
Description: Default scientific format is set to "0.00E+000" which is necessary for numbers higher than 1E100. These numbers almost do not exist in "real" life.

Steps to reproduce:
1. Enter a value in a cell
2. Click on button "Number format: Exponential" or hit Ctrl+Shift+2

Actual behavior:
Value is formated with "0.00E+000"

Expectd behavior:
Useless '0' in exponential part should be removed, as it is very unlikely that a "real" calculation gives a results higher than 1E100. See
https://en.wikipedia.org/wiki/Googol

Default scientific format should be "0.00E+00" or even "0.00E+0" as LibO will add all necessary figures in exponent.
Comment 1 Laurent BP 2015-01-30 21:30:46 UTC
Default scientific format is hard coded for each locale in
http://opengrok.libreoffice.org/xref/core/i18npool/source/localedata/data/

For instance, for en_US.xml change
    <FormatElement msgid="ScientificFormatskey1" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6">
      <FormatCode>0.00E+000</FormatCode>
    </FormatElement>
    <FormatElement msgid="ScientificFormatskey2" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7">
      <FormatCode>0.00E+00</FormatCode>

to
    <FormatElement msgid="ScientificFormatskey1" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6">
      <FormatCode>0.00E+000</FormatCode>
    </FormatElement>
    <FormatElement msgid="ScientificFormatskey2" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7">
      <FormatCode>0.00E+00</FormatCode>

But this does not apply to General format
Comment 2 Robinson Tryon (qubit) 2015-02-02 15:57:34 UTC
(In reply to Laurent BP from comment #0)
> Description: Default scientific format is set to "0.00E+000"
> ...
> Expectd behavior:
> Useless '0' in exponential part should be removed, as it is very unlikely
> that a "real" calculation gives a results higher than 1E100.
> 
> Default scientific format should be "0.00E+00" or even "0.00E+0" 

Perhaps this is set up so that exponents will align properly in columns?

e.g. would you rather see:

  8.29E+51
  4.51E+5
  1.28E+12

or

  8.29E+51
  4.51E+05
  1.28E+12

?

Summary -> (less -> fewer, for a countable noun)
Comment 3 Laurent BP 2015-02-02 17:30:56 UTC
Hi Robinson,

Thanks for your concern.

For my personal use, I would prefer fewer digits (0.00E+0) because I do not use a fixed font, so even with 0.00E+00, there will be no alignment.

However, I noticed that modifying default settings from 0.00E+000 to 0.00E+00 would be very easy as this format already exists (see comment 2): just need to modify all locale files in i18npool/source/localedata/data/
However, 0.00E+0 would required to create a new format in the format list which would require more efforts. 
In all cases, "General" (standard) format will need to follow the new default format.

And thanks for correcting my poor English ;)
Comment 4 Laurent BP 2015-02-20 09:58:33 UTC
@adolfo: I noticed you just changed status to ASSIGNED. However, in the same time I have submitted a patch to modify General format. 
See https://gerrit.libreoffice.org/#/c/14562/ and https://gerrit.libreoffice.org/#/c/14563/
That's why I assigned the bug to myself. Did you intend to take it?
Comment 5 Adolfo Jayme 2015-02-20 10:50:10 UTC
(In reply to Laurent BP from comment #4)
> Did you intend to take it?

No, I just forgot to add you to the Assigned field. Sorry about that!
Comment 6 Eike Rathke 2015-02-20 21:30:01 UTC
I think defaulting to two digits in the exponent for the General format
is fine, but I'm not convinced of the idea to omit up to two 0s, for
following reasons:
* As Robinson mentioned, it may make numbers "jump around" IF you use
  a fixed font. That Laurent personally doesn't use a fixed font is no
  argument here ;-)
* Especially the range E-9 to E-12 is fairly often used for nano and
  pico, seeing E-09 and E-12 in one column instead of E-9 and E-12 is
  certainly more pleasing to the eye. Same for E+9 and E+12 Giga and
  Tera.
* Also Excel has minimum two digits in the exponent.

If anyone wants to really have only one digit in the exponent there is
always the possibility to define and apply a number format like 0.0E+0
or even 0.0E0 if you like it even shorter.
Comment 7 Laurent BP 2015-02-21 21:20:06 UTC
@Eike: OK. I'm on the way to limit to two digits, and not one.
Comment 8 Commit Notification 2015-02-23 20:27:32 UTC
Laurent Balland-Poirier committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=cc8a2d00387d554cd4d694503dd25fa8f950a78f

tdf#88835 Calc: General format: 2 digits in exponent

It will be available in 4.5.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2015-04-22 12:55:42 UTC
Laurent Balland-Poirier committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=407733158220ada48ff66768f218bbc9bdb51098

tdf#88835 2 digits in exponent for default scientific format

It will be available in 5.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2015-04-22 17:43:36 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=afd8e4093687557843427d7539c4b0e6ece8bbff

both scientific formats are of type medium, tdf#88835 follow-up

It will be available in 5.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.