[pyar] Punto flotante binario grandote (era: Int anti-intuitivo)

QliX=D! [aka EHB] qlixed en gmail.com
Mie Nov 17 15:22:17 ART 2010


On Wed, Nov 17, 2010 at 1:39 PM, Facundo Batista
<facundobatista en gmail.com>wrote:

> 2010/11/17 QliX=D! [aka EHB] <qlixed en gmail.com>:
>
> > ipython -> Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500
> 32
> > bit (Intel)]
> > float("999999999999999999.0")
> >
> >
> > In [2]: float(9999999999999999.0)
> > Out[2]: 9999999999999998.0
>
> ¿Y en la consola de Python normal?
>
>
Idem anterior:

Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> float(9999999999999999.0)
9999999999999998.0
>>> float("9999999999999999.0")
9999999999999998.0
>>> from decimal import getcontext, Decimal
>>> getcontext().prec
28
>>> Decimal("9999999999999999.0") + 0
Decimal('9999999999999999.0')
>>> getcontext().prec=15
>>> Decimal("9999999999999999.0") + 0
Decimal('1.00000000000000E+16')

QliXed
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://listas.python.org.ar/pipermail/pyar/attachments/20101117/42da20c4/attachment.html>


More information about the pyar mailing list