I was setting an 'X' coordinate for a game i'm making and when I set one to '3.28', it set it to '3.2800000000000002'. Help?
Last edited by SpriteMaster (2011-06-12 10:05:25)
Offline
SpriteMaster wrote:
I was setting an 'X' coordinate for a game i'm making and when I set one to '3.82', it set it to '3.800000000000002'. Help?
Weird...do you have a project on the site showing this issue? I'd love to see it. And was it a sprite position or a variable?
I've seen a lot of cases where somebody tried to set a variable to, say, '3.8' and the displayed result was something like '3.799999999999999'. That's just a demonstration that computers can't exactly represent floating point numbers (numbers with a decimal point) so there is often a small amount of error. But what you are showing is a much bigger discrepancy.
Offline
Paddle2See wrote:
SpriteMaster wrote:
I was setting an 'X' coordinate for a game i'm making and when I set one to '3.82', it set it to '3.800000000000002'. Help?
Weird...do you have a project on the site showing this issue? I'd love to see it. And was it a sprite position or a variable?
I've seen a lot of cases where somebody tried to set a variable to, say, '3.8' and the displayed result was something like '3.799999999999999'. That's just a demonstration that computers can't exactly represent floating point numbers (numbers with a decimal point) so there is often a small amount of error. But what you are showing is a much bigger discrepancy.
It was a sprite position. I actually set it to 3.28, sorry. So, I set it to 3.28 and it made it 3.28000000002
Offline
It only happens with that number and I tried it with a bunch of other numbers.
Offline
Well 3.14 I get. I guess it's just another minor glitch we can't explain * shrug*
Offline