News:

*NEW* Current Version on STEAM16.793

Webchat:
Visit the chat



sin

Previous topic - Next topic

FutureCow

I was trying to work out the difference between the values returned by the "sin" and "asin" commands (ie. the range the returned values would be in) as it wasn't clear to me from the documentation page.

The documentation page for sin says
Quote
Return 1000 x the sinus (cosinus / tangens) of an angle# in DEG-mode (0-360?), since GLBasic works with integers.
ASIN, ACOS and ATAN are available, too. They return the real angle of a value.

That suggests to me that if I get a calculator and do
(sin 31 ) * 1000
I should get a number between 0 and 360 (when truncated to 0 decimal places). Instead this returns "515". Shouldn't sin therefore be returning 100 * sin rather than 1000 * sin?

Also, the documentation says that the sin(x) command should return an integer, it returns a float. ie the code
"a=sin(31)"
Will result in a=0.515...

Because it's returning a float rather than an int, the supplied code in the manual that is supposed to make an "X" go around in a circle makes it move a whole 4 pixels.

I'm compiling on a Windows PC in case that makes a difference.

Kitty Hello

Old docs. Sorry. SIN returns the sinus of an angle in degrees.
sin(0)=0.0
sin(90)=1.0

FutureCow

No problem at all, just wanted to point it out!   =D