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

Stefan Krah stefan at bytereef.org
Thu Mar 6 19:13:28 CET 2014


Oscar Benjamin <oscar.j.benjamin at gmail.com> wrote:
> > Well, yes. You can also emulate Decimal64 with the appropriate
> > context parameters.
> >
> > I meant "arbitrary precision facilities by setting context parameters",
> > but probably many people want to keep those.
> >
> > Due to the compact representation (bid64 or bid128), Decimal64 or
> > Decimal128 would be interesting for doing arithmetic on huge matrices.
> 
> I'm still not totally clear here.
> 
> Do you mean that decimals created with a decimal literal e.g. 1.123d
> would be some other kind of decimal object that always used a special
> arithmetic context so that they behaved like a fixed width Decimal64
> type? And then someone who wants to do decimal arithmetic with other
> contexts would still need to import decimal and do the context stuff
> themselves?

That would be one option. I'm not sure if it is a *good* option.

Another option is to use the regular Decimal objects with the
IEEE context and perhaps add functions to convert to bid64 etc.


Yet another issue is whether a Decimal core type should use the
function names from IEEE 754-2008. The names are different, though
the behavior is largely the same.


My main point here is that even for the Decimal literal (which seems
innocent enough) there is a lot to discuss, since we can specify the
semantics only once.


Stefan Krah





More information about the Python-ideas mailing list