C++ help with math library

GEC: Discuss gaming, computers and electronics and venture into the bizarre world of STGODs.

Moderator: Thanas

Post Reply
User avatar
Sarevok
The Fearless One
Posts: 10681
Joined: 2002-12-24 07:29am
Location: The Covenants last and final line of defense

C++ help with math library

Post by Sarevok »

I can not seem to find a C++ function for inverse of sin, cosine and tan in the standard math library. Is there any libraries available on the web which provide such functions ?
User avatar
InnocentBystander
The Russian Circus
Posts: 3466
Joined: 2004-04-10 06:05am
Location: Just across the mighty Hudson

Post by InnocentBystander »

User avatar
Pu-239
Sith Marauder
Posts: 4727
Joined: 2002-10-21 08:44am
Location: Fake Virginia

Post by Pu-239 »

The values are returned in radians though, so you'll have to multiply by 180/pi .

ah.....the path to happiness is revision of dreams and not fulfillment... -SWPIGWANG
Sufficient Googling is indistinguishable from knowledge -somebody
Anything worth the cost of a missile, which can be located on the battlefield, will be shot at with missiles. If the US military is involved, then things, which are not worth the cost if a missile will also be shot at with missiles. -Sea Skimmer


George Bush makes freedom sound like a giant robot that breaks down a lot. -Darth Raptor
User avatar
phongn
Rebel Leader
Posts: 18487
Joined: 2002-07-03 11:11pm

Post by phongn »

Pu-239 wrote:The values are returned in radians though, so you'll have to multiply by 180/pi .
Only if you're working in degrees, though.
User avatar
Dooey Jo
Sith Devotee
Posts: 3127
Joined: 2002-08-09 01:09pm
Location: The land beyond the forest; Sweden.
Contact:

Post by Dooey Jo »

If you have trouble remembering the names for the inverse trigonometric functions in C/C++, you could try to learn the classic names for those functions, which are arcsine, arccosine and so on. That way, the names "atan" and "asin" actually makes some sense, which should make them easier to remember...
Image
"Nippon ichi, bitches! Boing-boing."
Mai smote the demonic fires of heck...

Faker Ninjas invented ninjitsu
User avatar
Durandal
Bile-Driven Hate Machine
Posts: 17927
Joined: 2002-07-03 06:26pm
Location: Silicon Valley, CA
Contact:

Re: C++ help with math library

Post by Durandal »

The Shadow wrote:I can not seem to find a C++ function for inverse of sin, cosine and tan in the standard math library. Is there any libraries available on the web which provide such functions ?
Use cmath.
Damien Sorresso

"Ever see what them computa bitchez do to numbas? It ain't natural. Numbas ain't supposed to be code, they supposed to quantify shit."
- The Onion
User avatar
Sarevok
The Fearless One
Posts: 10681
Joined: 2002-12-24 07:29am
Location: The Covenants last and final line of defense

Post by Sarevok »

Dooey Jo wrote:If you have trouble remembering the names for the inverse trigonometric functions in C/C++, you could try to learn the classic names for those functions, which are arcsine, arccosine and so on. That way, the names "atan" and "asin" actually makes some sense, which should make them easier to remember...
Arcsine, arccosine and arctangent are still couple of months away from being taught at school. So I never realised the answer was right below my nose ! I wrote a sample program using atan and it worked exactly as I wanted. Thanks !
Post Reply