[Cfp-interest] FP_EXCEPTIONAL_TEST

Mike Cowlishaw mfc at speleotrove.com
Wed May 21 06:16:02 PDT 2014


In brief reply to this and Jim's question ... my concern is that in practice the
set of 'exceptions' is likely to be larger that the set described in IEEE 754.
As a specific example, see:  http://speleotrove.com/decimal/daexcep.html 

I suggest that requiring programmers to know the 'names' of all possible
exceptions of interest is unreasonable.  Equally, suggesting that the only five
that matter are those mentioned in IEEE 754 is a little naïve.  

The bit-mask approach is good.  I have also found it useful to provide pre-set
bitmasks that test for "probably an error" and "informational".  That's the
level with which most programmers are comfortable.  See, for example, the
groupings I put together that are now used in GCC:

http://www.opensource.apple.com/source/gcc/gcc-5666.3/libdecnumber/decContext.h

Mike


 

> -----Original Message-----
> From: cfp-interest-bounces at oakapple.net 
> [mailto:cfp-interest-bounces at oakapple.net] On Behalf Of David 
> Hough CFP
> Sent: 21 May 2014 06:50
> To: cfp-interest at ucbtest.org
> Subject: [Cfp-interest] FP_EXCEPTIONAL_TEST
> 
> 
> I'm thinking of adding to the other proposals I've made, 
> another special macro
> 
> FP_EXCEPTIONAL_TEST( compound-statement)
> 
> which returns a bit mask of the 5 standard IEEE exceptions 
> arising in the compound-statement, leaving the "global" IEEE 
> flags unchanged, and disabling any more globally-defined 
> alternate exception handling.
> 
> This would be a shorthand for those who might want to know 
> about all five exceptions, or in situations where this would 
> offer a performance advantage.
> It would almost always be non-zero because of inexact exceptions.
> 
> It's equivalent to saving the flag set before, restoring it 
> after, and returning as the macro value the flags that arose 
> in compound-statement.
> Except for underflow, which is an interesting question: 
> should it report whether the underflow exception arose, or 
> whether the underflow flag would
> have been raised.     For underflow, those are not the same.
> _______________________________________________
> Cfp-interest mailing list
> Cfp-interest at oakapple.net
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest
> 




More information about the Cfp-interest mailing list