[pyar] Transformación de floats de 4-bytes a 8-bytes

Alejandro Santos listas en alejolp.com
Jue Feb 27 18:04:34 ART 2014


2014-02-27 21:54 GMT+01:00 Facundo Batista <facundobatista en gmail.com>:
>
>>>> d = Decimal(4.3)
>>>> d
> Decimal('4.29999999999999982236431605997495353221893310546875')
>

TIL que Decimal acepta floats en su constructor, hubiese jurado que
no, y que si queremos que *no* los acepte hay que habilitarlo
explicitamente:

  http://docs.python.org/3/library/decimal.html#decimal.FloatOperation

-- 
Alejandro Santos


More information about the pyar mailing list