Why is it that when do:
34.134495 - 34.134494
I get 1.0000000045807e-06 instead of 0.000001 ?
I’m working with latitude and longitude and I need the actual decimal…
Why is it that when do:
34.134495 - 34.134494
I get 1.0000000045807e-06 instead of 0.000001 ?
I’m working with latitude and longitude and I need the actual decimal…
A thread that explains it: https://forums.coronalabs.com/topic/19330-how-to-preserve-decimals-when-doing-divisons-with-very-large-numbers/
Good libraries:
lbc http://webserver2.tecgraf.puc-rio.br/~lhf/ftp/lua/#lbc
Some more information with an answer from the creator of Lua:
Best regards,
Tomas
without getting into the nitty gritty of the limits of floating point representation and significant digits and so on …
the two answers you got are equivalent, so that IS the “actual decimal” you’re looking for
or, at least, it’s as good as double-precision floats can do. (given the 8-digit precision of input values you probably don’t need apm, you just need to ignore the non-significant digits in output values)
if instead what you’re asking is to format it for print without scientific notation then use string.format()
string.format() – thank you!
A thread that explains it: https://forums.coronalabs.com/topic/19330-how-to-preserve-decimals-when-doing-divisons-with-very-large-numbers/
Good libraries:
lbc http://webserver2.tecgraf.puc-rio.br/~lhf/ftp/lua/#lbc
Some more information with an answer from the creator of Lua:
Best regards,
Tomas
without getting into the nitty gritty of the limits of floating point representation and significant digits and so on …
the two answers you got are equivalent, so that IS the “actual decimal” you’re looking for
or, at least, it’s as good as double-precision floats can do. (given the 8-digit precision of input values you probably don’t need apm, you just need to ignore the non-significant digits in output values)
if instead what you’re asking is to format it for print without scientific notation then use string.format()
string.format() – thank you!