Login  Register

math constants

Posted by Peter Caspers-4 on Nov 04, 2015; 8:57am
URL: http://quantlib.414.s1.nabble.com/math-constants-tp17029.html

Hello Luigi, all,

I had a typo in my code and used M_SQRT_2 instead of M_SQRT2, the
former being defined as 1 / sqrt(2), but what I wanted was sqrt(2). We
also have a macro M_SQRT1_2 with the same value and which seems to
have a better name. I find M_SQRT_2 quite confusing and non-intuitive,
so I am wondering if we could just deprecate it and remove it in one
of the next versions ?

There are also some constants whose meaning does not appear
crystal-clear at first sight (M_IVLN10, M_LN2LO, M_LN2HI, M_INVLN2).
Can someone provide a definition, so that we can maybe add them to the
source ?

Finally there are some constants with many digits (M_SQRT1_2, M_PI).
Since there is no specifier (L) I guess they are always mapped to
double by the compiler, which should be 64bit on every platform, so
effectively they won't help even if one uses them to initialize a
__float128 etc. ? Maybe we should rather do it like GNU and add
versions of the macros like M_PIl, M_SQRT1_2l defining more digits and
with the L suffix ? Then we would also be in line with gcc.

What do you think ?

Best regards
Peter

------------------------------------------------------------------------------
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev