[Python-Dev] Expert floats

Batista, Facundo FBatista at uniFON.com.ar
Tue Mar 30 14:34:54 EST 2004


Ka-Ping Yee wrote:

#- Out of the box, Python should show that numbers evaluate to 
#- themselves.

The number evaluates to themself:

>>> 1.1
1.1000000000000001
>>> 1.1 == 1.1000000000000001
True

I think that the issue here is that, for floats, Python uses C, C uses the
FPU, the FPU is implemented using binary numbers and a finite amount of
memory.

So, you'll *never* get an exact 1.1. Python just doesn't lies tou you.

And again, if you want a Decimal floating point (not a binary one), you'll
have to wait me to finish it. The great side of this is that you can help
me! ;)

.	Facundo





. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
ADVERTENCIA  

La información contenida en este mensaje y cualquier archivo anexo al mismo,
son para uso exclusivo del destinatario y pueden contener información
confidencial o propietaria, cuya divulgación es sancionada por la ley. 

Si Ud. No es uno de los destinatarios consignados o la persona responsable
de hacer llegar este mensaje a los destinatarios consignados, no está
autorizado a divulgar, copiar, distribuir o retener información (o parte de
ella) contenida en este mensaje. Por favor notifíquenos respondiendo al
remitente, borre el mensaje original y borre las copias (impresas o grabadas
en cualquier medio magnético) que pueda haber realizado del mismo. 

Todas las opiniones contenidas en este mail son propias del autor del
mensaje y no necesariamente coinciden con las de Telefónica Comunicaciones
Personales S.A. o alguna empresa asociada. 

Los mensajes electrónicos pueden ser alterados, motivo por el cual
Telefónica Comunicaciones Personales S.A. no aceptará ninguna obligación
cualquiera sea el resultante de este mensaje. 

Muchas Gracias.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20040330/b810738d/attachment.html


More information about the Python-Dev mailing list