aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/expressions.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/expressions.c b/src/expressions.c
index 68049eb..de256df 100644
--- a/src/expressions.c
+++ b/src/expressions.c
@@ -561,6 +561,14 @@ gchar *
teco_expressions_format_float(gchar *buffer, teco_float_t number, guint precision)
{
/*
+ * fmod(1, 0) gives -nan on glibc and nan on FreeBSD.
+ * For printing, we normalize the output since the nan sign does
+ * not convey any meaning.
+ */
+ if (isnan(number))
+ number = NAN;
+
+ /*
* Do not print in scientific notation (with an exponent) - we cannot
* write such constants in SciTECO, so we don't want to format them either.
*/