random problem
Tim Peters
tim.one at home.com
Sun Jun 3 21:53:57 EDT 2001
[Alvaro Lopez Ortega]
> I've a little problem with Python 1.5.2 (Debian Potato):
>
> ===
> import random
> File "/usr/lib/python1.5/random.py", line 84, in ?
> verify('NV_MAGICCONST', 1.71552776992141)
> File "/usr/lib/python1.5/random.py", line 77, in verify
> raise ValueError, \
> ValueError: computed value for NV_MAGICCONST deviates too much (computed
> 2,82843, expected 1)
> ===
>
> Somebody knows how can I fix it? :-??
No clue -- this system is too broken to use.
This is the code it's executing:
def _verify(name, expected):
computed = eval(name)
if abs(computed - expected) > 1e-7:
raise ValueError(
"computed value for %s deviates too much "
"(computed %g, expected %g)" % (name, computed, expected))
NV_MAGICCONST = 4 * _exp(-0.5)/_sqrt(2.0)
_verify('NV_MAGICCONST', 1.71552776992141)
Somehow or other on your box the 1.71552776992141 is getting printed as 1.
The value it's computing (2,82843) doesn't make sense either. Have heard no
other report of this, although occasionally a bad platform C library has
produced exp() and/or sqrt() results a *little* bit insane. What you're
seeing is completely off the wall, and in more than one way.
More information about the Python-list
mailing list