aboutsummaryrefslogtreecommitdiffstats
path: root/node.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2018-07-13 13:59:40 +0300
committerArnold D. Robbins <arnold@skeeve.com>2018-07-13 13:59:40 +0300
commitc8bcf55be11e29d5df00013d2a267ce0ca2ba4c6 (patch)
tree1b0021d8c9ff8bacf94249e7016496cb9a5173e9 /node.c
parentd5d9470814e516fd04dd5a0122e8e4e702c767d9 (diff)
parent52e6f76e7c0199cf5ae64e4b23698884cc245912 (diff)
downloadegawk-c8bcf55be11e29d5df00013d2a267ce0ca2ba4c6.tar.gz
egawk-c8bcf55be11e29d5df00013d2a267ce0ca2ba4c6.tar.bz2
egawk-c8bcf55be11e29d5df00013d2a267ce0ca2ba4c6.zip
Merge branch 'master' into feature/fix-comments
Diffstat (limited to 'node.c')
-rw-r--r--node.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/node.c b/node.c
index 984cec81..54ea6627 100644
--- a/node.c
+++ b/node.c
@@ -219,10 +219,13 @@ r_format_val(const char *format, int index, NODE *s)
* < and > so that things work correctly on systems with 64 bit integers.
*/
- /* not an integral value, or out of range */
- if ((val = double_to_int(s->numbr)) != s->numbr
+ if (out_of_range(s)) {
+ const char *result = format_nan_inf(s, 'g');
+ return make_string(result, strlen(result));
+ } else if ((val = double_to_int(s->numbr)) != s->numbr
|| val <= LONG_MIN || val >= LONG_MAX
) {
+ /* not an integral value, or out of integer range */
/*
* Once upon a time, we just blindly did this:
* sprintf(sp, format, s->numbr);