std::isinf(-inf) strange results

Jonathan Wakely jwakely.gcc@gmail.com
Mon Feb 13 16:54:00 GMT 2017


On 13 February 2017 at 16:32, Jonathan Wakely wrote:
> On 13 February 2017 at 16:29, Segher Boessenkool
> <segher@kernel.crashing.org> wrote:
>> 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.
>
> Unless the C library defines int isinf(double) in which case it
> returns a number.
>
> And in that case we can't do much about it, so std::isinf(double) also
> returns int.
>
> But this is already fixed in current releases of GCC and glibc.

See https://developers.redhat.com/blog/2016/02/29/why-cstdlib-is-more-complicated-than-you-might-think/
for more detail than you are likely to need.



More information about the Gcc-help mailing list