Thread: sin and cos

  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    5

    sin and cos

    Hi. This is a very simple question;
    I'm was making some rotation functions when I realized that sin() and cos() worked with Radians. Is there anyway to get it to work with degrees? I'm much more used to it.
    If there isn't a way, can anyone give me the convertion formula from Rad to Deg?

    Thanks.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    180 degress == PI radians

    so
    radians = degrees / 180 * PI
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User Micko's Avatar
    Join Date
    Nov 2003
    Posts
    715
    It would be good to write your own convert functions torad and todeg in which you can use formula:

    rad=deg/180*PI
    (deg=rad*180/PI)

    and call for example

    sin(torad(90));
    where 90 is angle in Deg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with cos, sin fuctions
    By xxxhunter in forum C Programming
    Replies: 7
    Last Post: 11-16-2007, 03:33 AM
  2. Help with cos, sin and tan^-1 (arctan);
    By xIcyx in forum C Programming
    Replies: 15
    Last Post: 04-23-2007, 09:14 AM
  3. Help creating function of sin cos and tan
    By Niz in forum C Programming
    Replies: 12
    Last Post: 01-09-2007, 05:55 PM
  4. sin() and cos() that use degrees
    By dwks in forum C Programming
    Replies: 3
    Last Post: 05-14-2005, 04:29 PM
  5. integral of 1/x
    By Silvercord in forum A Brief History of Cprogramming.com
    Replies: 43
    Last Post: 03-19-2004, 07:47 AM