I've created a simple script that uses the sine function to draw a triangle. That works beautifully. However, I need more detail in the output.
Is there a way to increase the number of digits displayed by a variable?
How many digits does the sine function output given a whole angle input?
Thanks, Chris
[scratch blocks]
when gf clicked
clear
set angle to 0
set sine to 0
set opposite to 0
hide
ask (What is the angle?) and wait
set angle to answer
set sprite3x to cos(angle) * 250
Offline
clindberg wrote:
I've created a simple script that uses the sine function to draw a triangle. That works beautifully. However, I need more detail in the output.
Is there a way to increase the number of digits displayed by a variable?
How many digits does the sine function output given a whole angle input?
Thanks, Chriswhen gf clicked clear set [angle v] to 0 set [sine v] to 0 set [opposite v] to 0 hide ask [What is the angle?] and wait set [angle v] to (answer) set [sprite3x v] to ([cos v] of ((angle) * (250)))
Fixing your scratchblocks.... please give a moment.
Assuming this is what you mean?
Last edited by Firedrake969 (2013-02-04 19:28:17)
Offline
Firedrake969 wrote:
clindberg wrote:
I've created a simple script that uses the sine function to draw a triangle. That works beautifully. However, I need more detail in the output.
Is there a way to increase the number of digits displayed by a variable?
How many digits does the sine function output given a whole angle input?
Thanks, Chriswhen gf clicked clear set [angle v] to [0] set [sine v] to [0] set [opposite v] to [0] hide ask [What is the angle?] and wait set [angle v] to (answer) set [sprite3x v] to ([cos v] of ((angle) * (250)))Fixing your scratchblocks.... please give a moment.
Assuming this is what you mean?
There, that should fix it. Is this what you mean?
Offline
clindberg wrote:
I've created a simple script that uses the sine function to draw a triangle. That works beautifully. However, I need more detail in the output.
Is there a way to increase the number of digits displayed by a variable?
How many digits does the sine function output given a whole angle input?
You've touched upon one of the "magical" issues with Scratch.
We don't have precision setting for numeric output.
We also cannot specify a location for output.
I've seen everything from 3 to 15 digit mantissas so there's some floating-point library fun behind the scenes and displayed variables have a tendency to stack in a column along the left-hand side of the screen even after they've been saved in other positions.
Offline