Thread: Original sin()

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

    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
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    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 01:11 AM.

  5. #5
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    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 01:37 AM.

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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.

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, 07:47 AM