
Boost : 
From: Paul A Bristow (pbristow_at_[hidden])
Date: 20061227 06:36:38
>Original Message
>From: boostbounces_at_[hidden]
>[mailto:boostbounces_at_[hidden]] On Behalf Of John Femiani
>Sent: 23 December 2006 21:06
>To: boost_at_[hidden]
>Subject: [boost] [Math] Does boost want constants?
>
>I noticed one file
>(http://www.boost.org/boost/random/normal_distribution.hpp) asked for
>mathematical constants (pi, e, phi, etc) in boost.
>Which constants other than perhaps those would the boost
>community want?
>Is there interest in a library of mathematical constants?
My proposal to provide a set of these was rejected some years ago because of the difficulty of agreeing how to package them in a
sufficiently user friendly way.
The state of the discussions in May 2005 is attached.
Here is a link to my collection of accurate constants in the boost vault http://tinyurl.com/wc3wl.
But I note with the very recent renewed progress of typeof, it may be that a solution can be found that is acceptable to enough
Boosters to get acceptance.
I remain certain that a collection of constants would be very useful.
>It also seems that there is no statistics library (i.e. functions to
>compute mean, variance, moments, skew, kurtosis, median, mode,
>quartiles, etc. from samples or histograms). Would the boost
>community be interested in these sorts of functions?
John Maddock is also polishing up the documentation for his Math Toolkit which now includes nearly all the statistical distributions
one could reasonably want (including calculation of their moments etc). This will go into the review queue very soon.
Once the tedious crafting of docs is done, I am sure attention with turn to the aspects you mention, and integration with Eric
Neibler's accumulator concept. I agree that these are fundamental tools that Boost should offer.
Paul
 Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS pbristow_at_[hidden]
attached mail follows:
This topic received exhaustive suggestions, some very close to this,
during the Boost review of my math constants library.
In the end they could not reach agreement, mainly because
not everyone agreed that it catered for User Defined Types
(NTL quad, doubledouble, RWdecimal...)
well enough (though there are conflicting views on which of the
many possibilities are best  for example using namespaces
allows one to deal with the case (<95%) on only ever wanting
doubles neatly so the user uses one using statement to
say he only ever wants pi<double>.
I though that the scheme proposed by Michael Kenniston was OK,
(see Boost sandbox files at URL below) but others shot it down.
However I recently reignited the debate by posting some updated
versions (with even more accurate constant values)
to the boost sandbox
See attached descriptive email which went with it.
Daniel Frey has another scheme which works OK on EDG and GCC
but not MSVC and I doubt is legal C++,
and another which relies on typeof,
a kludge version of which is the subject of an ongoing Boost review.
With C++0X and a proper typeof, I would probably support this version.
This doesn't seem rocket science to sort out somehow,
but C++ seems to find it hard.
An additional recent complication is that the Standard stream input
does not seem to require that when you read into a stream object like a
streamstring
you get exactly when you would get from the compiler reading in a
declaration like
const double pi = 3.141592653589793238462643383279502884197; // pi
stringstream s_pi ("3.141592653589793238462643383279502884197");
s_pi >> stream_pi; // pi not necessarily == stream_pi !!!
(for MSVC 8.0 is 1 bit wrong in 1/3 of cases  according to MS a feature not
a bug!)
See details attached.
:((
Paul
Paul A Bristow
Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB
+44 1539 561830 +44 7714 330204
mailto: pbristow_at_[hidden]
 Original Message
 From: cxxpanel_at_[hidden]
 [mailto:cxxpanel_at_[hidden]] On Behalf Of Francis Glassborow
 Sent: 20 May 2005 11:36
 To: cxxpanel_at_[hidden]; Walter Brown
 Subject: [cxxpanel] does this solve the problem?


 For those not familiar with the problem, Walter Brown wants a
 mechanism
 by which, for example, a value of pi in a user selected type can be
 available.

 In essence he wants to be able to write:

 pi<double>
 pi<long double>
 pi<float>

 We know that this can be done with a template function but his users
 really, really hate appending empty parentheses.

 Does this suggestiion from Gaby (an I think indepedently from someone
 else) do it:



 struct PiType
 {
 template <typename T>
 operator T() const { return 3.1415926536; }
 } pi;

 The object "pi" above can be used in generic code (like the
 area_of_circle function). Specializations for different types or even
 distinguishing reads from writes are possible as well.

 
 Francis Glassborow



 To unsubscribe from this group, send an email to:
 cxxpanelunsubscribe_at_[hidden]

 Yahoo! Groups Links







To unsubscribe from this group, send an email to:
cxxpanelunsubscribe_at_[hidden]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://uk.groups.yahoo.com/group/cxxpanel/
<*> To unsubscribe from this group, send an email to:
cxxpanelunsubscribe_at_[hidden]
<*> Your use of Yahoo! Groups is subject to:
http://uk.docs.yahoo.com/info/terms.html
attached mail follows:
I have recently posted to the Boost Sandbox vault an update of my collection
of mathematical constants,
previously reviewed as a Boost library and ultimately not accepted because
of
lack of agreement on how to present the constants, especially for User
Defined Types,
and an outbreak of macrophobia.
However the values are still valid and some may find them a useful and
convenient source,
with even more reassuringly sufficient decimal places to give you a warm
feeling ;)
The values are take from Internet sources and then computed with NTL a
arbitrary (very high) precision library
and presented as 40 decimal digit strings, suitable for all hardware as yet
envisioned.
I have tried to check as many as possible against two source to try to avoid
mistakes,
but please tell me of any that you find.
The same values are actually presented in header files as macros, floats,
doubles, and long doubles,
(and also as the functions allowing pi to call a function pi() proposed by
Michael Kenniston,
even though I am not entirely convinced of their usefulness).
So including double_constants.hpp will give lots of values, for example:
static const double cubeRootTwo = 1.25992104989487316476721060727822835057;
// 2^1/3
If you prefer a macro, the define_constants.h will give you values like
#define M_EPOWPI 23.14069263277926900572908636794854738027L /* e^pi */
You can of course also cut and paste invididual lines, if you just want pi.
No choice of names will suit everyone  so I have indulged myself.
You can change them of course.
for two zips of headers and documentation as html.
Enjoy?
Paul
PS Some of these values are to be used in the math functions for stats
library
that I am in danger of getting around to Real Soon Now.
Paul A Bristow
Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB
+44 1539 561830 +44 7714 330204
mailto: pbristow_at_[hidden]
_______________________________________________
Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk