I'm trying to write csv using go language, but
For some reason, I'm asking you to write in float instead of string.
There is a white function in the csv package, but the argument must be a slice of string, and the contents of the written csv will also be string.
Is there any good way?
go csv
Since CSV is a "text file" called Comma Separated Values,
Convert float
to a string and write
Read while converting the string to float
I guess there's nothing for it.
It's hard for readers to understand the meaning of "as it is", but
By any chance, do you want the internal expression of float
to be written in hexadecimal and put into CSV format?
https://ja.wikipedia.org/wiki/%E5%8D%98%E7%B2%BE%E5%BA%A6%E6%B5%AE%E5%8B%95%E5%B0%8F%E6%95%B0%E7%82%B9%E6%95%B0
According to
, for example,
+1.0
is 3F8000
-2.0
is C00000
Therefore, 3F800000, C0000000,
is available as CSV format text.
(I don't know if there's a tool to read that CSV in floating-point format.)
© 2024 OneMinuteCode. All rights reserved.