[Python-Dev] PEP 327: Decimal Data Type (original) (raw)
Batista, Facundo FBatista at uniFON.com.ar
Mon Feb 2 10:15:13 EST 2004
- Previous message: [Python-Dev] Proposed: change to posting rules for python-dev
- Next message: [Python-Dev] PEP 327: Decimal Data Type
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Stephen Horne writes:
#- Good point. A 'DecimalExact' or similar function could perhaps be #- provided to replace the simple conversion when people have really #- thought about it and do really want it.
So, making it short:
When you have som rounding, it's ok to have a second parameter:
Decimal(1.1, 2) == Decimal('1.1')
I proposed that without the second parameter, the conversion to be exact:
Decimal(1.1) == Decimal('110000000000000008881784197001252...e-51')
Michael Chermside proposed to have the second parameter mandatory: avoids the problem of a newbie forgetting it, and if you want an exact conversion you can always put a very large number (e.g.: 60).
If the second parameter will be mandatory, I prefer a non sense number there, for example: 0.
And Stephen Horne proposed to have an explicit method to do the exact conversion, kind of:
Decimal.fromFloat(1.1) ==
Decimal('110000000000000008881784197001252...e-51')
So, we need to choose one of three ways to obtain an exact conversion:
1. Without a second parameter.
2. With a second parameter "big enough" or a special value (0? -1?)
3. With another method. Name?
Thank you all!
. 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/20040202/6687a5e6/attachment.html
- Previous message: [Python-Dev] Proposed: change to posting rules for python-dev
- Next message: [Python-Dev] PEP 327: Decimal Data Type
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]