I’m trying to represent infinity in Excel, and have tried with 1e18 and 1e19 (since I haven’t found an Inf symbol). I then export this to a CSV file, and upon checking the resulting file in Notepad++, the numbers are represented correctly in the ASCI file.
I then import the file into Julia using CSV.read(). The results are:
1e18 → 1.0e18 (correct)
1e19 → 7.766279631452242e17 (incorrect)
Two questions:
Is there a good way to represent infinity in Excel (I know, I know – this is not an Excel group),
Is the bug in CSV.read() similar to interpreting 1e19 in the CSV file as 10^(19), which gives overflow? [Note: 7.76...e17 is different from what I get if I do 10^(19) in Julia…]
Hm… to answer my first question… If I type either of the text strings “Inf” or “inf” in the Excel cell, this appears as Inf in the csv-file, and is correctly interpreted as Float64 infinity in Julia.
So this solves my immediate problem. I am still worried about the problem to handle numbers larger than 1e18, though.
And here is the result of importing the content into Julia using CSV.read:
As you see, CSV.read() appears to handle Scientific number format correctly, but not Number format. [And from here, it seems like long numbers in the Number format are handled somewhat arbitrary… in my other example, 1e18 was handled correctly…
Of course, I can format cells with scientific notation as Scientific number format. But in many cases, my columns contain a mixture of small numbers and infinity (Thermodynamic tables), and it is inconvenient to use Scientific number for small numbers.
Okay I can replicate this when creating the same csv file. It seems the decimal points are throwing the read off, when removing them manually from the csv the numbers read in fine.