We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi,
I'm using processing to read in GPS data from a wireless sensor, over serial. I'm finding that converting the float to a string and then displaying it is leading to a loss of precision that is unacceptable for precise GPS. In fact, just printing a long float in Processing, or displaying it as text also causes truncation:
println(float("41.312320709"));
println(41.312320709);
in both cases the output is 41.31232, so the '0709' at the end has been lost. Though the conversion may actually be converting the data to the correct precision, it's very hard to work with the truncated values.
I've also tried Float.valueOf(f2_str).floatValue();
and Float.parseFloat(f2_str);
but when I println I get the same results.
I've checked the print reference but can't find an alternative format or explanation on why it is limited to a certain number of characters.
Any help appreciated.
Answers
You might need a double.
Awesome! Thanks a bunch!