www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/30/05:38:12

Message-ID: <386B04AA.B09F7B95@sgi.net>
From: John & Susie <jdk AT sgi DOT net>
X-Mailer: Mozilla 4.5 [en] (WinNT; I)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Inverse trigonometry functions in Djgpp
References: <wKza4.591$eq DOT 7079 AT uutiset DOT nic DOT fi> <84ekhk$qr2$1 AT nntp5 DOT atl DOT mindspring DOT net>
Lines: 44
Date: Thu, 30 Dec 1999 02:07:22 -0500
NNTP-Posting-Host: 216.151.67.223
X-Complaints-To: abuse AT stargate DOT net
X-Trace: news.sgi.net 946537675 216.151.67.223 (Thu, 30 Dec 1999 02:07:55 EST)
NNTP-Posting-Date: Thu, 30 Dec 1999 02:07:55 EST
Organization: Stargate Industries, LLC
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com


Marp wrote:
> 
> The trig functions require measurements in radians, not degrees. I think the
> way to convert the measurements is:
> 
> radians = degrees * (PI / 180)
> degrees = radians * (180 / PI)
> 
> Jarkko Kähkönen <jarkko DOT kahkonen AT mbnet DOT fi> wrote in message
> news:wKza4.591$eq DOT 7079 AT uutiset DOT nic DOT fi...
> > Atan () - don't work!
> > Here is a bit of my code:
> >
> > float direction;
> >
> > direction = atan ( 120 / 90 );
> > printf ("%f", direction");
> >
> > And output is this:
> > 0.927295
> >
> > But with calculator it is:
> > tan^-1 (120 / 90) = 53.1301023...
> >
> > Is atan () right inverse tan function?
> >
> > Greetings,
> > Jarkko DOT Kahkonen AT mbnet DOT REMOVETHAT DOT fi
> >
> >

Try something like this ...

#define    D2R(angle)    angle*.017453286
#define    R2D(n)        n/.017453286
/* Macros using/returning degrees in CAPS ...                   */
#define    TAN(angle)    tan(D2R(angle))
#define    SIN(angle)    sin(D2R(angle))
#define    COS(angle)    cos(D2R(angle))
#define    ATAN(n)       R2D(atan(n)) 
#define    ASIN(n)       R2D(asin(n))
#define    ACOS(n)       R2D(acos(n))

- Raw text -


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