• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Android Integers being rounded? Need complete accuracy.

P

Pamela Howard

Guest
I'm working with coordinates. They return perfectly, but when converted to a string they are rounded to 2 decimal places instead of the 6 that were returned. This is very close to my house but not close enough. the NN.nnnnnn that returned was on my house, in the correct room. NN.nn is up a hill 3 blocks away. I can't give out my co-ords for safety and privacy reasons but I'd like some advice on how to solve this.
 

jazzzar

Member
Hello, if you've read the manual it clearly says :
"With this function you can turn any real number into a string. If the real number is an integer, it will be saved with no decimal places, otherwise, it will be saved with two decimal places."
in the description of string(val) function,
you should use
string_format(val, tot, dec);
look it up in the manual, i'm pretty sure you'll understand how it works ;)
 
Top