PPC floating equality vs. byte compilation

Michael Hudson mwh at python.net
Mon Jul 11 15:18:25 CEST 2005


"Terry Reedy" <tjreedy at udel.edu> writes:

> "Tim Peters" <tim.peters at gmail.com> wrote in message 
> news:1f7befae05070908227704f21 at mail.gmail.com...
> > [Donn Cave]
> >> I ran into a phenomenon that seemed odd to me, while testing a
> >> build of Python 2.4.1 on BeOS 5.04, on PowerPC 603e.
> >>
> >> test_builtin.py, for example, fails a couple of tests with errors
> >> claiming that apparently identical floating point values aren't equal.
> >> But it only does that when imported, and only when the .pyc file
> >> already exists.  Not if I execute it directly (python test_builtin.py),
> >> or if I delete the .pyc file before importing it and running 
> >> test_main().
> 
> This is a known problem with marshalling INFs and/or NANs.

I hope you've also read all the bits and pieces where Tim says
"whatever happens to INFs and NANs is a platform dependent crapshoot".
We don't test platform dependent crapshoots in test_builtin (or at
least, I hope not!).

> *This* has supposedly been fixed for 2.5.

Actually, it's likely that Donn's failure has been fixed for Python
2.5 as well, at least if Tim's guess is correct, because the C
string->float routines aren't invovled in loading .pycs any more.

> > It would be most helpful to open a bug report, with the output from
> > failing tests.
> 
> And assign to Tim.

That's mean! :)

> >In general, this can
> > happen if the platform C string<->float routines are so poor that
> >
> >    eval(repr(x)) != x
> ...
> > The ultimate cause is most likely in the platform C library's
> > string<->float routines (sprintf, strtod, that kind of thing).
> 
> It would also be helpful if you could do some tests in plain C (no Python) 
> testing, for instance, the same values that failed.  Hardly anyone else can 
> ;-).  If you confirm a problem with the C library, you can close the report 
> after opening, leaving it as a note for anyone else working with that 
> platform.

I agree with this bit!

Cheers,
mwh

-- 
112. Computer Science is embarrassed by the computer.
  -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html



More information about the Python-list mailing list