Generalized engineering notation in E formats don't work as expected #2578
Labels
No Label
DBF
Dates
Defined Names
Features
Formula
HTML
Images
Infrastructure
Integration
International
ODS
Operations
Performance
PivotTables
Pro
Protection
Read Bug
SSF
SYLK
Style
Write Bug
good first issue
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#2578
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Formats like ##0.0E+0 are a generalized form of Engineering notation, where the exponent is to be a multiple of the number of digits before the '.'. Using this specified format, Excel will give you the following results:
It turns out that the number of format digits to the left of the decimal point do not represent the number of digits displayed--at least not directly, rather they represent, the multiple used to determine the exponent. If we use the format "0.00+E00" then the multiple is 1 (scientific format). The format "#0.00E+00" sets the multiple to 2 (exponents are -2, 0, 2, 4, etc.) The format "###0.00E+00" sets the multiple to 4 (exponents are -4, 0, 4, 8, etc.).
SSF should mirror this behavior.
The code currently tries to do this properly but only handles a very limited case
/^#+0.0E\+0$/
of formats, and it doesn't do the crazy thing with 0.0.