[Cfp-interest] binding for decimal

Jim Thomas jaswthomas at sbcglobal.net
Wed Sep 5 15:27:49 PDT 2012


At our July meeting we discussed the fact that whereas Table 1 gives a binding between IEC 60559 and binary FP for C, we have no such binding for decimal FP:
> PDF page 14, paragraph about 6.4.4.2#5: Do we need to add: "Decimal floating-point constants shall be correctly rounded."?
> 
> if not already covered - we might want to adapt, or refer to, the operation binding table in Part 1, e.g., The binding of 60559 operations to C decimal operation is analogous to the binding in Part 1 for binary operations, with these exceptions: … REVISIT
> 
>  try exceptions approach - ISSUE
> 

Below is an attempt. This text would most naturally go between clauses 7 and 8 (in Part 2). Corrections and comments welcome.

==================================
Table 1 and subsequent text in Part 1 clause 8 of this Technical Specification show how C operators, functions, and function-like macros provide the operations required by IEC 60559 for binary floating point. The first column gives the IEC 60559 operation, the second column the corresponding C operation. This table, with the exceptions noted below, also serves to show how the C decimal operations specified in Part 2 of this Technical Specification provide the operations required by IEC 60559 for decimal floating point. For the decimal operation binding, the functions shown in the second column indicate the decimal versions of the functions.
A decimal version of the C remquo function is not provided. The C remainder function provides the remainder operation defined by IEC 60559.

The C quantize function (11.4) provides the quantize operation defined in IEC 60559. 
IEC 60559 specifies the convertFromHexCharacter and convertToHexCharacter operations only for binary floating point.

The C expression x == 0.df provides the isZero operation defined in IEC 60559.

The C integer constant 10 provides the radix operation defined in IEC 60559.

The C samequantum function (11.4) provides the sameQuantum operation defined in IEC60559.
The C fe_dec_getround and fe_dec_setround functions (11.2) provide the getDecimalRoundingDirection and setDecimalRoundingDirection operations defined in IEC 60559.

The C quantexp function (11.2) computes the (quantum) exponent q defined in IEC 60559 for decimal numbers viewed as having integer significands. 

The C encodedpd and decodedpd functions (TBD) provide the encodeDecimal and decodeDecimal operations defined (specifically for decimal floating point) in IEC 60559.

The C encodebid and decodebid functions (TBD) provide the encodeBinary and decodeBinary operations defined (specifically for decimal floating point) in IEC 60559.
==================================


BTW, I noticed in Table 1 that isZero should be bound to x == 0.0f (instead of x == 0.0), to avoid triggering signaling NaNs. If no one objects, I'll make this change. 

-Jim


 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20120905/5965a414/attachment-0001.html 


More information about the Cfp-interest mailing list