The default number of decimals seems to be 6 and I would need to get 8 decimals instead. Anyone knows if its possible?
The default number of decimals seems to be 6 and I would need to get 8 decimals instead. Anyone knows if its possible?
Understand you may only seeing them displayed as 6 decimals places, but the values are actually Doubles.
Another thing to note, is with just 6 decimal places, there is "GPS drift", where if you are stationary…
You tried multiplying by say 100 and then grabbing the last two digits?
Even while moving there is drift - it's just easier to see if you are stationary.
Try this and you get 8 digits:
System.println(info.timerTime + " " + loc[0].format("%12.8E") + " " + loc[1].format("%12.8E"));
You can also change…
Understand you may only seeing them displayed as 6 decimals places, but the values are actually Doubles.
Another thing to note, is with just 6 decimal places, there is "GPS drift", where if you are stationary, the last two decimal places will keep changing,
Yes, i noticed that they were Doubles but i did not succeed to convert to 8 decimals with the format option. Maybe im using the parameters wrong? How would you do to show 8 decimals instead of 6?
Yes, GPS drift can be an issue when walking really slow or standing still but my data field is mainly for running so it wouldnt have so much affect on that.
You tried multiplying by say 100 and then grabbing the last two digits?
Even while moving there is drift - it's just easier to see if you are stationary.
Multiplying with 100 seems to be a workaround to show the last 2 decimals but shouldn't it work with the format method? https://developer.garmin.com/connect-iq/api-docs/Toybox/Lang/Double.html#format-instance_function
I'm not so experienced with Monkey C so I'm having trouble to get it working. Will need to read up on how it works if not someone kind person can help me with the code for it
I'd actually forget about trying to use 8 digits. With watches, you can get the "drift" any time, even while running, as your own body can impact GPS, as far as blocking the sats, etc. You won't see the accuracy you expect.
Rounding also have impact on accuracy. And thats why i want to try with 8 decimals and compare the results with 6 decimals. Actually exported GPX files from Connect have 27 decimals but that is wayyy too many.
Try this and you get 8 digits:
System.println(info.timerTime +
" " + loc[0].format("%12.8E") +
" " + loc[1].format("%12.8E"));
You can also change the format("%16.12E") or something else.
Thanks! Will try that
Yes, that worked. It looks like the doubles for latitude and longitude contains 29 decimals but when using println it is limited to a rounded value of 6 decimals when printed as a double. When using the format method it converts to a string and then can show all decimals.
The 6 decimal digits are simply the default length of the output. If you want more or less digits, you should specify this with format().
I know this problem because I used to have it too.
Good luck for your further analysis.