public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Print sign of NaN values.
@ 2017-06-07  9:58 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2017-06-07  9:58 UTC (permalink / raw)
  To: newlib-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=beb17b264b69e35763fbdf0a68fbf67343cfbb58

commit beb17b264b69e35763fbdf0a68fbf67343cfbb58
Author: Kito Cheng <kito.cheng@gmail.com>
Date:   Sat Jun 3 21:41:29 2017 +0800

    Print sign of NaN values.

Diff:
---
 newlib/libc/stdio/vfprintf.c  | 4 ++++
 newlib/libc/stdio/vfwprintf.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c
index ed92bb2..3585423 100644
--- a/newlib/libc/stdio/vfprintf.c
+++ b/newlib/libc/stdio/vfprintf.c
@@ -1245,6 +1245,8 @@ reswitch:	switch (ch) {
 				break;
 			}
 			if (isnan (_fpvalue)) {
+				if (signbit (_fpvalue))
+					sign = '-';
 				if (ch <= 'G') /* 'A', 'E', 'F', or 'G' */
 					cp = "NAN";
 				else
@@ -1276,6 +1278,8 @@ reswitch:	switch (ch) {
 				break;
 			}
 			if (expt == 1) {
+				if (signbit (_fpvalue))
+					sign = '-';
 				if (ch <= 'G') /* 'A', 'E', 'F', or 'G' */
 					cp = "NAN";
 				else
diff --git a/newlib/libc/stdio/vfwprintf.c b/newlib/libc/stdio/vfwprintf.c
index f0179a0..4786ed6 100644
--- a/newlib/libc/stdio/vfwprintf.c
+++ b/newlib/libc/stdio/vfwprintf.c
@@ -970,6 +970,8 @@ reswitch:	switch (ch) {
 				break;
 			}
 			if (isnan (_fpvalue)) {
+				if (signbit (_fpvalue))
+					sign = L'-';
 				if (ch <= L'G') /* 'A', 'E', 'F', or 'G' */
 					cp = L"NAN";
 				else
@@ -1001,6 +1003,8 @@ reswitch:	switch (ch) {
 				break;
 			}
 			if (expt == 1) {
+				if (signbit (_fpvalue))
+					sign = L'-';
 				if (ch <= L'G') /* 'A', 'E', 'F', or 'G' */
 					cp = L"NAN";
 				else


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-07  9:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-07  9:58 [newlib-cygwin] Print sign of NaN values Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).