lilypond-1.3.18
[lilypond.git] / flower / include / real.hh
blobd2667110a9b00e6bbdcc98c395613c7854bb60dd
1 /*
2 real.hh -- declare Real
4 source file of the Flower Library
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
10 #ifndef REAL_HH
11 #define REAL_HH
14 #include <limits.h>
16 typedef double Real;
17 extern const Real infinity_f;
19 template<class T> inline T abs (T x)
21 return x > 0 ? x : -x;
24 template<class T> inline int sign (T x)
26 if (x)
27 return x > T(0) ? 1 : -1;
28 return 0;
31 template<class T> inline T max (T x, T y)
33 return x >? y;
36 template<class T> inline T sqr (T x)
38 return x*x;
42 template<class T> inline T min (T x, T y)
44 return x <? y;
47 inline Real
48 distance (Real x,Real y)
50 return abs (x-y);
53 #endif