Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
MPLS: allow 16 as a valid output label
[vpp.git]
/
src
/
vppinfra
/
format.c
diff --git
a/src/vppinfra/format.c
b/src/vppinfra/format.c
index
999b093
..
e2fd84b
100644
(file)
--- a/
src/vppinfra/format.c
+++ b/
src/vppinfra/format.c
@@
-62,6
+62,7
@@
#include <vppinfra/error.h>
#include <vppinfra/string.h>
#include <vppinfra/os.h> /* os_puts */
#include <vppinfra/error.h>
#include <vppinfra/string.h>
#include <vppinfra/os.h> /* os_puts */
+#include <vppinfra/math.h>
typedef struct
{
typedef struct
{
@@
-462,6
+463,17
@@
fformat (FILE * f, char *fmt, ...)
}
#ifdef CLIB_UNIX
}
#ifdef CLIB_UNIX
+void
+fformat_append_cr (FILE * ofp, const char *fmt, ...)
+{
+ va_list va;
+
+ va_start (va, fmt);
+ (void) va_fformat (ofp, (char *) fmt, &va);
+ va_end (va);
+ fformat (ofp, "\n");
+}
+
word
fdformat (int fd, char *fmt, ...)
{
word
fdformat (int fd, char *fmt, ...)
{
@@
-708,8
+720,12
@@
format_float (u8 * s, f64 x, uword n_fraction_digits, uword output_style)
sign = 1;
}
sign = 1;
}
+ /* Check for not-a-number. */
+ if (isnan (x))
+ return format (s, "%cNaN", sign ? '-' : '+');
+
/* Check for infinity. */
/* Check for infinity. */
- if (
x == x / 2
)
+ if (
isinf (x)
)
return format (s, "%cinfinity", sign ? '-' : '+');
x = normalize (x, &expon, &prec);
return format (s, "%cinfinity", sign ? '-' : '+');
x = normalize (x, &expon, &prec);