× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Fri, 20 Feb 2004, Buck wrote:
>
> Yes indeed.  It looks as if Simon's conjecture is on the money.  Some sort
> of conversion/rounding error between FLOAT8 and packed.  It looks like C
> will by default only display the 16 digits that double is supposed to hold
> while the RPG conversion from float to packed manages to extract that little
> something extra!  :-)

Yep, in fact if you call the CEESDXPD API instead of using pow() or **,
you get the exact same results.  Even though you call the same API from
both RPG and C, printf() will display less precision than the conversion
to packed and DSPLY.

That, to me, makes it quite clear that the difference isn't the language,
but rather the conversion to packed.

In fact, the following RPG program gives the same (16-digit) result even
though no C code is involved, and again I'm assuming it's because it's
never converted to packed...

     D z               s              8F
     D msg             s             50A
     c                   eval      z = 16**15
     c                   eval      msg = %editflt(z)
     c                   dsply                   msg
     c                   eval      *inlr = *on

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.