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:
Anonymous2006-09-04 1:32
IT IS IN RADIANS, YOU FUCKHEAD
Name:
Anonymous2006-09-04 1:40
P.S. Use
#define DEG2RAD .01745329251994329577f
then do
result1 = cos(direction*DEG2RAD);
result2 = sin(direction*DEG2RAD);
for max performance
Name:
Anonymous2006-09-04 2:16
First of all, you left the c out of the first cout.
Name:
Anonymous2006-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.
>>9
not a math guy. Never went above geometry in highschool. It just didn't interest me.
Now I got into indie games, and so, surprise, it does interest me.
Name:
Anonymous2006-09-05 16:48
19btw
Name:
Anonymous2006-09-05 17:12
>>16
Uh, you should have learned about radians in high school geometry. Not to mention good luck working on "indie games" with that level of math knowledge, since even rudimentary physics will require at least a basic grasp of calculus.
Name:
Anonymous2006-09-05 18:35
Not to mention vector and matrix maths, plus all the graph algorithms from discrete maths. If you don't have a head for maths you're pretty much fucked as a programmer. The best you'll be able to do is PHP shitware, or maybe ZOMG ENTERPRISE software. Games? Not gonna happen.
Name:
Anonymous2006-09-05 20:12
>>18
Why? If I can know the formulas, I can easily convert them into code. I didn't say that I wasn't good at math, just that I don't enjoy it.
Name:
Anonymous2006-09-05 20:15
Also, what I'm writing is going to be basically like cave story. I seriously doubt it took calculus.
Name:
Anonymous2006-09-05 20:26
All of you 40-year-old faggots think that schools are still as good as they were before. I'm 18, and despite taking most of the higher-level classes and having a good memory, I never learned about radians, much less any calculus. The schools teach you nothing anymore. I know for a fact that if I had just bought all my high school textbooks and read through them in two or three weeks, I'd learn more than I would going to school, as many of my teachers couldn't even teach half of their books because schools and classes are so large and bloated and full of semi-retarded children.
Name:
Anonymous2006-09-05 20:37
>>22
Heh, yeah... I now know more about geometry than I ever learned in school, just from typing stuff like "how to tell the angle of a line from two points" into google. (I later found out you have to treat the points as ends of a right triangle with the origin, but still).
I can learn everything I need to know from the information that's out there, and from posting shit in places like here. I only posted this because the problem I had didn't immediately reveal itself to solutions.
The point is that I'll learn about 100x more if I give a shit than if I don't.
Name:
Anonymous2006-09-05 20:39
BTW, thanks for the help, those who did, even if it turned out I didn't really need it.
Name:
Anonymous2006-09-05 20:39
>>22
I'm 20, finished public high school in the US two years ago and took: geometry, precalc, calc 1, calc 2, calc 3, linear algebra (the previous four being one semester each). Stop blaming the schools for your personal mediocrity.
Name:
Anonymous2006-09-05 20:48
Second on the stop blaming schools. I took finished calc 1 in hs. And I could easily have finished all of >>25 in college first year.
>>30
Not every school offers higher math classes, but if you make it through high school without learning about radians it is your own fault.
Name:
Anonymous2006-09-06 2:39
(Note: I'm not >>1->>31.) Most I use, I learnt it on my own. School stuff were either botched with low-quality teachers and bloated classes with morons in them, or long forgotten because I was always half asleep, fucking boredom. Then I began self-teaching me everything I needed and everything I felt curiosity for, including advanced Maths.
Name:
Anonymous2006-09-06 2:44
>>31
I went to one of THE top-rated public schools in America (based on amount of AP and higher level classes offered) and I didn't learn any of this shit. I got straight A's but had to stop right before AP Calculus because of bullshit caused by a school I moved from. However, the people who did take that AP class said it was one of the easiest they took, and that they didn't learn SHIT. And I know why : every single school I've been to, rural, urban, middle of nowhere, middle of downtown, have always been WAY too fucking crowded. Because of the education funding cuts in the last few years, undertrained teachers are left to teach VERY crowded classes, with half of the teachers not even having their own rooms in some cases, and as a result, everyone suffers. Many schools do NOT effectively teach higher level math classes, and as such many students do not learn concepts fundamental to others' understanding of math.
Name:
Anonymous2006-09-06 3:22
>>33
I went to something like THE 700th place public school in America and it offered a wider range of classes and apparently had better teachers than one of THE top-rated public schools. Crazy!
FACE IT, AMERICA'S SCHOOL SYSTEMS ARE SUFFERING BECAUSE THE GOVERNMENT KNOWS YOU DON'T HAVE TO BE SMART TO SHOOT "SAND NIGGERS", AND THEY'LL WASTE MONEY IF THEY TRY TO TEACH YOU, CAUSE YOU'LL JUST GET SPLATTERED OR GET UPPITY DUE TO YOUR INTELLIGENCE ANYWAY.
Name:
Anonymous2006-09-08 2:25
So like. People are actually bragging about knowing radians?
My son, 9 years old, knows the difference between a degree and a radian. And he just tried to use a fork to open a can of corn. This states his level of intelligence.
Name:
Anonymous2006-09-08 4:23
>>43 he just tried to use a fork to open a can of corn
An awesome idea! Gotta try that when I get home, thanks for the tip! I never knew how to open those damned cans.
Name:
Anonymous2006-09-08 8:20
>>43
No, we're mocking the OP for not knowing about radians, because they're such a basic and essential concept.
>>43
You obviously come from a math family. I didn't.
Name:
Anonymous2006-09-09 1:09
>>43
You obviously come from a math family. I didn't.
Name:
Anonymous2006-09-09 1:12
People always assume that everyone is exactly like them, and make all their judgements based on themselves. Programmers, Mathmaticians, people interested in extremely analytical stuff tend to do that. I don't know why.
Name:
Anonymous2006-09-09 1:27
>>49
You're still fucking stupid, and don't belong in programming. STFU.
>>1-51
You obviously come from a negro family. I didn't.
Name:
Anonymous2006-09-09 13:46
Yes. I'm a C programmer. So? I don't see a problem. I embraced my UNIX soul long ago and I am happy together with my compiler (who is a cute layered front/backend design!). We have a fucking lot of functions in and outside of the kernel and I am pretty compact and resource conserving.
But thanks anyway asshole. Go and beat off to your stupid garbage collection shit while I #INCLUDE <stdio.h> with my preprocessor.
Name:
Anonymous2006-09-09 14:44
Yes. I'm an assembly programmer. So? I don't see a problem. I embraced my mnemonics long ago and I am happy together with my assembler (which allows macros - who needs functions?). We have a fucking lot of documentations of ABIs in and outside of the kernel and I can do anything I want as long as I build it from the ground up.
But thanks anyway asshole. Go and beat off to your stupid libc while I constantly reinvent the wheel.