-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse Numbers as Scientific, not Double #176
Comments
Remark: I have not sanity-checked my PR, it is just the bare minimum to make the changes compile as a proof-of-concept. In particular, the TH-generated |
Thanks @olafklinke I'll try to find time for that PR |
I noticed that I neglected to adjust the test suite. But a simple |
Would you mind fixing the tests? |
Apologies, the last commit that should have fixed the test apparently did not change any files. I added a 9th commit to my fork. How do I update the PR to include these commits? Or does the PR update itself? |
It does but unfortunately CI run doesn't get automatically approved (probably I need to do something about that) |
If the OOXML spec really states that all numbers in spreadsheets are xsd:double then the real issue is not the conversion between decimal representation and |
Oh, shoot, I didn't check the XSD spec, thanks. |
Currently
xlsx
seems to build on the Data.Text.Read module, which provide polymorphic functions likeThis is however used to parse a decimal number from the XML into a Double value (note that
CellDouble :: Double -> CellValue
) which for most values can not represent the rational number exactly. This is especially annoying when the decimal number represents aLocalTime
, because rounding errors can shift the time into a different day, thus affecting the displayed value quite a lot.My proposed change is that
CellValue
gets an additionalCellDecimal
constructor for implementing and testing therational
parsing toScientific
.CellDouble
is deprecated.To limit breakage, one could provide a view pattern named
CellDouble
that usesData.Scientific.toRealFloat
for the transition phase.The text was updated successfully, but these errors were encountered: