Discrepency between JPython and CPython

Alex cut_me_out at hotmail.com
Mon May 1 00:24:54 CEST 2000


> Consider the expression str(1.14 * 200).
> In CPython it yields 228.0
> In JPython it yields 227.99999999999997
> 
> Shouldn't this result in consistent values across variuos implementation?  
> If so, which of the implementation is buggy?  
> I think it is JPython, may be I am wrong.

Both implementations just reach down to a lower level routine -- for
CPython, it's multiplication in C, for JPython, it's multiplication in
Java.  So probably the discrepency is between the C compiler used to
build your CPython (or maybe your CPU, if it does floating point
operations.  I understand they do, these days.  [The only CPU I ever
learnt anything about in detail was the 6809.] :) and the JVM your
JPython is running on.

Alex.



More information about the Python-list mailing list