|
Boost : |
From: Mikko Vainio (mikko.vainio_at_[hidden])
Date: 2007-07-19 01:08:17
Matthias Troyer wrote:
> On 17 Jul 2007, at 14:58, Mikko Vainio wrote:
>
>> Dear boosters,
>>
>> Has anyone else noticed that lagged_fibonacci607 produces negative
>> random numbers when compiled with the Intel C++ compiler for Linux
>> v10.0
>> using Pentium4 processor specific optimizations? As far as I
>> understand,
>> the random numbers generated by lagged_fibonacci607 should be
>> within the
>> interval [0,1). GCC and the Intel compiler with less aggressive
>> optimizations generate values within that range.
>>
>> This is probably a bug in the Intel compiler, but if anyone has a
>> workaround please let me know.
>
>
> Can you see it just with the default seed?
> Which compiler options do you use?
>
> Matthias
>
Yes. Based on little experimenting I'd say it occurs with any seed.
The error occurs when any SSE optimizations are turned on: icpc -O2
-msse ....
Below is a short program used for the testing on a 2GHz Core Duo T2500
running Fedora 7.
/Mikko
--------[scissors]--------------------------
#include <iostream>
#include <vector>
#include <boost/random/lagged_fibonacci.hpp>
using namespace std;
int main( int argc, char* argv[] )
{
boost::lagged_fibonacci607 fibo;
fibo.seed( 34597245 );
unsigned int nErrors = 0;
double rndom;
for( size_t j = 0; j < 10000; ++j )
{
rndom = fibo();
if( 1. < rndom || 0. > rndom )
++nErrors;
}
cout << "errors = " << nErrors << endl;
return 0;
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk