[Python-Dev] Picking on platform fmod

Thomas Wouters thomas@xs4all.net
Sun, 29 Jul 2001 18:13:59 +0200

On Sat, Jul 28, 2001 at 04:13:53PM -0400, Tim Peters wrote:

> Here's your chance to prove your favorite platform isn't a worthless pile of
> monkey crap <wink>.  Please run the attached.  If it prints anything other
> than
> 0 failures in 10000 tries

> it will probably print a lot. 

Worked fine on BSDI, FreeBSD and Linux on Intel hardware here, as well as
Solaris on SPARC hardware and Linux on (IBM) PPC and (Compaq) Alpha
hardware, at least the ones in the SourceForge compilefarm :)

However, on this sourceforge compilefarm machine:

Linux usf-cf-sparc-linux-1 2.2.18pre21 #1 SMP Wed Nov 22 17:27:17 EST 2000 sparc64 unknown

(Linux on SPARC hardware, somewhat different hardware than the Solaris
compilefarm machine, though both are UltraSparcs (sun4u), so I assume they
have the same FPU hardware too.)

cpu             : TI UltraSparc II  (BlackBird)
fpu             : UltraSparc II integrated FPU
promlib         : Version 3 Revision 17
prom            : 3.17.0
type            : sun4u
ncpus probed    : 2
ncpus active    : 2

It fails like so:

Python-2.1.1/SPARC-linux/python fmodtest.py
Traceback (most recent call last):
  File "fmodtest.py", line 60, in ?
    _test(10000, 0)
  File "fmodtest.py", line 53, in _test
    if _tryone(x, y, showresults):
  File "fmodtest.py", line 33, in _tryone
    n = math.fmod(x, y)
OverflowError: math range error

This is most often on the first time through _tryone, or otherwise on the
second time through. Since it didn't print the oodles of info you wanted,
here are some values that cause this:

x: 1.9855727039972493e-39 y: 3.3665190124762732e-65
x: 9.5227191085185764e+47 y: 4.2603743746337035e-20
x: 5.9222419270524289e+19 y: 1.1515096079336105e-17
x: 1.0095372277815077e+37 y: 5.1347483313106109e-23
x: 7612675.5666046143 y: 16016.095533924272
x: 1.9710117673387707e+27 y: 3.8974792352555581e-75
x: 7.2481762337961828e-72 y: 6.9275805608109076e-91
x: 444606.5185310659 y: 0.040252210139028341

Here are some that it didn't break on:
x: 6.4925064019277635e+82 y: 3.3863081542612738e+39
x: 1.5537102518838885e+28 y: 7.4706363056326852e+21
x: 6.0545201466539534e+82 y: 1.0632674821830584e+22
x: 2.4744658600351291e+51 y: 3.8431582369146088e+39
x: 5.019729019166613e+56 y: 1.18286034219559e+48

Notice how none of these have a '-' in them...

Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!