Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Dec 2014 14:16:37 -0500
From:      Pedro Giffuni <pfg@FreeBSD.org>
To:        freebsd-standards@FreeBSD.org
Subject:   Does posix say anything about the sign in NaNs ?
Message-ID:  <549B1115.8000909@FreeBSD.org>

index | next in thread | raw e-mail

[-- Attachment #1 --]
Hello;

I got the attached patch from OpenBSD.

It says:
____
Show the sign for NaN as per POSIX; from Elliott Hughes.
ok martynas@, millert@, doug@
____

I can't find a reference in POSIX documentation to support it though.

Anyone has a reason why we shouldn't adopt it, or a reference I can quote
on the commit log?

Regards,

Pedro.

ps. Merry Christmas to everyone !!


[-- Attachment #2 --]
Index: lib/libc/stdio/vfprintf.c
===================================================================
--- lib/libc/stdio/vfprintf.c	(revision 276188)
+++ lib/libc/stdio/vfprintf.c	(working copy)
@@ -721,10 +721,9 @@
 			if (signflag)
 				sign = '-';
 			if (expt == INT_MAX) {	/* inf or nan */
-				if (*cp == 'N') {
+				if (*cp == 'N')
 					cp = (ch >= 'a') ? "nan" : "NAN";
-					sign = '\0';
-				} else
+				else
 					cp = (ch >= 'a') ? "inf" : "INF";
 				size = 3;
 				flags &= ~ZEROPAD;
Index: lib/libc/stdio/vfwprintf.c
===================================================================
--- lib/libc/stdio/vfwprintf.c	(revision 276188)
+++ lib/libc/stdio/vfwprintf.c	(working copy)
@@ -788,10 +788,9 @@
 			if (signflag)
 				sign = '-';
 			if (expt == INT_MAX) {	/* inf or nan */
-				if (*cp == 'N') {
+				if (*cp == 'N')
 					cp = (ch >= 'a') ? L"nan" : L"NAN";
-					sign = '\0';
-				} else
+				else
 					cp = (ch >= 'a') ? L"inf" : L"INF";
 				size = 3;
 				flags &= ~ZEROPAD;
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?549B1115.8000909>