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 1:32

IT IS IN RADIANS, YOU FUCKHEAD

Name: Anonymous 2006-09-04 1:40

P.S. Use
#define DEG2RAD .01745329251994329577f
then do
result1 = cos(direction*DEG2RAD);
result2 = sin(direction*DEG2RAD);
for max performance

Name: Anonymous 2006-09-04 2:16

First of all, you left the c out of the first cout.

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.

Name: Anonymous 2006-09-04 3:49 (sage)

>>5 is still sucking on his mother's breasts, please forgive him.

Name: Anonymous 2006-09-04 4:05

>>5
Don't count on the compiler optimizing anything for you.

Name: Anonymous 2006-09-04 4:45

>>7
True.dat, even though today's C/C++ compilers are almost self-conscious.

Name: Anonymous 2006-09-04 12:22

>>5
how old are you not to know what radians are? unless you've never been to school, you're too dumb to write C++ code.

Name: Anonymous 2006-09-04 12:49

>>5
You might be a horrible programmer if you think the RAD mode on your calculator makes it do extreme skater tricks.

Name: Anonymous 2006-09-04 13:24

result1 = cos(direction*=DEG2RAD);
result2 = sin(direction);
for max performance
fixed

Name: Anonymous 2006-09-04 15:32

>>11
stfu

Name: Anonymous 2006-09-05 1:49

There's no way OP is over 18.

Name: Anonymous 2006-09-05 3:09

This is like the Price is Right.

There's no way the OP is over 14, Bob.

Name: Anonymous 2006-09-05 9:55

>>14
NO ZERO. DO I WIN??

Name: Anonymous 2006-09-05 16:48

>>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: Anonymous 2006-09-05 16:48

19btw

Name: Anonymous 2006-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: Anonymous 2006-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: Anonymous 2006-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: Anonymous 2006-09-05 20:15

Also, what I'm writing is going to be basically like cave story.  I seriously doubt it took calculus.

Name: Anonymous 2006-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: Anonymous 2006-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: Anonymous 2006-09-05 20:39

BTW, thanks for the help, those who did, even if it turned out I didn't really need it.

Name: Anonymous 2006-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: Anonymous 2006-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.

Name: Anonymous 2006-09-05 21:05

You dumb

Name: Anonymous 2006-09-05 21:43

Me smert

Name: Anonymous 2006-09-05 22:38

>>28
no u dumb

Name: Anonymous 2006-09-06 0:38 (sage)

>>25
>>26
Not every school is the same.

Name: Anonymous 2006-09-06 1:08

>>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: Anonymous 2006-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: Anonymous 2006-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: Anonymous 2006-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!

Name: Anonymous 2006-09-06 4:06 (sage)

>>33
AP doesn't count for shit. lol nerds

Name: Anonymous 2006-09-07 4:00

I went to (debatably) THE top school in Australia and they taught us about radians. Worked it out on my own before then though.

BLITHESOME OUR HEARTS ARE AND FREE IS OUR FANCY

Name: Anonymous 2006-09-07 4:26

>>36
asstralia is gay

Name: Anonymous 2006-09-07 7:12

Name: Anonymous 2006-09-07 9:17 (sage)

>>38 is homophobic.

Name: Anonymous 2006-09-07 10:48

>>38 is homofag

Name: Anonymous 2006-09-07 19:55

>>38 is gaybicfag

Name: Anonymous 2006-09-08 1:11

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: Anonymous 2006-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: Anonymous 2006-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: Anonymous 2006-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.

Name: Anonymous 2006-09-09 1:08

I thought >>38 said homophones...

Name: Anonymous 2006-09-09 1:08

>>43
You obviously come from a math family.  I didn't.

Name: Anonymous 2006-09-09 1:09

>>43
You obviously come from a math family.  I didn't.

Name: Anonymous 2006-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: Anonymous 2006-09-09 1:27

>>49
You're still fucking stupid, and don't belong in programming.  STFU.

Name: Anonymous 2006-09-09 8:26

>>49
Your logic is retarded. Maths is easy.

Name: Anonymous 2006-09-09 9:35

>>1-51
You obviously come from a negro family.  I didn't.

Name: Anonymous 2006-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: Anonymous 2006-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.

Name: Anonymous 2006-09-09 19:25

>>54
Awesome

Name: Eclipz 2006-09-09 20:39

Your inputs need to be in radians, not degrees.  To get radians from degrees, multiply by (pi / 180)

Name: Anonymous 2006-09-09 23:41 (sage)

>>56
A bit late, aren't we

Name: Anonymous 2006-09-10 5:34

>>56
Civility and goodwill has finally arrived on 4chan.

Name: Anonymous 2006-09-10 7:17

I SEE WHITE PEOPLE

Name: Anonymous 2006-09-10 11:48

>>56
>>58

Read >>2 and >>3 retards.

Name: Anonymous 2007-06-16 14:30 ID:YHMLKCC0

I went to a random argentine school and I learnt radians.

Name: Anonymous 2007-06-16 14:38 ID:OcIVEwco

hay guys do u hav any free radiens??

Name: Anonymous 2007-06-16 14:43 ID:cKlQ0z/E

Oh lawd the time before IDs.

Name: Anonymous 2007-06-16 20:48 ID:rRdAJbne

dude, raiden kicks ass, hes so much better than johnny cage

Name: Anonymous 2007-06-16 21:18 ID:ZvYB0Acc

lol, shame amerifags.

no real man uses degrees, radians über alles

Name: Anonymous 2007-06-16 21:19 ID:Heaven

using radians is just irrational.

Name: Anonymous 2007-06-16 22:47 ID:rcjWueUl

>>33 confuses his school's  bullshitting with his own accomplishments.

AP MEANS NOTHING. YOUR SCHOOL MEANS NOTHING. RAMANUJAN COULD ROCK ALL YOUR ASSES, AND HE WAS NEVER EDUCATED.

Also underage b&.

Name: Anonymous 2007-06-16 22:49 ID:rcjWueUl

>>61

I went to a randomly-generated argentine school and I learned radians.

Name: Anonymous 2007-06-17 0:29 ID:1ZsPuRWL

>>63
GOTO : I am an expert programmer

ALSO, OP is a retard

Name: Anonymous 2007-06-17 0:35 ID:Heaven

You guys realize this almost a year old, right? Sage this shit

Name: Anonymous 2007-06-17 0:55 ID:1ZsPuRWL

no

Name: Anonymous 2007-06-17 0:57 ID:y4IByiHn

ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉ӧ҉

Name: Anonymous 2007-06-17 3:12 ID:Heaven

jesus christ, this thread makes me not regret killing all those fucking nerds for being complete shitheads.

Name: Anonymous 2007-06-17 6:37 ID:G7AcWG0+

lulz I remember this thread

Name: Anonymous 2007-06-17 6:52 ID:zo01VT92

>>74 haha me too. Epic.

Name: Anonymous 2007-06-17 8:03 ID:top/WWTh

[҉]҉҉҉҉҉҉҉҉҉҉҉҉҉҉҉҉҉҉҉҉҉[/҉]

Name: Anonymous 2007-06-17 12:42 ID:Hj3lAGQ8

>>72,76
EXPERT UNICODE PROGRAMMERS

Name: Anonymous 2007-06-17 13:00 ID:BbWBqdH+

>>77
Too bad Unicode is not Touring-complete... or is it?

Name: Anonymous 2007-06-17 15:40 ID:1ZsPuRWL

UTF-32 and UTF-8 are touring-complete, UTF-16 is not

Name: Anonymous 2007-06-17 15:42 ID:/Sa/dbn1

>>79
at least give some fucking argument why, can you show the equivalence to lambda calculus?

Name: Anonymous 2007-06-17 15:59 ID:JRFp/3Pt

>>80
How would that help? Lambda calculus isn't Touring-complete...

Name: Anonymous 2007-06-17 16:16 ID:xZmPCb0K

what was extremely weird was all the people coming out of the woodwork to defend the OP...

Name: Anonymous 2009-01-14 12:49

LISP

Name: Anonymous 2009-01-14 12:50

SUPER GAY, THE CRIME-FIGHTING HOMOSeXUAL TO THE RESCUE

Name: Anonymous 2009-03-06 13:15

The EXECUTABLE THE ANTIVIRUS SAYS ITS A   shame it has   made sure there   are many ways   to fit in   a datagram The.

Name: Anonymous 2010-06-27 12:57

ur gay

Name: Anonymous 2010-06-27 13:52

my homework is to read the first chapter of SICP: Can someone do that for me please so I don't have to??

Name: Anonymous 2010-08-13 18:42

hallo
that
im
i
vb
vb
i

Name: Anonymous 2010-08-13 18:43

hallo[sic]
that[sic]
im[sic]
i[sic]
vb[sic]
vb[sic]
i[sic]

Name: ​​​​​​​​​​ 2010-10-24 3:46

Name: Sgt.Kabuꐋ袁kiman㷛钦 2012-05-28 20:24

Bringing /prog/ back to its people

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