[Python-ideas] Python Numbers as Human Concept Decimal System

Oscar Benjamin oscar.j.benjamin at gmail.com
Tue Mar 11 21:59:17 CET 2014


On 11 March 2014 20:53, Stefan Krah <stefan at bytereef.org> wrote:
> Oscar Benjamin <oscar.j.benjamin at gmail.com> wrote:
>>
>> I was intending that it would be possible to use the traps and flags
>> on this context. Perhaps Stefan knows something I don't but I thought
>> that the constant folder could just use a hyper-sensitive context and
>> check for exceptions (or otherwise check the flags). I assumed this is
>> how it handled cases like '1 / 0' and '1.0 * 10 ** 1000' which are not
>> folded so that they can raise exceptions at the appropriate time.
>
> I meant that an external package that modifies e.g. rounding in the global
> context would also affect results, so the problem (which was used as an
> argument in favor of the fixed width decimal) is not limited to exponents
> and precision.

Could it not be handled by having the constant folder trap Inexact? I
though that if all calculations can be exact within the fixed
precision limit and exponent range then no rounding occurs so the
result is independent of the rounding mode. Or have I missed
something?


Oscar


More information about the Python-ideas mailing list