Menu

#165 Error in documentation of MersenneTwisterUniformRng

None
closed-wont-fix
nobody
None
5
2017-12-06
2013-12-06
No

The documentation of the random number generators states that the values fall in the open interval (0.0, 1.0), i.e. without the end points.

If MersenneTwisterUniformRng compiled with 32 bit Real numbers
When QuantLib is compiled with 32 bit floating point precision QL_REAL=float the line

return (Real(nextInt32()) + 0.5)/4294967296.0;

can evalueate to

return (float(4294967295) + 0.5)/4294967296.0;

This evaluates to 1.0f exactly

Discussion

  • Luigi Ballabio

    Luigi Ballabio - 2017-12-06
    • status: open --> closed-wont-fix
    • Group: -->
     
  • Luigi Ballabio

    Luigi Ballabio - 2017-12-06

    As compiling with QL_REAL=float is discouraged (the test suite fails) I think mentioning this might be more confusing than useful.

     

Log in to post a comment.

MongoDB Logo MongoDB