Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

sin() and cos()... wtf? (c++)

Name: Anonymous 2006-09-04 0:32

Check this out:

double direction, length, result1, result2;
out << "direction?\n";
cin >> direction;
result1 = cos(direction);
result2 = sin(direction);
cout << result1 << "\n";
cout << result2 << "\n";
This code is fucked up, because when I enter 45, it should return the same value (.70786 or something similar).  Instead, I get:

0.525322 (cos)
0.850904 (sin)

It's almost like the C++ library is fucked up or something.  I know I haven't forgotten basic geometry (windows calculator bears this out) and I don't think I'm going insane, so WHAT AM I DOING WRONG?

Name: Anonymous 2006-09-04 3:11

>>3
Yeah, I found it out after about 30 minutes of research...  Never even fucking heard of radians...

Doesn't the compiler like, optimize it to the same assembly, even if I just make it a straight up global variable (It's const'd, but still)?

Not an experienced programmer, don't claim to be, so spare the "STFU HOW COULD YOU NOT FUCKING KNOW THIS?" shit.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List