[Python-Dev] New decimal branch - news and status (original) (raw)

Facundo Batista facundo at taniquetil.com.ar
Fri Apr 20 23:15:46 CEST 2007


Ok, I cut a branch in svn to work with decimal.py (decimal-branch).

I commited the work I made during the last weeks. Right now, the state is:

Important change: Added a "P" value to the valid exponents. See this test (with a precision of 5 in the context), for example::

maxx670 max 11 -sNaN12345678901 -> -NaN78901 Invalid_operation

This is translated to something like::

Decimal('11').max(Decimal('-sNaN12345678901'))

Doing Decimal('-sNaN12345678901') must signal InvalidOperation, because the payload has more digits that the context, and we can signal it through ConversionSyntax or InvalidOperation itself.

ConversionSyntax must return a quiet NaN. In this case, the max operation will return the number, and it's not the desired result in this case.

InvalidOperation must return a quiet NaN also, with the original sign, and an optional diagnostic information.

The max operation, so, will always receive a quiet NaN, but it must know that it was before signaled. And it must know it from the diagnostic information.

So far, for diagnostic information we used the Decimal._int digits, because that was all that was needed. I think it's more clear to leave there the payload digits, and not make that structure more complex, and create the new exponent.

"P" is from "phantom" signal, because for everybody asking self._isnan(), it will return 1 (quiet NaN). But if you want to look at it in more detail, you will now that in a past life, it was signaled...

Any help is greatly appreciated.

Thank you very much!

Regards,

-- . Facundo . Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/



More information about the Python-Dev mailing list