ID:1380398
 
(See the best response by Kaiochao.)
Can anyone tell me why this:
sin(360)

returns -2.44921e-016?

However:
sin(0)

returns 0?
To add on to this:
cos(180)

Returns exactly -1.

Seeing as cos() would be used to grab an x value, it clearly should not be returning -1 for an angle of 180.

EDIT: After thinking about this, I realized that the angles may be starting at what I assume as 90 degrees - I thought that maybe 0 degrees is actually representing EAST. I checked into this with an online calculator and tried cos(90), and I got 0. This made me think that I was right and that was why I was getting this stuff wrong, but when I asked DM to tell me what cos(90) was, it told me this:
6.12303e-017

So can I just not work with angles or what?

EDIT2: After looking in F1, I see that even the cos() proc has this example in its entry:
mob/verb/test()
usr << cos(0) //1
usr << cos(45) //0.707...
usr << cos(90) //0

So I'm starting to think that maybe this is a bug.
In response to Albro1
Best response
You do realize that -2.44921e-016 is an incredibly small number?

Looks kinda like this:
-0.0000000000000000244921

It's effectively 0 and isn't because of floating point accuracy.

cos(180) is definitely -1. Angles for cos() and sin() start at 0 = EAST and increase counter-clockwise.
Counter-clockwise? Huh. So that's what I was doing wrong. Thanks!


unit circle pls albro
In response to Super Saiyan X
Super Saiyan X wrote:


unit circle pls albro

Is it bad that I find this image beautiful?