eric-wood / excel2latex

Javascript .xlsx to LaTeX table converter
90 stars 28 forks source link

non-formatted numbers change to have many decimal places #19

Open kemagargal opened 6 years ago

kemagargal commented 6 years ago

Hi! I have an excel table with no formatting and number values with a maximum of 2 decimal places, yet when I pipe them through excel2latex, some values seem to round down by a small fraction, adding many decimal places. For example, the value 8.62 in my table was changed to 8.6199999999999992. In my 5col x 30row table, this occurred for 9 values.

Not a huge deal for my small table, as I just combed back through and corrected these values in my tex editor, but could be annoying if it was hundreds of values.

Also, thanks for making such a useful tool!

eric-wood commented 6 years ago

This is probably one of the most-reported issues I get, and it's mostly due to my naive parsing of the XSLX format, in which numbers are stored as raw floats, but displayed using special formatting codes.

I've done some initial research on how to fix this, but I'm planning on doing a rewrite of the whole project sometime in 2018 since the source code comes from an era of me learning javascript and is horrific. So this and other issues reported here won't get fixed until I get a chance to do that :(