This is the mail archive of the cygwin mailing list for the Cygwin 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]

ilogbl(0.0L) value is wrong


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


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