]> git.donarmstrong.com Git - lilypond.git/blob - flower/include/real.hh
* flower/*.cc: remove <? and >?
[lilypond.git] / flower / include / real.hh
1 /*
2   real.hh -- declare Real
3
4   source file of the Flower Library
5
6   (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #ifndef REAL_HH
10 #define REAL_HH
11
12 #include <climits>
13
14 typedef double Real;
15 extern const Real infinity_f;
16 using namespace std;
17
18 template<class T> inline T abs (T x)
19 {
20   return x > 0 ? x : -x;
21 }
22
23 template<class T> inline int sign (T x)
24 {
25   if (x)
26     return x > T (0) ? 1 : -1;
27   return 0;
28 }
29
30
31 template<class T> inline T sqr (T x)
32 {
33   return x * x;
34 }
35
36
37 inline Real
38 distance (Real x, Real y)
39 {
40   return abs (x - y);
41 }
42
43 #endif