eric-wood / excel2latex

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

Conversion of some decimal numbers is incorrect #14

Open thomasaarholt opened 8 years ago

thomasaarholt commented 8 years ago

Dragging a .xlsx file containing a single cell with the typed number "2.53" produces "2.5299999999999998". It happens to some other numbers ("77.6") as well, but I'm not sure if there is a trend. Try it: Workbook2.xlsx

\begin{tabular}{ | l | }
\hline
    2.5299999999999998 \\ \hline
\end{tabular}

My javascript isn't good enough to go hunting for the bug :/

eric-wood commented 8 years ago

This is because internally Excel is storing these as floats, but provides metadata as to how they're displayed. Unfortunately, this is something excel2latex still doesn't support. I've tried a few times to add it but was having trouble finding that info in the file. A lot of excel libraries also seem to not support it, either.

Fingers crossed I'll be able to finally get this figured out eventually! This is the biggest complaint most people have and I'd really like to fix it at some point.