This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: std::isinf(-inf) strange results
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Andrew - <hidefromkgb at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 13 Feb 2017 10:29:08 -0600
- Subject: Re: std::isinf(-inf) strange results
- Authentication-results: sourceware.org; auth=none
- References: <CAAo+LNNz1UW1eBPTn0i9jMs2NSrc+acAh57AUxPDTf80oNC44w@mail.gmail.com>
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