I think a problem occured when i used long()

Porky Pig Jr porky_pig_jr at my-deja.com
Wed Sep 1 21:24:02 EDT 2004


alikakakhel3 at hotmail.com (Ali) wrote in message news:<8f17f4bc.0409011101.5ace996 at posting.google.com>...
> I did the folloing in python shell:
> 
> >>> x = 5.07e-25
> >>> x = long(x)
> >>> print x
> 0L
> 
> Um... I was under the impresion that long numbers had very very long
> precision. But, it seems that in this case it rounded it to zero :(
> 
> Please Help. Thank you :)


Long numbers are still integers. in any case, python floating point is
C double (rather than float), most likely 64 bits with 53 bits for
precision.

Incidently, I remember seeing the thread somewhere re whether we need
128bit floating representation (with similarly adjusted number of bits
for precision) and the general consensus was that the double covers
pretty much all the bases.



More information about the Python-list mailing list