// $Id: fgl_routines.h $ // ================================================================= // This code is distributed under the terms and conditions of the // CCP4 Program Suite Licence Agreement as 'Part 2' (Annex 2) // software. A copy of the CCP4 licence can be obtained by writing // to CCP4, Research Complex at Harwell, Rutherford Appleton // Laboratory, Didcot OX11 0FA, UK, or from // http://www.ccp4.ac.uk/ccp4license.php. // ================================================================= // // 29.08.13 <-- Date of Last Modification. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ---------------------------------------------------------------- // // **** Module : fgl_routines // ~~~~~~~~~ // **** Project : QtLibs/FGL - plotting in Qt // ~~~~~~~~~ // **** Classes : fgl::Range // ~~~~~~~~~ various functions // // (C) E. Krissinel 2012-2013 // // ================================================================= // #ifndef FGL_ROUTINES_H #define FGL_ROUTINES_H #include #include namespace fgl { const qreal _minReal = 1.7e-307; const qreal _sqrtMinReal = 4.123e-154; const qreal _maxReal = 1.7e+308; const qreal _ln10 = log(10.0); const qreal _pi = 3.14159265; qreal _machinEps(); qreal _pow ( qreal X, int Y ); qreal _pow1 ( qreal X, qreal Y ); qreal _sign ( qreal q ); qreal _exp ( qreal X ); qreal _order ( qreal q ); inline qreal _exp10 ( qreal x ) { return _exp ( x*_ln10 ); } inline qreal _log10 ( qreal q ) { return log10 ( qMax(fabs(q),_minReal) ); } inline qreal _round ( qreal q ) { return floor(q+0.499999999); } inline int _iround ( qreal q ) { return (int)floor(q+0.499999999); } inline int _ifloor ( qreal q ) { return (int)floor(q); } inline bool _isround ( qreal q ) { return (fabs(q-_round(q))<1.0e-8); } class Range { public: qreal q1,q2; qreal stretch; Range ( qreal v1, qreal v2, qreal s ) { q1 = v1; q2 = v2; stretch = s; } ~Range() {} }; } #endif // FGL_ROUTINES_H