From owner-freebsd-standards@FreeBSD.ORG Thu Dec 25 19:35:37 2014 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F456414 for ; Thu, 25 Dec 2014 19:35:37 +0000 (UTC) Received: from mail-ie0-f181.google.com (mail-ie0-f181.google.com [209.85.223.181]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 555A76480D for ; Thu, 25 Dec 2014 19:35:36 +0000 (UTC) Received: by mail-ie0-f181.google.com with SMTP id rl12so7144091iec.40 for ; Thu, 25 Dec 2014 11:35:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; bh=rpYr4n8jLeb5bumYzyY9AEv18S9rXEGkX0qGDhMlhmI=; b=bntshxBoi1hdO1lRp6OOY3CdB5NGR670AwubnBNKiu1gA3/LwPyofGTthVE6Rqw3Ex zQVbHRf0J9eIMp0mL4TRhhcXh4sqQXtgvx9QnnQH8znITMfe+kdXqxDmgBhdQ5sDqbmN vJbbgZMNdfKNeC0lkRd2QOgwhuRNaCWI8iTdSJk8HwaBVCl70Lb3Cjsdfq1+/cIozuf6 GFrGDRl07roi8DUEghQaNnAdJS0HKTZhengroaMu1ZGle5xWSuLZunfc1RJ9gU3heLdu CtL6X2BhsF2m3ukx+z8ffQwcuaNKTT+185+QbWZVc7zg8BhHbjz3PtajekzMZHCQobT8 QKBA== X-Gm-Message-State: ALoCoQkvtKkjJNZBCym6LdM9xcITVwAM0u82VLp2w72HICeIICn1rJFavUeI69NeSEXVTU3sRpD+ X-Received: by 10.50.28.20 with SMTP id x20mr31835508igg.27.1419536130571; Thu, 25 Dec 2014 11:35:30 -0800 (PST) Received: from netflix-mac-wired.bsdimp.com ([50.253.99.174]) by mx.google.com with ESMTPSA id qr1sm9626600igb.18.2014.12.25.11.35.29 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Dec 2014 11:35:29 -0800 (PST) Sender: Warner Losh Subject: Re: Does posix say anything about the sign in NaNs ? Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Content-Type: multipart/signed; boundary="Apple-Mail=_BC4BA5D4-07DC-4C31-88B1-B87C64A07005"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.5b3 From: Warner Losh In-Reply-To: <003E7D36-61E0-4572-A98C-24351F6ADF5A@freebsd.org> Date: Thu, 25 Dec 2014 12:35:27 -0700 Message-Id: <2A81225A-09C3-4DFF-A4DA-6B440AFFB857@bsdimp.com> References: <549B1115.8000909@FreeBSD.org> <20141225235228.H927@besplex.bde.org> <003E7D36-61E0-4572-A98C-24351F6ADF5A@freebsd.org> To: Pedro Giffuni X-Mailer: Apple Mail (2.1993) Cc: freebsd-standards@freebsd.org X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Dec 2014 19:35:37 -0000 --Apple-Mail=_BC4BA5D4-07DC-4C31-88B1-B87C64A07005 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Dec 25, 2014, at 7:53 AM, Pedro Giffuni wrote: >=20 > Hello; >=20 >> Il giorno 25/dic/2014, alle ore 09:00, Bruce Evans = ha scritto: >>=20 >> On Wed, 24 Dec 2014, Pedro Giffuni wrote: >>=20 >>> I got the attached patch from OpenBSD. >>>=20 >>> It says: >>> ____ >>> Show the sign for NaN as per POSIX; from Elliott Hughes. >>> ok martynas@, millert@, doug@ >>> ____ >>>=20 >>> I can't find a reference in POSIX documentation to support it = though. >>=20 >> The behaviour is implementation-defined. =46rom n869.txt for printf: >>=20 >> X A double argument representing an infinity is >> X converted in one of the styles [-]inf or [-]infinity >> X -- which style is implementation-defined. A >> X double argument representing a NaN is converted in >> X one of the styles [-]nan or [-]nan(n-char-sequence) >> X -- which style, and the meaning of any n-char- >> X sequence, is implementation-defined. The F >> X conversion specifier produces INF, INFINITY, or NAN >> X instead of inf, infinity, or nan, respectively.220) >>=20 >> "style" is not clearly defined. The format for input in strtod() >> is formally defined as [-]something without using the term "style", >> but the specication for actually handling the minus sign is even less >> complete (see below). >>=20 >> The library intentionally suppresses the sign for NaNs on output. >> This is consistent with it ignororing the sign for NaNs on input. >>=20 >=20 >=20 > Interesting and pretty much the reason why I wanted to discuss the = change. >=20 > I can see the sign information is important for infinity but indeed it = makes > very little sense (if any) for NaN. OTOH, we are doing an extra = assignment > to hide something the standard permits. If we are ignoring the sign of = NaNs > on input there should be no such sign information in the first place = and > ignoring the value is unnecessary. >=20 > While I am tempted to follow the change, I think it is pretty much = innocuous > as no reasonably correct program should depend on the sign of NaN. My only concern with this change is that numeric programs might actually = break because they know this implementation detail. Its here some way to = discover if things my pysci or R have any change in behavior here? In = addition to the standard, numerical methods have much apocrypha = associated with them. Warner --Apple-Mail=_BC4BA5D4-07DC-4C31-88B1-B87C64A07005 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJUnGcAAAoJEGwc0Sh9sBEAqFIP/R5A7n+RmWNgOOb5SLpdOvN6 zUBZaIQeDCakL6cblVH9Uea9MmyjnRjka1Z/IZAnuhJFZwTK3cJOauUI103DdT57 qDCqwZi27FVlQbcjk5hzBAyE8lvdw79xd2VyyUv6wP9PyU9ZMuY89OHCWy9WeKvT R98jDJ1zvZzREIEI2nVhYmlrNZAuehLpU+h44mP1Ob5vWZOt5ASojFyfSPZWgDqJ SVgkiAxKWoGTQhjqr57RTGsmGpKXp8YV5B2AhI0sI+DWhHBblp7+N/6XmWBZZa4D fjTmeixsfagdFa2n8PhBhMBW4EtG5UtfU/oU1M0Mmvz816WDibfblFRBYPAUAScV RNkPU1lT4Z4RLUf+7E3KOxXZWYQWLtxnAU5sjSGxW7FQ9xlxvU7+wKjCIIslvieM gyLpz4mKlflWqpmbu5f4mV7EXXPr7R7USGtoxoa+f9YjI04rWreQ4PNwl763IFeL U3ghktFjJUG8luMEEemYM2uaTOUxS0MfWlbrkO3VoFUdFsgO04DkI+Oxl1gnlDP0 A2a9HnTb2npCZc9ndlHa7nb96jjUVlVz90GeXFmgSNPE8F0q3KPnYnOzxRwE9aKF f0e38gep0BlDv4l/byxhYNDXCIo3vGcAhgH2W1uOxjmDI8TQ2J8FYc07KfMIBQTl 81ZHzSVhu48ifuoOa0Fp =C5kF -----END PGP SIGNATURE----- --Apple-Mail=_BC4BA5D4-07DC-4C31-88B1-B87C64A07005--