]> git.donarmstrong.com Git - lilypond.git/blob - flower/include/real.hh
(parse_symbol_list): Bugfix.
[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 <algorithm>
13 #include <climits>
14
15 typedef double Real;
16 extern const Real infinity_f;
17 using namespace std;
18
19 template<class T> inline T abs (T x)
20 {
21   return x > 0 ? x : -x;
22 }
23
24 template<class T> inline int sign (T x)
25 {
26   if (x)
27     return x > T (0) ? 1 : -1;
28   return 0;
29 }
30
31 template<class T> inline T sqr (T x)
32 {
33   return x * x;
34 }
35
36 inline Real
37 distance (Real x, Real y)
38 {
39   return abs (x - y);
40 }
41
42 #endif