File: cdsMath.hh

package info (click to toggle)
toshset 1.73-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 484 kB
  • ctags: 572
  • sloc: sh: 3,589; cpp: 2,938; ansic: 1,057; makefile: 190
file content (47 lines) | stat: -rw-r--r-- 599 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

#ifndef __cdsmath_hh__
#define __cdsmath_hh__ 1

#include <math.h>

namespace CDS {

#ifndef PI
#     define PI 3.14159265358979323846
#endif

template<class T> T
ipow(const T&,int);

template<class T> inline
T sq(const T t)
{
 return t*t;
}

template<class T> inline
T max(T a, T b)
{
 return (a>b?a:b);
} /* max */

template<class T> inline
T min(T a, T b)
{
 return (a<b?a:b);
} /* min */

template<class T> inline
int sign(T x)
{
 return ((x<0)?-1:1);
}

//
// conversion factor between radians and degrees
//
const double RAD2DEG = 180. / PI;

} /* namespace CDS */

#endif /*__cdsmath_hh__*/