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