Discuss Scratch
- Discussion Forums
- » Bugs and Glitches
- » Math is slightly off, causes bugs in my program
- IanSan5653
- Scratcher
40 posts
Math is slightly off, causes bugs in my program
This project takes two variables and a list of x-coordinates to calculate and graph exponential change using the formula AB^x. The problem is that the math is always slightly off. When you use, for example, 2 for A and 2 for B and look at number 14 on the list, it's off by about 0.0000000000001. I know that I can round this, but I can see it causing serious problems, even with the difference so small.
Last edited by IanSan5653 (March 8, 2013 22:45:01)
- TimothyLawyer
- Scratcher
1000+ posts
Math is slightly off, causes bugs in my program
BallMonsterD is experiencing a similar problem in this post.
It appears something strange is happening when a number gets put in a list.
It appears something strange is happening when a number gets put in a list.
BeetleBlocks, WatercolorBot, and Turtle Art
Hover over a name or label to translate into current language
When Earth was… Purple?
☂️
- TimothyLawyer
- Scratcher
1000+ posts
Math is slightly off, causes bugs in my program
Bump.
BeetleBlocks, WatercolorBot, and Turtle Art
Hover over a name or label to translate into current language
When Earth was… Purple?
☂️
- botcrusher
- Scratcher
500+ posts
Math is slightly off, causes bugs in my program
I noticed this when creating a physics engine it kept getting a magic number of -0.01 causing undesired backwards movment i had to make it so that when the value was between a certain value it set it to zero instead
Pondering what to work on.
- Lightnin
- Scratcher
1000+ posts
Math is slightly off, causes bugs in my program
Ah, this may be due to the way computers do math.
It's called “Floating point error.”
And it has at times resulted in the destruction of gigantic rockets. Here's an explanation:
http://www.techradar.com/news/computing/why-computers-suck-at-maths-644771?artc_pg=1
It's called “Floating point error.”
And it has at times resulted in the destruction of gigantic rockets. Here's an explanation:
http://www.techradar.com/news/computing/why-computers-suck-at-maths-644771?artc_pg=1
- Urania2
- Scratcher
25 posts
Math is slightly off, causes bugs in my program
Excuse me, all knowing and all seeing awesome Scratch Team Member Lightnin-
Don't members of the Scratch Team have an asterik* after their username to show their ultimately superior powers???
I'm very sorry to bother and interrupt your critically important work…
Don't members of the Scratch Team have an asterik* after their username to show their ultimately superior powers???
I'm very sorry to bother and interrupt your critically important work…
- IanSan5653
- Scratcher
40 posts
Math is slightly off, causes bugs in my program
Wow…I had no idea computers were like that. Wierd. Ah, this may be due to the way computers do math.
It's called “Floating point error.”
And it has at times resulted in the destruction of gigantic rockets. Here's an explanation:
http://www.techradar.com/news/computing/why-computers-suck-at-maths-644771?artc_pg=1
- drmcw
- Scratcher
1000+ posts
Math is slightly off, causes bugs in my program
Wow…I had no idea computers were like that. Wierd. Ah, this may be due to the way computers do math.
It's called “Floating point error.”
And it has at times resulted in the destruction of gigantic rockets. Here's an explanation:
http://www.techradar.com/news/computing/why-computers-suck-at-maths-644771?artc_pg=1
If you've ever calculated the area or circumference of a circle you'd've done it too. What value did you use for pi?
- SFollis
- Scratcher
500+ posts
Math is slightly off, causes bugs in my program
i use 3.1415926535…Wow…I had no idea computers were like that. Wierd. Ah, this may be due to the way computers do math.
It's called “Floating point error.”
And it has at times resulted in the destruction of gigantic rockets. Here's an explanation:
http://www.techradar.com/news/computing/why-computers-suck-at-maths-644771?artc_pg=1
If you've ever calculated the area or circumference of a circle you'd've done it too. What value did you use for pi?
- botcrusher
- Scratcher
500+ posts
Math is slightly off, causes bugs in my program
Ah, this may be due to the way computers do math.
It's called “Floating point error.”
And it has at times resulted in the destruction of gigantic rockets. Here's an explanation:
http://www.techradar.com/news/computing/why-computers-suck-at-maths-644771?artc_pg=1
O.o
that explains alot
what will happen when we start using 128-bit computers? will this fix certain calculations, as the avalible bits for storing data increases?
then again those big rockets had less power than a flip phone
Last edited by botcrusher (March 13, 2013 23:50:09)
Pondering what to work on.
- Lightnin
- Scratcher
1000+ posts
Math is slightly off, causes bugs in my program
I asked JohnM about this and he says we can do a fix that should compensate for this (at least in low precision settings, like the demo project that was made to show this error.)
Hope to have it sorted in the next couple of weeks. Thanks for reporting!
Hope to have it sorted in the next couple of weeks. Thanks for reporting!
- Discussion Forums
- » Bugs and Glitches
- » Math is slightly off, causes bugs in my program