Using Python from Cocoa App via PyObjc - numbers dont match...

Gabriel Genellina gagsl-py at yahoo.com.ar
Wed Nov 8 21:19:48 EST 2006


At Wednesday 8/11/2006 22:22, sapsi wrote:

>I managed to create a python class and instantiate that from my
>Objective C Cocoa App (its not a python app). [...]
>The first output in the console is 40.4 and the second
>-40.40000152587891.
>
>If i change the NSLog(s)  to "%f",[n floatValue] (and the second
>likewise) the first is 40.400002 and the second is -40.400002.
>
>Why does this happen?

This is mostly independent on the language in use.
Numbers like 40.4 don't have, in general, an exact binary representation.
See http://docs.python.org/tut/node16.html


-- 
Gabriel Genellina
Softlab SRL 

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar



More information about the Python-list mailing list