Boost logo

Boost :

From: Boris Gubenko (Boris.Gubenko_at_[hidden])
Date: 2008-01-09 15:24:35


  Boost.Random library test random_test fails on linux_ia64_gcc: see
  <http://tinyurl.com/32hqlu> . It fails with the similar errors on
  Sandia-pathscale: see <http://tinyurl.com/2va9tz>.

  Both platforms are Red Hat Linux 2.6.9 ia64:

    . linux_ia64_gcc is Red Hat Linux 2.6.9-42.EL
    . Sandia-pathscale is Red Hat Enterprise Linux 2.6.9-34.0.2.ELsmp

  The test does NOT fail on Sandia-gcc-64 which is a Red Hat Enterprise
  Linux 2.6.18-8.el5.

  x.cpp below is a reduced reproducer. It passes on every platform I tried
  it on, including Debian GNU/Linux ia64, except Red Hat Linux 2.6.9-42.EL.
  On the latter, it fails for long double which is how the original test
  random_test fails on linux_ia64_gcc.

  On the platforms where it passes it outputs:

*** testing float ***
g = 1.353399e+00 g2 = 1.353399e+00
*** passed ***
*** testing double ***
g = 1.353399e+00 g2 = 1.353399e+00
*** passed ***
*** testing long double ***
g = 1.353399e+00 g2 = 1.353399e+00
*** passed ***

  On Red Hat Linux 2.6.9-42.EL it outputs:

*** testing float ***
g = 1.353399e+00 g2 = 1.353399e+00
*** passed ***
*** testing double ***
g = 1.353399e+00 g2 = 1.353399e+00
*** passed ***
*** testing long double ***
g = nan g2 = 1.000000e+00
*** failed ***

  The comment in explicit-failures-markup.xml for random_test for
  intel-linux-9.0 toolset says:

    Reported to Intel as issue 409291, and confirmed as a problem. Probably
    this relates to a specific Linux-Kernal or GLibC version."

  I'm wondering: is this problem specific to a Linux Red Hat 2.6.9 ia64
  Kernal or GLibC version on this platform?

  Thanks,
    Boris

x.cpp
-----
#include <cmath>
#include <stdio.h>
#include <boost/random.hpp>

template<class URNG, class Dist>
void instantiate_dist(URNG& urng, const Dist& dist)
{
  boost::variate_generator<URNG, Dist> gen(urng, dist);
  boost::variate_generator<URNG&, Dist> genref(urng, dist);
  long double g = gen();
  long double g2 = genref();
  printf("g = %Le g2 = %Le\n", g, g2);
  if ( std::abs(g - g2) < 1e-6 ) puts("*** passed ***");
  else puts("*** failed ***");
}

template<class T>
void test()
{
  boost::rand48 urng;
  urng.seed();
  instantiate_dist(urng, boost::triangle_distribution<T>(1, 1.5, 7));
}

int main()
{
  puts("*** testing float ***");
  test<float>();
  puts("*** testing double ***");
  test<double>();
  puts("*** testing long double ***");
  test<long double>();
}


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk