This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: V3 PATCH: numeric_limits<> support, fix PR/3865


On Tue, Sep 03, 2002 at 03:22:23PM +0200, Gabriel Dos Reis wrote:
> | As for __builtin_inf(), on non-ieee targets, should this be more
> | like HUGE_VAL (return the largest value possible) or INFINITY
> | (which results in a diagnostic)?  Perhaps the later, and do go
> | ahead and supply a __builtin_huge_val() as well?
> 
> If the system can have a positive infinity then we set
> numeric_limits<>::has_infinity to false and I don't think we're 
> permitted to issue a diagnostic:
[...]
> Also, in C++, INFINITY is in the user namespace and we can't use it in
> the library.

Clearly I was not suggesting that the c++ code generate a diagnostic.
I was talking about the implementation of the c99 INFINITY macro which
_is_ required to generate a diagnostic if infinities are not supported.

Anyway, I was thinking about how to define your booleans.  Seems like
the following would work:

    bool has_infinity = __builtin_huge_val() / 2 == __builtin_huge_val();
    bool has_qnan = __builtin_nan("") != __builtin_nan("");
    bool has_snan = has_qnan;



r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]