From: pv AT cs DOT montana DOT edu (Paul Peavyhouse) Newsgroups: comp.os.msdos.djgpp Subject: Re: sin & cos functions? Date: Wed, 12 Mar 97 19:26:51 GMT Organization: Montana State University Lines: 48 Message-ID: <5g7oms$abl@netra.montana.edu> References: <331E6B93 DOT 3B63 AT comports DOT com> <857645423 DOT 321128 AT red DOT parallax DOT co DOT uk> NNTP-Posting-Host: esus.cs.montana.edu To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <857645423 DOT 321128 AT red DOT parallax DOT co DOT uk>, johne AT parallax DOT co DOT uk (John Eccleston) wrote: >In article <331E6B93 DOT 3B63 AT comports DOT com>, j AT comports DOT com wrote: >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! > >-----> Cut Here <----- >#include >#include > >float degreesToRadians(float angle) >{ > return angle * (PI / 180); >} > >main() >{ > printf("Sin of 45: %f\n", sin(degreesToRadians(45))); >} >-----> CUT HERE <----- Don't get me wrong, I'm not ragging anyone, nor their code, but from one fellow programmer to another, why did you choose to not write the above code as: #include #include #define RAD(deg) ( ( deg ) * ( 2 * M_PI ) / 360.0 ) main() { printf("Sin of 45: %f\n", sin(RAD(45))); } I am more interested in the observation that some people prefer to do things the hard way, as opposed to giving simpler examples. This is a philosophical argument, not a programming one. PV ______________________________________________________________________________ Paul Peavyhouse http://www.cs.montana.edu/~pv email: pv AT cs DOT montana DOT edu ______________________________________________________________________________