ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/27/10:02:24

From: mdruiter AT cs DOT vu DOT nl (Ruiter de M)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Atanpi
Date: 27 May 1998 13:47:35 GMT
Organization: Fac. Wiskunde & Informatica, VU, Amsterdam
Lines: 44
Message-ID: <6kh5hn$ai5$1@star.cs.vu.nl>
References: <19980527010023 DOT AAC19094 AT ppp114 DOT cartsys DOT com>
NNTP-Posting-Host: galjas.cs.vu.nl
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Nate Eldredge (nate AT cartsys DOT com) wrote:
> At 01:25  5/26/1998 GMT, Darryl Matthews wrote:
> >What is the DJGPP equivalent (or code fragment) for the atanpi( ) function?

> I haven't seen that before, but if you'll explain what it does, it'd be
> easier to come up with an equivalent.

From the Solaris man page (the occurrances of `[pi]' actually were
`-^Hn'):

trig_sun(3M)          Mathematical Library           trig_sun(3M)

NAME
     trig_sun, sincos, sind, cosd,  tand,  asind,  acosd,  atand,
     atan2d, sincosd, sinp, cosp, tanp, asinp, acosp, atanp, sin-
     cosp, sinpi, cospi, tanpi, asinpi, acospi, atanpi,  atan2pi,
     sincospi - more trigonometric functions

SYNOPSIS
     cc [ flag ... ] file ...  -lsunmath -lm [ library ... ]

     #include <sunmath.h>
...
     double tanpi(double x);
...
DESCRIPTION
...
     sinpi(x),  cospi(x),  and  tanpi(x)  avoid   range-reduction
     issues  because their definition sinpi(x):=sin([pi]*x) permits
     range reduction that is  fast  and  exact  for  all  x.  The
     corresponding inverse functions compute asinpi(x):= asin(x)/
     [pi].  Similarly atan2pi(y,x):= atan2(y,x)/[pi].
...

So I think this will suffice (untested!):

#include <math.h>
#define atanpi(x) (atan(x) / M_PI)

--
Groeten, Michel.        http://www.cs.vu.nl/~mdruiter
  ____________
  \  /====\  /          "You know, Beavis, you need things that suck,
   \/      \/           to have things that are cool", Butt-Head.

- Raw text -


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