<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2658.2">
<TITLE>RE: Why not FP for Money?</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>[Barkmann@gmail.com]</FONT>
</P>

<P><FONT SIZE=2>#- I've seen it suggested various times that one should use fixed point</FONT>
<BR><FONT SIZE=2>#- for money, perhaps micro cents represented as integers. However, if</FONT>
<BR><FONT SIZE=2>#- you do that, you need to make sure you do all the rounding correctly.</FONT>
<BR><FONT SIZE=2>#- If you were to use FP, you could have your IEEE 754 hardware do the</FONT>
<BR><FONT SIZE=2>#- rounding for you, and get better performance to boot. If you are</FONT>
<BR><FONT SIZE=2>#- rounding to cents at the end anyway, I can't see that the </FONT>
<BR><FONT SIZE=2>#- errors you'd</FONT>
<BR><FONT SIZE=2>#- get with 64 bit FP numbers would ever be an issue.</FONT>
</P>

<P><FONT SIZE=2>Here's a confusion. Floating Point is fine to use in Money. But Decimal Floating Point, and not Binary Floating Point (DFP is implemented in the decimal module, BFP is implemented in the IEEE 754 hardware).</FONT></P>

<P><FONT SIZE=2>For further reference you may read the PEP 327 (Decimal Data Type):</FONT>
</P>

<P>        <FONT SIZE=2><A HREF="http://www.python.org/peps/pep-0327.html" TARGET="_blank">http://www.python.org/peps/pep-0327.html</A></FONT>
</P>

<P><FONT SIZE=2>Having read the *long* thread from this weekend, and seeing another start, I'd recommend a *lot* of people to read that PEP.</FONT></P>

<P><FONT SIZE=2>.       Facundo</FONT>
</P>

</BODY>
</HTML>