ilogbl(0.0L) value is wrong

Bruno Haible bruno@clisp.org
Thu Dec 12 12:00:00 GMT 2019


POSIX [1] specifies that the return value of the functions ilogbf(), ilogb(),
ilogbl() for a zero argument should all be the same, namely FP_ILOGB0.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/ilogb.html

In Cygwin 2.9, the value of ilogbl(0.0L) is not right.

How to reproduce:
============================== foo.c ==============================
#include <stdio.h>
#include <float.h>
#include <math.h>

int main ()
{
  int x = ilogbf (0.0f);
  int y = ilogb (0.0);
  int z = ilogbl (0.0L);
  printf ("%d\n%d\n%d\n%d\n", x, y, z, FP_ILOGB0);
}
===================================================================
$ gcc -Wall foo.c
$ ./a.exe

Expected output: four times the same number.
Actual output:

-2147483647
-2147483647
-2147483648
-2147483647


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list