[Python-bugs-list] [ python-Bugs-721402 ] Random on PPC is outside acceptable range.

SourceForge.net noreply@sourceforge.net
Mon, 14 Apr 2003 14:19:16 -0700


Bugs item #721402, was opened at 2003-04-14 15:43
Message generated for change (Comment added) made by memoryhole
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=721402&group_id=5470

Category: Extension Modules
Group: Platform-specific
Status: Open
Resolution: None
Priority: 5
Submitted By: Kyle Wheeler (memoryhole)
Assigned to: Nobody/Anonymous (nobody)
Summary: Random on PPC is outside acceptable range.

Initial Comment:
On LinuxPPC, with gcc 2.96, python's (2.2.2) random function is outside the acceptable range. For example:

>>> import random
>>> print random.random()
1.35933812391

This random function, I believe, is supposed to produce numbers between 0 and 1.

----------------------------------------------------------------------

>Comment By: Kyle Wheeler (memoryhole)
Date: 2003-04-14 16:19

Message:
Logged In: YES 
user_id=17596

Python 2.2.2 (#1, Apr 13 2003, 16:19:28) 
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-110)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import random
>>> print 1.35933812391 % 1,.0
1.35933812391 0.0
>>> print 1.35933812391 % 1.0
1.35933812391
>>> print 4%2                
0
>>> print 1.3%2
3.3

Any ideas?

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2003-04-14 16:14

Message:
Logged In: YES 
user_id=31435

What does the following statement print under this Python:

print 1.35933812391 % 1,.0

?

Note that there's almost no chance this is a bug in Python 
(the implementation of random() hasn't changed in about 10 
years).  There's a good chance it's a bug in the specific  C 
compiler or C library release you're using.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=721402&group_id=5470