Changes to PEP 327: Decimal data type

People: I'll post a reviewed version of the PEP. The only differences with the previous one will be the treatmen to float in both explicit and implicit construction: ------------ In Explicit construction: You can not call Decimal with a float. Instead you must use a method: Decimal.fromFloat(). The syntax: Decimal.fromFloat(floatNumber, positions) where floatNumber is the float number origin of the construction and positions is the positions after the decimal point where you apply a round-half-up rounding. In this way you can do, for example: Decimal.fromFloat(1.1, 2): The same that doing Decimal('1.1'). Decimal.fromFloat(1.1, 16): The same that doing Decimal('1.1000000000000001'). Decimal.fromFloat(1.1): The same that doing Decimal('110000000000000008881784197001252...e-51'). In Implicit construction: Raise TypeError. You can not mix Decimal and float. ------------ If you're ok, I'll post this. Thank you! . Facundo

On Mon, Mar 15, 2004, Batista, Facundo wrote:
Raise TypeError. You can not mix Decimal and float.
+1 -- Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/ "usenet imitates usenet" --Darkhawk

On Mon, Mar 15, 2004 at 11:01:12PM -0300, Batista, Facundo wrote:
People:
I'll post a reviewed version of the PEP.
The only differences with the previous one will be the treatmen to float in both explicit and implicit construction:
------------
In Explicit construction:
You can not call Decimal with a float. Instead you must use a method: Decimal.fromFloat(). The syntax:
Decimal.fromFloat(floatNumber, positions)
+1 on the behavior. One nitpick about the method name: this caseConvention is not consistent with the Python Style Guide (PEP 8) Oren
participants (3)
-
Aahz
-
Batista, Facundo
-
Oren Tirosh