delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2023/04/18/07:22:52

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6C8E2385700F
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1681816934;
bh=8BSlZ2YPdG9BqixSWNTr/P6f+QHxOLZurPG+N1MtoUg=;
h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=CwlidspVSllbhf1JIBrty/y+VRJ5bJ/6mMCXUVjEkcgrCBeSXWDK8zqDaqiqGikU3
WFTlAD5/ARCOOajwLfKNeNJh8XfyIO1tk7qv8vkiLDBsyKwEZFcoAxL7ug9Oc9fI9Y
rMGGla6F0H0CoDnDi/r5CzB0BFSBd2AQlbIitpxU=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7D860385771F
ARC-Seal: i=1; a=rsa-sha256; t=1681816893; cv=none;
d=strato.com; s=strato-dkim-0002;
b=Bwv8LZvdZ/znFmqmynLrdnxonXD46+RiBuciUneOiz1mPZeJIGOFT3sYgIGNVni7YA
U7heTWXe8KjzrOz7jWA/BE7VKchSnLFOvIyUO4LBRaAfzFooppG9lKhdc0i8ZuZBrU0u
uottMWPrYYQdDpoI/sjwwOXrG+d64A5nQFBt+doIg6Nad4pYYcrBOo4UwcYrGMwdcWXk
A7S6GfPxdKYJOEL9rdyW4iA+26Gx8LB80QJTw07+PMiHsS9B/IUXIRyzSbyVEhBMGJF4
ji/qbHaX1dBeEpMEJmQQWF3hWCDcUpQFHDUSZG0tbk/V5ufrmE4irjRoN9LcQ5QzHSDR
kBeA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1681816893;
s=strato-dkim-0002; d=strato.com;
h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender;
bh=GXDs/33MBfhvBSKhMcSinHh4R8zdmJjYfhNov8oExJU=;
b=QEfzg0lW3Gpufpbs49oiztNyN3YUCtsMTIFnMiwn3/Xy58uxolDakjj4xHQ3e237+M
YqCimF1lT/QjbvL/nGQ9oIV2dBHR7aG1rZOYfj9yOa8faO5EyJjQz4WKBud8JL/nOX9l
e8vVgQT4WEucZHK/mtCa6dLO/w1GfXL7DwBf2oDTySgVANyXP+rE34NCSOsFzRy2+MqR
brjnS6iC8fOPMMXLsd4c2AEjuVomRMN8nHRKS992CA9YND2JUEBVfT4PvqnF/ihHg0Xz
3mgVaTuJhqcCewzGruJTm1wnlx7XiWXgbB60ST9uMBdcAYBavL561MFJfsN2rsvnOo3u
803w==
ARC-Authentication-Results: i=1; strato.com;
arc=none;
dkim=none
X-RZG-CLASS-ID: mo00
X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpOT2vN+j99710EKugYHXkRHprwZvw=="
To: cygwin AT cygwin DOT com
Subject: ilogbl(NaN) is wrong
Date: Tue, 18 Apr 2023 13:21:33 +0200
Message-ID: <3634818.CpGBqz00pN@nimes>
MIME-Version: 1.0
X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_ASCII_DIVIDERS,
RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NONE, TXREP,
T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Bruno Haible via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Bruno Haible <bruno AT clisp DOT org>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

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

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

In Cygwin 3.4.6, the value of ilogbl(NaN) is not right.

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

int
main (void)
{
  volatile double x1;
  volatile long double x2;
  int y1;
  int y2;

  x1 = 0.0 / 0.0;
  y1 = ilogb (x1);

  x2 = 0.0L / 0.0L;
  y2 = ilogbl (x2);

  printf ("%d %d %d\n", y1, y2, FP_ILOGBNAN);

  if (!(y1 == FP_ILOGBNAN))
    abort ();

  /* This test fails in Cygwin 3.4.6.  */
  if (!(y2 == FP_ILOGBNAN))
    abort ();

  if (!(FP_ILOGBNAN == INT_MAX || FP_ILOGBNAN == INT_MIN))
    abort ();
}
===================================================================
$ gcc -Wall foo.c
$ ./a.exe

Expected output:
2147483647 2147483647 2147483647

Actual output:
2147483647 -2147483648 2147483647
Aborted (core dumped)

Bruno

PS: This is about the same function, but not the argument value, as in
https://cygwin.com/pipermail/cygwin/2019-December/243205.html




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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019