Re: [Python-Dev] Fixed-decimal types
--- Guido van Rossum
What would be scale of the product of two fixed-decimal numbers? E.g. is 2.00L * 2.00L equal to 4.0000L, or equal to 4.00L? There are arguments for either. Same question for division (harder, I think). Most commonly one is trying to avoid rounding errors when dealing with money - a few cents rounding error tends to result in a few billable hours with the accountants at the end of the year!
SQL dialects and type-safe languages would make you specify the precision of the variable to be assigned, so the issue does not arise for other languages. For the work I do, simply taking the precision of the most precise input (4.00L)would do the trick, but your answer (4.0000L) is purer. We should provide a rounding function, and in practice anyone using such a function would round (or floor, or ceiling) to get to the desired precision immediately. I'm not sure on division either but I'm sure there are precedents to look at. On the subject of adding new types to the standard library, what are the plans on dates and times? Would a cut-down mxDateTime ever be considered? It is fully Open Source (unlike mxODBC) and was designed for the DBAPI. Regards, Andy ===== Andy Robinson Robinson Analytics Ltd. ------------------ My opinions are the official policy of Robinson Analytics Ltd. They just vary from day to day. __________________________________________________ Do You Yahoo!? Thousands of Stores. Millions of Products. All in one place. Yahoo! Shopping: http://shopping.yahoo.com
On the subject of adding new types to the standard library, what are the plans on dates and times? Would a cut-down mxDateTime ever be considered? It is fully Open Source (unlike mxODBC) and was designed for the DBAPI.
I don't know much about date/time types, or about mxDateTime. My intuition is that there are too many ways to do it, and that being compatible with commercial databases may not be the right way to do it for core Python. --Guido van Rossum (home page: http://www.python.org/~guido/)
participants (2)
-
Andy Robinson
-
Guido van Rossum