Discuss Scratch
- Discussion Forums
- » Bugs and Glitches
- » Number is not what it appears to be. I don't know why.
- Mr-Glbstplwhttlgh
- Scratcher
19 posts
Number is not what it appears to be. I don't know why.
Gold is obviously the golden ratio.
Length of gold is the length of the variable Gold.
Round(gold) is Gold when it was rounded.
When I do anything with a* (*this) number with a large amount of decimal places it acts as if it were zero. Does anyone know why?
Any information you need will be given.
Last edited by Mr-Glbstplwhttlgh (Aug. 6, 2014 10:45:23)
FIND THE LINKAJXD Haavve ffuunn…
qS6MZ0EsoTi2YntsSsmscQDy27lzPVbkhDcftiWOgO1rZ3AmMxrU4tm8lLj3K9ZSFXYScW6qETDt8yTaRt2gQw7tY2Ei
BPiSutMX2CAHARldywapPvAa9ro83cI3l9oqzoyQ19phAXz9QgIm25pInXbreTE0vqRuRgfkBelkOj3IGExSM45VP3SrG
U9t9HnWhyOp5CLCnJ7bQbMDvVHvwXrFz6SitsMMFnX8IpfggrhCiObExQkC5RQhnZt3RTTJVQOtCbyNKe8wXAUyjbc
KE0KQFn52pfscMc5wXgVLVkvkV1XtCDXNlJXPYS8MVxgEOXbYubjqcpQtJLWyjW3ud34c3dMMQm6tZTxkpFUH6Aa
dIOf06x4XdIeK3OsL2XPlSD0oCvipwbFO1tv84fqdUfKLCZv3M148UKtZTBgVvKL0xbTnx7qFsQyTSZfXOEmvEJ2PsI0
DCMnDZbgzd5BGMIiLur9XV19A0Dzr8zuCdPEiUZsERhXHNwCcWO6wBJaOEyygFr1lONdpDA0BnzGnzFNsBzQF6e
WI5DNMIwiz03q6TIHP4TkhrLiC5xu4KG10wvEnq5knI8gnvPIvUswgq3XSvPx5eohEByRNtiJbgDbsmy9XRpomi47VS1U
Gosh this took a long time. Do you know HOW MUCH BBCODE THERE IS???
- TimothyLawyer
- Scratcher
1000+ posts
Number is not what it appears to be. I don't know why.
A “number” that long is going to be stored as string.
Scratch converts a string to the number 0 when a number is expected.
So, in this case,
Scratch converts a string to the number 0 when a number is expected.
So, in this case,
(round (long string of digits))is the same as
(round (0))The explanation here may help.
BeetleBlocks, WatercolorBot, and Turtle Art
Hover over a name or label to translate into current language
When Earth was… Purple?
☂️
- Mr-Glbstplwhttlgh
- Scratcher
19 posts
Number is not what it appears to be. I don't know why.
Set gold to((([sqrt v] of (5)) / (2)) + (0.5))It gives you the same number.
It calculates to only 15 digits.
FIND THE LINKAJXD Haavve ffuunn…
qS6MZ0EsoTi2YntsSsmscQDy27lzPVbkhDcftiWOgO1rZ3AmMxrU4tm8lLj3K9ZSFXYScW6qETDt8yTaRt2gQw7tY2Ei
BPiSutMX2CAHARldywapPvAa9ro83cI3l9oqzoyQ19phAXz9QgIm25pInXbreTE0vqRuRgfkBelkOj3IGExSM45VP3SrG
U9t9HnWhyOp5CLCnJ7bQbMDvVHvwXrFz6SitsMMFnX8IpfggrhCiObExQkC5RQhnZt3RTTJVQOtCbyNKe8wXAUyjbc
KE0KQFn52pfscMc5wXgVLVkvkV1XtCDXNlJXPYS8MVxgEOXbYubjqcpQtJLWyjW3ud34c3dMMQm6tZTxkpFUH6Aa
dIOf06x4XdIeK3OsL2XPlSD0oCvipwbFO1tv84fqdUfKLCZv3M148UKtZTBgVvKL0xbTnx7qFsQyTSZfXOEmvEJ2PsI0
DCMnDZbgzd5BGMIiLur9XV19A0Dzr8zuCdPEiUZsERhXHNwCcWO6wBJaOEyygFr1lONdpDA0BnzGnzFNsBzQF6e
WI5DNMIwiz03q6TIHP4TkhrLiC5xu4KG10wvEnq5knI8gnvPIvUswgq3XSvPx5eohEByRNtiJbgDbsmy9XRpomi47VS1U
Gosh this took a long time. Do you know HOW MUCH BBCODE THERE IS???
- TheHockeyist
- Scratcher
1000+ posts
Number is not what it appears to be. I don't know why.
Set gold to((([sqrt v] of (5)) / (2)) + (0.5))It gives you the same number.
It calculates to only 15 digits.
It's a limitation of Scratch. You cannot enter for example, 1/3 exactly (0.33333…). Scratch has to stop because it can only hold so many digits before it's forced to round.
Last edited by TheHockeyist (Aug. 7, 2014 12:45:57)
- 3sal2
- Scratcher
100+ posts
Number is not what it appears to be. I don't know why.
It assumes that it is a string because it has over 1900 decimals.
- Discussion Forums
- » Bugs and Glitches
- » Number is not what it appears to be. I don't know why.