Original sin()

This is a discussion on Original sin() within the C Programming forums, part of the General Programming Boards category; Hello, Does anyone know how the sin() function works, i.e. how it finds the sine of the input angle computationally?...

  1. #1
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,262

    Original sin()

    Hello,

    Does anyone know how the sin() function works, i.e. how it finds the sine of the input angle computationally?

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    I don't know for sure, and have nothing to back me up, but I'd bet it's a fairly simple lookup system, probably based on the repetitive nature of the unit circle.

  3. #3
    I like code Rouss's Avatar
    Join Date
    Apr 2004
    Posts
    131
    My guess would be that it uses the power series equivilant of sin(x)... I think I heard somewhere that's how a calculator finds it. But that's just a guess.

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    37
    Triangle ABC has three sides AB, BC and AC. If ABC is a right angle triangle, then Sin(A) = BC/AB ...(sin(x) = opposite / hypostenuse). There is only one hypotenuse so naturally, A != 90 degrees.
    Last edited by duvernais28; 02-22-2005 at 12:11 AM.

  5. #5
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,803
    Woop?

  6. #6
    Registered User
    Join Date
    Jan 2005
    Posts
    37
    Well, you could go that route if you're familiar with calculas but I think the basics still apply. It's been been too long since I've looked at that kind of Math...lol

    This should be sufficient.
    http://library.thinkquest.org/10030/2trigfu.htm
    Last edited by duvernais28; 02-22-2005 at 12:37 AM.

  7. #7
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,505
    Lookup tables
    Polynomial expansion
    Maths co-processor instruction

    All viable ways depending on your individual circumstances of the need for speed, accuracy and available processing power.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sine (Sin) Algorithm Help
    By StaticKyle in forum C Programming
    Replies: 52
    Last Post: 05-13-2008, 08:37 AM
  2. Sin Tables (and rotations)
    By Epo in forum Game Programming
    Replies: 15
    Last Post: 05-29-2005, 05:41 PM
  3. sin() and cos() that use degrees
    By dwks in forum C Programming
    Replies: 3
    Last Post: 05-14-2005, 04:29 PM
  4. sin() function problems.
    By Lifedragn in forum C Programming
    Replies: 4
    Last Post: 09-28-2004, 11:16 PM
  5. integral of 1/x
    By Silvercord in forum A Brief History of Cprogramming.com
    Replies: 43
    Last Post: 03-19-2004, 06:47 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21