[Cfp-interest] problem with fmaxmag code

Ian McIntosh ianm at ca.ibm.com
Tue Oct 16 16:20:55 PDT 2012


Would it work to just replace
	isgreaterequal(fabs(x), fabs(y))
with
	(fabs(x) >= fabs(y))
at least when FP_SNANS_ALWAYS_SIGNAL is defined, so the >= triggers on the
signaling NaN?

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



|------------>
| From:      |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Jim Thomas <jaswthomas at sbcglobal.net>                                                                                                             |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |CFP <cfp-interest at ucbtest.org>                                                                                                                    |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |10/16/2012 12:03 AM                                                                                                                               |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Re: [Cfp-interest] problem with fmaxmag code                                                                                                      |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Sent by:   |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |cfp-interest-bounces at oakapple.net                                                                                                                 |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|





The sample implementations of fmax and round have similar problems.

-Jim

On Oct 15, 2012, at 2:38 PM, Jim Thomas wrote:



      Our Part 1 draft has


      ------------------------------------------------


      [3] The body of the fmaxmag function might be[1]


         { return (isgreaterequal(fabs(x), fabs(y)) || isnan(y)) ? x : y; }






      [1] This implementation does not handle signaling NaNs as required of
      implementations that define FP_SNANS_ALWAYS_SIGNAL.


      ------------------------------------------------


      isgreaterequal might or might not raise the "invalid" floating-point
      exception if the implementation does not define
      FP_SNANS_ALWAYS_SIGNAL. Suppose it does. Suppose also that
      same-format conversions are copy operations. Then if x is a signaling
      NaN, the code would raise "invalid" but return a signaling NaN,
      violating F.2.1[4]. A fix would be to change the code to


         { return canonicalize((isgreaterequal(fabs(x), fabs(y)) || isnan
         (y)) ? x : y); }


      Then we could remove the footnote. The change would also serve to
      produce a canonical result.

      Any better ideas?

      -Jim
_______________________________________________
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/20121016/439d1778/attachment.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/20121016/439d1778/attachment.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/20121016/439d1778/attachment-0001.gif 


More information about the Cfp-interest mailing list