This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-06-12 09:56:41

SpriteMaster
Scratcher
Registered: 2009-01-25
Posts: 1000+

3.800000000000000002

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)


`                        Click here for my YouTube channel!                        `http://i.imgur.com/4Qz3I.jpg

Offline

 

#2 2011-06-12 10:01:03

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: 3.800000000000000002

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.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#3 2011-06-12 10:05:03

SpriteMaster
Scratcher
Registered: 2009-01-25
Posts: 1000+

Re: 3.800000000000000002

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


`                        Click here for my YouTube channel!                        `http://i.imgur.com/4Qz3I.jpg

Offline

 

#4 2011-06-19 10:16:18

SpriteMaster
Scratcher
Registered: 2009-01-25
Posts: 1000+

Re: 3.800000000000000002

It only happens with that number and I tried it with a bunch of other numbers.


`                        Click here for my YouTube channel!                        `http://i.imgur.com/4Qz3I.jpg

Offline

 

#5 2011-06-19 17:08:11

MarioLuigi2009
Scratcher
Registered: 2009-12-26
Posts: 63

Re: 3.800000000000000002

It also happens with a few others. Like 2.54 and 3.14 (i think).


http://mag.racked.eu/mcimage/i349/Achievement++get%21/Slammin+Salmon/mca.pnghttp://mag.racked.eu/mcimage/i5007/Achievement++get%21/Smile+for+the+camera/mca.pnghttp://mag.racked.eu/mcimage/i54/Achievement++get%21/Storin+dirt.../mca.pnghttp://www.minecraftanonymous.com/assets/banners/banner_78.png

Offline

 

#6 2011-06-21 15:04:09

SpriteMaster
Scratcher
Registered: 2009-01-25
Posts: 1000+

Re: 3.800000000000000002

Well 3.14 I get. I guess it's just another minor glitch we can't explain * shrug*


`                        Click here for my YouTube channel!                        `http://i.imgur.com/4Qz3I.jpg

Offline

 

Board footer