This is the mail archive of the gcc-help@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: std::isinf(-inf) strange results


On Mon, Feb 13, 2017 at 05:08:07PM +0100, Andrew - wrote:
> Is this the expected behaviour when std::isinf(-inf) yields 0 or -1
> instead of 1?

It returns a bool, not a number.

> Granted, -Ofast is allowed to disregard some standards in favor of
> performance... but is it allowed to produce code that is plain wrong?

-Ofast includes -ffast-math which includes -ffinite-math-only.  Nothing
is wrong here, everything works as designed, the only thing plain wrong
is using infinities when you promised not to :-)

> Furthermore, std::isinf sometimes takes the output of isinf from the
> math library without casting it to bool, which, as far as I know,
> doesn`t comply to the standard.

Yeah this looks weird.

> The question is whether I should report any of this as a GCC bug.

I think you should yes.


Segher


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