This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients gregory.p.smith, mark.dickinson, rhettinger, tim.peters
Date 2012-02-16.11:29:08
SpamBayes Score 1.4030933e-07
Marked as misclassified No
Message-id <1329391750.6.0.0986634216225.issue14028@psf.upfronthosting.co.za>
In-reply-to
Content
> I'm wondering if the NaN arises in the C code for random():

I don't think that's possible.  In the second line:

    return PyFloat_FromDouble((a*67108864.0+b)*(1.0/9007199254740992.0));

a and b are already C unsigned longs, so no matter what their value, the result of the expression is well in range for an IEEE 754 double, and on a normal machine there's just no realistic way that this calculation could produce a NaN.  PyFloat_FromDouble does no manipulation of the C double, but just stores it directly in the PyFloat object.


I think there are two different things going on here.

(1) The Ubuntu error reporter seems to be using something other than the standard Random class, so all bets are off there without knowing more about what's being used.  Chances seem good that whatever random number generator they're using really *is* producing a NaN.

(2) That leaves Greg's report above, where the standard Random class is apparently what's being used.  Here I'm baffled---I can't see any realistic mechanism that might produce that traceback.
History
Date User Action Args
2012-02-16 11:29:10mark.dickinsonsetrecipients: + mark.dickinson, tim.peters, rhettinger, gregory.p.smith
2012-02-16 11:29:10mark.dickinsonsetmessageid: <1329391750.6.0.0986634216225.issue14028@psf.upfronthosting.co.za>
2012-02-16 11:29:10mark.dickinsonlinkissue14028 messages
2012-02-16 11:29:08mark.dickinsoncreate