From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by sourceware.org (Postfix) with ESMTP id 0909B3885C3E for ; Thu, 19 Mar 2020 15:43:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0909B3885C3E Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-378-7L_seloSNbezvscwfFGarg-1; Thu, 19 Mar 2020 11:43:10 -0400 X-MC-Unique: 7L_seloSNbezvscwfFGarg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 696AE97847; Thu, 19 Mar 2020 15:43:09 +0000 (UTC) Received: from calimero.vinschen.de (ovpn-112-139.ams2.redhat.com [10.36.112.139]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 34D5ABBBD7; Thu, 19 Mar 2020 15:43:09 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id 9CC79A8045B; Thu, 19 Mar 2020 16:43:07 +0100 (CET) Date: Thu, 19 Mar 2020 16:43:07 +0100 From: Corinna Vinschen To: Fabian Schriever Cc: newlib@sourceware.org Subject: Re: [PATCH] Fix modf/f for NaN input Message-ID: <20200319154307.GF778468@calimero.vinschen.de> Reply-To: newlib@sourceware.org Mail-Followup-To: Fabian Schriever , newlib@sourceware.org References: <20200318131820.1269-1-fabian.schriever@gtd-gmbh.de> MIME-Version: 1.0 In-Reply-To: <20200318131820.1269-1-fabian.schriever@gtd-gmbh.de> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Xm/fll+QQv+hsKip" Content-Disposition: inline X-Spam-Status: No, score=-25.2 required=5.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Mar 2020 15:43:16 -0000 --Xm/fll+QQv+hsKip Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mar 18 14:18, Fabian Schriever wrote: > For NaN input the modf/f procedures should return NaN instead of zero > with the sign of the input. > --- > newlib/libm/common/s_modf.c | 1 + > newlib/libm/common/sf_modf.c | 1 + > 2 files changed, 2 insertions(+) >=20 > diff --git a/newlib/libm/common/s_modf.c b/newlib/libm/common/s_modf.c > index 8551a99e4..c948b8525 100644 > --- a/newlib/libm/common/s_modf.c > +++ b/newlib/libm/common/s_modf.c > @@ -100,6 +100,7 @@ static double one =3D 1.0; > =09} else if (j0>51) {=09=09/* no fraction part */ > =09 __uint32_t high; > =09 *iptr =3D x*one; > +=09 if (__fpclassifyd(x) =3D=3D FP_NAN) return x+x; /* x is NaN, retu= rn NaN */ > =09 GET_HIGH_WORD(high,x); > =09 INSERT_WORDS(x,high&0x80000000,0);=09/* return +-0 */ > =09 return x; > diff --git a/newlib/libm/common/sf_modf.c b/newlib/libm/common/sf_modf.c > index 6c64e3fa0..ae970762b 100644 > --- a/newlib/libm/common/sf_modf.c > +++ b/newlib/libm/common/sf_modf.c > @@ -52,6 +52,7 @@ static float one =3D 1.0; > =09} else {=09=09=09/* no fraction part */ > =09 __uint32_t ix; > =09 *iptr =3D x*one; > +=09 if (__fpclassifyf(x) =3D=3D FP_NAN) return x+x; /* x is NaN, retu= rn NaN */ > =09 GET_FLOAT_WORD(ix,x); > =09 SET_FLOAT_WORD(x,ix&0x80000000);=09/* return +-0 */ > =09 return x; > --=20 > 2.24.1.windows.2 >=20 Pushed. Thanks, Corinna --=20 Corinna Vinschen Cygwin Maintainer Red Hat --Xm/fll+QQv+hsKip Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAl5zkwsACgkQ9TYGna5E T6CWsRAAoJLWoVF0bANoNhSFY8mPCHESy2QzIgXte+SyGr92uZ67ssGxm0R9l30R pth5S7e7G1KPitdolvUcU7JOyX7bAHtieR/WHYkxZrIMhdz/o+5RRYBQ60laIKYF 4TCIr69iGS0wDRTpQptE78daO5g0XGk3RDAFHQWF8l1Etbkzj6ruBHTEm172oA7L HMTc/NawlI/jIVT/9dYvnPMS7NqvKLsW755xQTGtfD0na4X2Z7SatVMvs5caoCVL O+fBpqLjE0yUyPOlN/uvcGayn2OT53x3DqhYVInD67W4IJHKfqznNvLyRF1ey/ia 9NHwxVijTjAK1fVv36UjAPqW/YM/nU/oYF1jxmTSKnRdXZ21O9J8muklBl3cMZ1L Mg13eMvrOWwcweMoSfgCX3i/i1aqlUEb1Tsu/KhsSrFuf9Au3NbGn/Y/NZ9ZyMPO xGe23RBo5OlUT7o/EYhkg/uje2t8hNAo97F9X30nKZcjRZnBdHtygmYahqyUrlIV eJq4XFRfe0RFfGJO/zTX24FjP6FuZ8zZc0BeGGBjBK7okteE/gbm5NbsTMCr5xn2 pThoostTwYWbZ9vqSt+q10ZeREaUu3Gc+yyiNVMZxRZNmfEcgC6dFdLS5f62Quiw v0hT+rteQnAhfV4+/jaPww1f9fLwrsSVW28Bf06v9sWD6aP2A7w= =abqu -----END PGP SIGNATURE----- --Xm/fll+QQv+hsKip--