[eside-ghost] Resta rara en python
AngelD
angeld en froga.net
Mar Abr 1 10:02:17 CEST 2008
El Mar, 1 de Abril de 2008, 9:43, Yuki (aka Rubén Gómez) escribió:
> Buenos dÃas!!
>
> QuerÃa hacer una simple resta (a estas horas de la mañana no apetece
> mucho pensar) y he abierto la consola de python (2.4) para ello (en una
> debian testing), y a la hora de hacer la resta me da lo siguiente:
>
>>>> 238.55 - 198.0
>>>>
> 40.550000000000011
>
>
> Probando veo:
>
>>>> 235.55
>>>>
> 235.55000000000001
>
>>>> 198.0
>>>>
> 198.0
>
>>>> 198.05
>>>>
> 198.05000000000001
>
>
> Por qué pasa eso? En el ordenador de casa creo que nunca me habÃa
> pasado esto. Por si sirve de algo, es una debian x86 en un core 2 duo.
No se por qué pasa pero pasa, en diferentes versiones y arquitecturas:
## Linux machine2 2.6.23.9 #5 SMP PREEMPT Thu Jan 24 12:56:38 CET 2008
parisc GNU/Linux
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
238.55 - 198.0
40.55
Python 2.4.4 (#2, Apr 5 2007, 13:06:14)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 238.55 - 198.0
40.550000000000011
Python 2.5 (release25-maint, Dec 9 2006, 09:40:45)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-20)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 238.55 - 198.0
40.550000000000011
# Linux machine1 2.6.16.46-0.12-smp #1 SMP Thu May 17 14:00:09 UTC 2007
i686 i686 i386 GNU/Linux
Python 2.4.2 (#1, Apr 13 2007, 15:45:45)
[GCC 4.1.0 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 238.55 - 198.0
40.550000000000011
# cygwin
Python 2.5.1 (r251:54863, May 18 2007, 16:56:43)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 238.55 - 198.0
40.550000000000011
Más información sobre la lista de distribución eside-ghost