Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKito Cheng <kito.cheng@gmail.com>2017-06-03 16:41:29 +0300
committerCorinna Vinschen <corinna@vinschen.de>2017-06-07 12:50:31 +0300
commitbeb17b264b69e35763fbdf0a68fbf67343cfbb58 (patch)
treef3dabd096824b8404843e128bf8779cc6a7c84ff /newlib/libc/stdio
parent105436deada6be04d1df199e7281f1d0dbb929b0 (diff)
Print sign of NaN values.
Diffstat (limited to 'newlib/libc/stdio')
-rw-r--r--newlib/libc/stdio/vfprintf.c4
-rw-r--r--newlib/libc/stdio/vfwprintf.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c
index ed92bb2f9..3585423af 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 f0179a014..4786ed6a9 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