[Cfp-interest] D/d double type floating point suffix

Ian McIntosh ianm at ca.ibm.com
Mon Jul 30 11:50:04 PDT 2012


Packed decimal is fixed-point, not floating-point. The hardware treats it
as integers, but from a software point of view it's usually not integer.
For example, financial calculations might have 15 digits treated as 13
before the decimal point and 2 after.  In mainframe C a value of that type
might look like 123.45d.

To complicate things, passing a literal parameter might need the leading
zeros or a cast to the right size, because 123.45 and 0000000000123.45 are
actually different types - 3+2=5 digits and 13+2=15 digits.

- Ian McIntosh          IBM Canada Lab         Compiler Back End Support
and Development



|------------>
| From:      |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |"Fred J. Tydeman" <tydeman at tybor.com>                                                                                                             |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |"CFP" <cfp-interest at ucbtest.org>                                                                                                                  |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |07/30/2012 10:06 AM                                                                                                                               |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Re: [Cfp-interest] D/d double type floating point suffix                                                                                          |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Sent by:   |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |cfp-interest-bounces at oakapple.net                                                                                                                 |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|





My understanding is that the 'd' suffix is used on packed decimal
constants.  In the hardware, they are integers.  But, in the
user's source code, can they look like floating-point numbers?
That is, would 1.00d be a valid packed decimal constant?

---
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.

_______________________________________________
Cfp-interest mailing list
Cfp-interest at oakapple.net
http://mailman.oakapple.net/mailman/listinfo/cfp-interest


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20120730/e8cb1a11/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
Url : http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20120730/e8cb1a11/attachment-0002.gif 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecblank.gif
Type: image/gif
Size: 45 bytes
Desc: not available
Url : http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20120730/e8cb1a11/attachment-0003.gif 


More information about the Cfp-interest mailing list