Skip to content

Commit 322d428

Browse files
galaknashif
authored andcommitted
newlib: Pull in fix for nan printf
Pull in fix from upstream newlib for how NaNs are printed to match C std. Signed-off-by: Kumar Gala <[email protected]>
1 parent bb23e71 commit 322d428

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
From 6d7e0b337c16421a460ab0594db67bdecb377c67 Mon Sep 17 00:00:00 2001
2+
From: Kumar Gala <[email protected]>
3+
Date: Thu, 12 Jul 2018 13:13:53 -0500
4+
Subject: [PATCH] Print sign of NaN values to nano-vfprintf.
5+
6+
Signed-off-by: Kumar Gala <[email protected]>
7+
---
8+
newlib/libc/stdio/nano-vfprintf_float.c | 2 ++
9+
1 file changed, 2 insertions(+)
10+
11+
diff --git a/newlib/libc/stdio/nano-vfprintf_float.c b/newlib/libc/stdio/nano-vfprintf_float.c
12+
index 98893e97b..071a09edc 100644
13+
--- a/newlib/libc/stdio/nano-vfprintf_float.c
14+
+++ b/newlib/libc/stdio/nano-vfprintf_float.c
15+
@@ -213,6 +213,8 @@ _printf_float (struct _reent *data,
16+
}
17+
if (isnan (_fpvalue))
18+
{
19+
+ if (_fpvalue < 0)
20+
+ pdata->l_buf[0] = '-';
21+
if (code <= 'G') /* 'A', 'E', 'F', or 'G'. */
22+
cp = "NAN";
23+
else
24+
--
25+
2.14.4
26+

0 commit comments

Comments
 (0)