On 04:54 pm, [EMAIL PROTECTED] wrote: >On Jan 4, 2008 10:16 PM, <[EMAIL PROTECTED]> wrote:
>>Having other rounding methods *available*, though, would be neat. The >>only application I've ever worked on where I cared about the >>difference, >>the user had to select it (since accounting requirements differ by >>jurisdiction and, apparently, by bank preference). Having a standard >>way to express this (especially if it worked across different numeric >>types, but perhaps I digress) would be pleasant. Implementing >>stochastic rounding and banker's rounding oneself, while not exactly >>hard, is a drag. > >The decimal module already supports rounding modes in its context. For >other types, perhaps converting to decimal might be good enough? Yes, that's the right thing to do. I had missed it. After all it is decimal rounding I want, and any financial applications I'm going to write these days are using decimals already for all the usual reasons. At first I didn't realize why I'd missed this feature. While the rounding *modes* are well documented, though, after 20 minutes of reading documentation I still haven't found a method or function that simply rounds a decimal to a given significant digit. Is there one, should there be one, or is the user simply meant to use Context.quantize with appropriate arguments? _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com