2 SuperCollider real time audio synthesis system
3 Copyright (c) 2002 James McCartney. All rights reserved.
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef _SC_Constants_
22 #define _SC_Constants_
27 const double pi
= std::acos(-1.);
29 const double pi2
= pi
* .5;
30 const double pi32
= pi
* 1.5;
31 const double twopi
= pi
* 2.;
32 const double rtwopi
= 1. / twopi
;
33 const double log001
= std::log(0.001);
34 const double log01
= std::log(0.01);
35 const double log1
= std::log(0.1);
36 const double rlog2
= 1./std::log(2.);
37 const double sqrt2
= std::sqrt(2.);
38 const double rsqrt2
= 1. / sqrt2
;
40 const float pi_f
= std::acos(-1.f
);
41 const float pi2_f
= pi_f
* 0.5f
;
42 const float pi32_f
= pi_f
* 1.5f
;
43 const float twopi_f
= pi_f
* 2.f
;
44 const float sqrt2_f
= std::sqrt(2.f
);
45 const float rsqrt2_f
= 1.f
/std::sqrt(2.f
);
47 // used to truncate precision
48 const float truncFloat
= (float)(3. * std::pow(2.0,22));
49 const double truncDouble
= 3. * std::pow(2.0,51);
51 const float kBadValue
= 1e20f
; // used in the secant table for values very close to 1/0