source: trunk/MagicSoft/slalib/slamac.h@ 1020

Last change on this file since 1020 was 732, checked in by tbretz, 24 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 3.0 KB
Line 
1#ifndef SLAMACHDEF
2#define SLAMACHDEF
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8/*
9** - - - - - - - - -
10** s l a m a c . h
11** - - - - - - - - -
12**
13** Macros used by slalib library.
14**
15** Last revision: 27 January 2000
16**
17** Copyright P.T.Wallace. All rights reserved.
18*/
19
20/* max(A,B) - larger (most +ve) of two numbers (generic) */
21#define gmax(A,B) ((A)>(B)?(A):(B))
22
23/* min(A,B) - smaller (least +ve) of two numbers (generic) */
24#define gmin(A,B) ((A)<(B)?(A):(B))
25
26/* dint(A) - truncate to nearest whole number towards zero (double) */
27#define dint(A) ((A)<0.0?ceil(A):floor(A))
28
29/* aint(A) - truncate to nearest whole number towards zero (float) */
30#define aint(A) ((A)<0.0f?(float)ceil((double)(A)):(float)floor((double)(A)))
31
32/* dnint(A) - round to nearest whole number (double) */
33#define dnint(A) ((A)<0.0?ceil((A)-0.5):floor((A)+0.5))
34
35/* anint(A) - round to nearest whole number (float) */
36#define anint(A) ((float)dnint((double)(A)))
37
38/* dsign(A,B) - magnitude of A with sign of B (double) */
39#define dsign(A,B) ((B)<0.0?-(A):(A))
40
41/* dmod(A,B) - A modulo B (double) */
42#define dmod(A,B) ((B)!=0.0?((A)*(B)>0.0?(A)-(B)*floor((A)/(B))\
43 :(A)+(B)*floor(-(A)/(B))):(A))
44
45/* logicals */
46#if !defined(FALSE) || ((FALSE)!=0)
47#define FALSE 0
48#endif
49#if !defined(TRUE) || ((TRUE)!=1)
50#define TRUE 1
51#endif
52
53/* pi */
54#define DPI 3.1415926535897932384626433832795028841971693993751
55
56/* 2pi */
57#define D2PI 6.2831853071795864769252867665590057683943387987502
58
59/* 1/(2pi) */
60#define D1B2PI 0.15915494309189533576888376337251436203445964574046
61
62/* 4pi */
63#define D4PI 12.566370614359172953850573533118011536788677597500
64
65/* 1/(4pi) */
66#define D1B4PI 0.079577471545947667884441881686257181017229822870228
67
68/* pi^2 */
69#define DPISQ 9.8696044010893586188344909998761511353136994072408
70
71/* sqrt(pi) */
72#define DSQRPI 1.7724538509055160272981674833411451827975494561224
73
74/* pi/2: 90 degrees in radians */
75#define DPIBY2 1.5707963267948966192313216916397514420985846996876
76
77/* pi/180: degrees to radians */
78#define DD2R 0.017453292519943295769236907684886127134428718885417
79
80/* 180/pi: radians to degrees */
81#define DR2D 57.295779513082320876798154814105170332405472466564
82
83/* pi/(180*3600): arcseconds to radians */
84#define DAS2R 4.8481368110953599358991410235794797595635330237270e-6
85
86/* 180*3600/pi : radians to arcseconds */
87#define DR2AS 2.0626480624709635515647335733077861319665970087963e5
88
89/* pi/12: hours to radians */
90#define DH2R 0.26179938779914943653855361527329190701643078328126
91
92/* 12/pi: radians to hours */
93#define DR2H 3.8197186342054880584532103209403446888270314977709
94
95/* pi/(12*3600): seconds of time to radians */
96#define DS2R 7.2722052166430399038487115353692196393452995355905e-5
97
98/* 12*3600/pi: radians to seconds of time */
99#define DR2S 1.3750987083139757010431557155385240879777313391975e4
100
101/* 15/(2pi): hours to degrees x radians to turns */
102#define D15B2P 2.3873241463784300365332564505877154305168946861068
103
104#ifdef __cplusplus
105}
106#endif
107
108#endif
Note: See TracBrowser for help on using the repository browser.