2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 04:22:09 +00:00

Replacing the use of <iomanip> with <boost/detail/iomanip.hpp> across Boost.

On Linux, GNU's libstdc++, which is the default stdlib for icc and clang,
cannot parse the <iomanip> header in version 4.5+ (which thankfully neither
compiler advises the use of yet), as it's original C++98-friendly
implementation has been replaced with a gnu++0x implementation.
<boost/detail/iomanip.hpp> is a portable implementation of <iomanip>, providing
boost::detail::setfill, boost::detail::setbase, boost::detail::setw,
boost::detail::setprecision, boost::detail::setiosflags and
boost::detail::resetiosflags. 



[SVN r68140]
This commit is contained in:
Bryce Adelstein-Lelbach
2011-01-14 02:35:58 +00:00
parent 35a23d5fae
commit f11d1c3c2b
99 changed files with 537 additions and 456 deletions

View File

@@ -19,12 +19,14 @@
// negative_binomial is the probability that k or fewer failures
// preceed the r th trial's success.
#include <ios>
#include <iostream>
#include <boost/detail/iomanip.hpp>
using std::cout;
using std::endl;
using std::setprecision;
using boost::detail::setprecision;
using std::showpoint;
using std::setw;
using boost::detail::setw;
using std::left;
using std::right;
#include <limits>
@@ -63,10 +65,10 @@ int main()
// Compare with the cdf
double cdf8 = cdf(mynbdist, static_cast<double>(k));
double diff = sum - cdf8; // Expect the diference to be very small.
cout << setprecision(17) << "Sum pdfs = " << sum << ' ' // sum = 0.40025683281803698
cout << boost::detail::setprecision(17) << "Sum pdfs = " << sum << ' ' // sum = 0.40025683281803698
<< ", cdf = " << cdf(mynbdist, static_cast<double>(k)) // cdf = 0.40025683281803687
<< ", difference = " // difference = 0.50000000000000000
<< setprecision(1) << diff/ (std::numeric_limits<double>::epsilon() * sum)
<< boost::detail::setprecision(1) << diff/ (std::numeric_limits<double>::epsilon() * sum)
<< " in epsilon units." << endl;
// Note: Use boost::math::tools::epsilon rather than std::numeric_limits
@@ -85,10 +87,10 @@ int main()
cout << "\n"" k pdf cdf""\n" << endl;
for (int k = 0; k < maxk; k++)
{
cout << right << setprecision(17) << showpoint
<< right << setw(3) << k << ", "
<< left << setw(25) << pdf(mynbdist, static_cast<double>(k))
<< left << setw(25) << cdf(mynbdist, static_cast<double>(k))
cout << right << boost::detail::setprecision(17) << showpoint
<< right << boost::detail::setw(3) << k << ", "
<< left << boost::detail::setw(25) << pdf(mynbdist, static_cast<double>(k))
<< left << boost::detail::setw(25) << cdf(mynbdist, static_cast<double>(k))
<< endl;
}
cout << endl;