delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/06/06:45:44

From: johne AT parallax DOT co DOT uk (John Eccleston)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: sin & cos functions?
Date: Thu, 06 Mar 97 10:50:27 GMT
Organization: Parallax Solutions Ltd
Message-ID: <857645423.321128@red.parallax.co.uk>
References: <331E6B93 DOT 3B63 AT comports DOT com>
NNTP-Posting-Host: red.parallax.co.uk
Cache-Post-Path: red.parallax.co.uk!unknown AT parsnip DOT parallax DOT co DOT uk
Lines: 45
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <331E6B93 DOT 3B63 AT comports DOT com>, j AT comports DOT com wrote:
>Anyone got a library that defines sin (sine) and cos (cosine) functions?
>
>If so, please e-mail me the appropriate includes and source code.
>
>thanks,

Hi,

Try the standard C header math.h which defines quite a few trigonometric
and other functions.  Note that the trigonometric functions work on
radians not degrees!

e.g.:

-----> Cut Here <-----
#include <stdio.h>
#include <math.h>

float degreesToRadians(float angle)
{
   return angle * (PI / 180);
}

main()
{
   printf("Sin of 45: %f\n", sin(degreesToRadians(45))); 
}
-----> CUT HERE <-----

Hope that helps

John

________________________________________________________________
Parallax Solutions Ltd.   Tel.: 01203 514522
Stonecourt,               Fax.: 01203 514401
Siskin Drive,             Web : http://www.parallax.co.uk/~johne
Coventry CV3 4FJ          Mail: johne AT parallax DOT co DOT uk
________________________________________________________________
                         Remember:
 There is no such thing as computer error, it's 100% YOUR fault
________________________________________________________________


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019