ftp.nice.ch/pub/next/science/physics/Moon.NIHS.bs.tar.gz#/Moon/Source/mymath.h

This is mymath.h in view mode; [Download] [Up]

/* mymath.h
 * Part of the Moon application for the NeXT computer.
 * Authors:  John Walker of Autodesk
 *           Geoffrey S. Knauth (NeXT port)
 * Date:     January 4, 1992
 *
 * This code was placed in the public domain by John Walker.
 */

#define PI 3.14159265358979323846  /* Assume not near black hole nor in
				      Tennessee */

/*  Handy mathematical functions  */

#define sgn(x) (((x) < 0) ? -1 : ((x) > 0 ? 1 : 0))	  /* Extract sign */
#define abs(x) ((x) < 0 ? (-(x)) : (x)) 		  /* Absolute val */
#define fixangle(a) ((a) - 360.0 * (floor((a) / 360.0)))  /* Fix angle	  */
#define torad(d) ((d) * (PI / 180.0))			  /* Deg->Rad	  */
#define todeg(d) ((d) * (180.0 / PI))			  /* Rad->Deg	  */
#define dsin(x) (sin(torad((x))))			  /* Sin from deg */
#define dcos(x) (cos(torad((x))))			  /* Cos from deg */

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.