aboutsummaryrefslogtreecommitdiff
path: root/src/adjlon.c
blob: 3de12a1611f9b3dc7482a31510ae4cf7001b685f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* reduce argument to range +/- PI */
#ifndef lint
static const char SCCSID[]="@(#)adjlon.c	4.3	93/06/12	GIE	REL";
#endif
#include <math.h>
/* note: PI adjusted high
** approx. true val:	3.14159265358979323844
*/
#define SPI		3.14159265359
#define TWOPI	6.2831853071795864769
	double
adjlon (double lon) {
	while ( fabs(lon) > SPI )
		lon += lon < 0. ? TWOPI : -TWOPI;
	return( lon );
}