[Cfp-interest] C operators

Fred J. Tydeman tydeman at tybor.com
Mon Mar 18 07:07:59 PDT 2013


On Mon, 18 Mar 2013 13:26:23 -0000 Mike Cowlishaw wrote:
>
>Just got the attached request from someone implementing a decimal arithmetic
>library; I think it's a C/C++ question really.  But I'm not sure where to 'point
>him to'.  Any suggestions appreciated.

In our Study Group document Part 2: Decimal floating-point arithmetic,
section 9.4 Usual arithmetic conversions:
  If one operand is a decimal floating type, all other operands shall not be 
  generic floating type, complex type, or imaginary type:

So BFP == DFP should be a translation time error as it is not allowed.

Also, in IEEE-754-2008, 5.11 Details of comparison predicates, 1st paragraph:
  For every supported arithmetic format, it shall be possible to compare 
  one floating-point datum to another in that format (see 5.6.1). Additionally,
  floating-point data represented in different formats shall be comparable as 
  long as the operands' formats have the same radix.

"same radix" is the key to that user's question.

---
Fred J. Tydeman        Tydeman Consulting
tydeman at tybor.com      Testing, numerics, programming
+1 (775) 287-5904      Vice-chair of PL22.11 (ANSI "C")
Sample C99+FPCE tests: http://www.tybor.com
Savers sleep well, investors eat well, spenders work forever.



More information about the Cfp-interest mailing list