| www.delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:date:from:to:cc:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; q=dns; s= | |
| default; b=KmbOuungbks7Mq41fo2WxiDzjt6fpiT541Wz/yB0Q1eW+Ru1FgMFO | |
| 28gN464aN5hSM8epz1UgjpW4zFDV33NnxaUekU356pekJhVtuGZuG964/y3uUPPl | |
| KqG+k/yUQWdvSJKnQzIIFBWyjGEGF+NZdMqmXgCWe48152gWYv/LiU= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:date:from:to:cc:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; s=default; | |
| bh=a3/9tKPojfn649tWFhH3b6AS3sQ=; b=pey7ss6e/R+W/685E7e+WH5ruXl6 | |
| loBKmcB4kVodmwJ1+1fZknTWHJwb9qdlxR9RAPOVriaOR7+wMhrEpv1yhw/0+/qW | |
| 4qXMHAzEutVQBWg4141HZFCIyBOnprdrIerzwQ8fqd8L4bXyB+m66SbTEgo9gmtE | |
| fAA2bsnc2CWCw+U= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Authentication-Results: | sourceware.org; auth=none |
| X-Spam-SWARE-Status: | No, score=-103.1 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1870, historical, day |
| X-HELO: | mout.kundenserver.de |
| Date: | Mon, 16 Dec 2019 11:01:22 +0100 |
| From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
| To: | Bruno Haible <bruno AT clisp DOT org> |
| Cc: | cygwin AT cygwin DOT com |
| Subject: | Re: ilogbl(0.0L) value is wrong |
| Message-ID: | <20191216100122.GM10310@calimero.vinschen.de> |
| Reply-To: | cygwin AT cygwin DOT com |
| Mail-Followup-To: | Bruno Haible <bruno AT clisp DOT org>, cygwin AT cygwin DOT com |
| References: | <2040599 DOT 24iSPLvMXZ AT omega> |
| MIME-Version: | 1.0 |
| In-Reply-To: | <2040599.24iSPLvMXZ@omega> |
--imjhCm/Pyz7Rq5F2
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Hi Bruno,
On Dec 12 11:26, Bruno Haible wrote:
> POSIX [1] specifies that the return value of the functions ilogbf(), ilog=
b(),
> ilogbl() for a zero argument should all be the same, namely FP_ILOGB0.
>=20
> [1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/ilogb.html
>=20
> In Cygwin 2.9, the value of ilogbl(0.0L) is not right.
>=20
> How to reproduce:
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D foo.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> #include <stdio.h>
> #include <float.h>
> #include <math.h>
>=20
> int main ()
> {
> int x =3D ilogbf (0.0f);
> int y =3D ilogb (0.0);
> int z =3D ilogbl (0.0L);
> printf ("%d\n%d\n%d\n%d\n", x, y, z, FP_ILOGB0);
> }
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> $ gcc -Wall foo.c
> $ ./a.exe
>=20
> Expected output: four times the same number.
> Actual output:
>=20
> -2147483647
> -2147483647
> -2147483648
> -2147483647
Oh well. Again, this is upstream code, this time taken almost verbatim
from
https://sourceforge.net/projects/mingw-w64/
I don't see any upstream patch indicating that ilogbl has been changed,
but checking the glibc source I found that the x86{_64} assembler code
apparently needs another check to allow returning FP_ILOGB0 in this
scenario.
However, it looks like this is a Cygwin/newlib problem only, given that
FP_ILOGB0 is defined as 0x80000000 in Mingw-w64, but (for historical
reasons I assume) as 0x80000001 in newlib. The Mingw-w64 code already
returns 0x80000000 without this extra check. Weird that glibc needs
it, though...
I pushed this patch:
https://sourceware.org/git/?p=3Dnewlib-cygwin.git;a=3Dcommitdiff;h=3D29ba=
52da9553
Please test the latest developer snapshot from https://cygwin.com/snapshots/
I'll hold back the 3.1.0 release for a day or two. Maybe we can fix
the strtold problem as well.
Thanks,
Corinna
--=20
Corinna Vinschen
Cygwin Maintainer
--imjhCm/Pyz7Rq5F2
Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAl33VfIACgkQ9TYGna5E
T6B/qQ//QDCWdvMteL0BKQpPt69aBFdbBcrnPHaOE5Hyrr8iHe55OySKSait9Vpw
ANvKF9UlnWnWLMG9j0KKYaM4bhKEI83ZlW+sMM5iIAnTK4bhjgV6tEI76GcMHDD8
qmlhEt8lcLeLwgsW3LuXRRBStt4lpV8a3wsUgZ+ZBRyP0uUY1S0B/B/Y2JRfeU8h
80zjPSFZtpfKtrM0NQusTXTJ/0AHf46QyLAgJcjmEGKwNBUBbsL6jrWvI5XeT3m/
EP+M5aHmmJOtmPVdfywIv6m/2ZXti6mCHNlxLAObrdBqPxNQKta+/oY+vB9laCc9
7ovxfFZfKnU5ecjIlbuYT9yWf/s8I5KGyWt1k1vmUVf8O9SuJS7JpzJ8Ag1fNjZa
6r6vWlvPf0j9GJtyPT5xuPwdSA3AiO+Sp9Hfk3n5P5qwi7RKPMynrGm13rSyycZn
28BoBgE0mBQ3B8EGrID9obY1IDAKaIUys8vYd/fih44M1+Vz+TLNO7vdW76AAGyt
oBrBrAbl2gkJgG5UvJG5M2l5Ke876m+Au17bHUESHZoLvSQGZTaQg5GA8cXwLg9E
lnUCdMDpZpoV29Cczu3OSQ8QfNdl5Zh+IcyumtaOzEkhVw9YyInBsQnH3xrHK48H
36EbWrryHvxBKCSksuef7fNymhDBglaFzfLk+tMjtcELXItR59M=
=snE0
-----END PGP SIGNATURE-----
--imjhCm/Pyz7Rq5F2--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |