[Stk] STK v. 4.4.3 - Error building using VS2008 (Windows)

Julius Smith jos at ccrma.Stanford.EDU
Mon Jan 16 13:54:42 PST 2012


At 03:31 AM 1/16/2012, Richard Dobson wrote:
>Not sure what you mean by "classically defined";

I mean since "hello world" :-)

>  it is pretty much
>standard in modern unix compilers including gcc, but it is not an
>ANSI-standard mandated symbol

well, it is certainly legacy mandated - not everything has to be 
explicitly mentioned in a standard, although math.h stuff probably 
should be by reference at least

>(any more than unistd.h is), and in
>Microsoft compilers it and several similar have been defined
>conditionally via the _USE_MATH_DEFINES symbol at least since Visual
>Studio 2005, possibly earlier, but not as far back as VC++v6.

That's fine, and I've also seen "cmath.h" used in place of "math.h", 
but "math.h" should always work, since there is no good reason to break it

>Clearly there can be a lot of legacy code that defines its own symbol
>for Pi etc; so M_PI is not something that can be taken for granted in
>any cross-platform system,

I think M_PI should be available in the usual way in every C/C++/C* 
implementation, and available via math.h (and any number of other 
ways perceived to clean things up).

>and will always need to be checked for one
>way or another. For audio purposes the "standard" M_PI defintion (some
>20 decimal places) is plenty sufficient, but for some precision-critical
>science or maths tasks one may want the extra precision of a long
>double, in which case a custom definition will still likely be needed.

A common trick to get pi to working precision is

long double pi = 4*atanl(1);

etc.

- jos



>Richard Dobson
>
>
>On 16/01/2012 04:37, Julius Smith wrote:
> > Hi All,
> >
> > FWIW, M_PI is classically defined in math.h.
> >
> > - jos
> >
> > At 06:24 PM 1/15/2012, Gary Scavone wrote:
> >> Hi Carlos,
> >>
> >> Thanks for the various bug reports and
> >> fixes.  Yes, the "PluckTwo" class was deprecated
> >> in favor of arrays of the new "Twang" class.  I
> >> see that I didn't document that very clearly in the release notes.
> >>
> >> The _USE_MATH_DEFINES thing seems to be an issue
> >> for recent versions of Visual Studio.
> >>
>
>_______________________________________________
>Stk mailing list
>Stk at ccrma.stanford.edu
>http://ccrma-mail.stanford.edu/mailman/listinfo/stk


Julius O. Smith III <jos at ccrma.stanford.edu>
Prof. of Music and Assoc. Prof. (by courtesy) of Electrical Engineering
CCRMA, Stanford University
http://ccrma.stanford.edu/~jos/  



More information about the Stk mailing list