aboutsummaryrefslogtreecommitdiffstats
path: root/node.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2015-04-26 22:38:57 +0300
committerArnold D. Robbins <arnold@skeeve.com>2015-04-26 22:38:57 +0300
commit020be4cb81b519a597acbf85e683cfb95993c2b9 (patch)
treea6df5c20262e0d679a0a4ab17c83c484e9ba1fe6 /node.c
parent6f250fa2a01864e07c1e9022f36eab740a2793c5 (diff)
parent1770ada8bd6e72dfd3138d72cd6049edca79a4f5 (diff)
downloadegawk-020be4cb81b519a597acbf85e683cfb95993c2b9.tar.gz
egawk-020be4cb81b519a597acbf85e683cfb95993c2b9.tar.bz2
egawk-020be4cb81b519a597acbf85e683cfb95993c2b9.zip
Merge branch 'master' into feature/regex-type
Diffstat (limited to 'node.c')
-rw-r--r--node.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/node.c b/node.c
index a5e06cd3..b9c751dd 100644
--- a/node.c
+++ b/node.c
@@ -138,11 +138,20 @@ r_force_number(NODE *n)
ptr++;
*cpend = save;
finish:
- if (errno == 0 && ptr == cpend) {
- n->flags |= newflags;
- n->flags |= NUMCUR;
+ if (errno == 0) {
+ if (ptr == cpend) {
+ n->flags |= newflags;
+ n->flags |= NUMCUR;
+ }
+ /* else keep the leading numeric value without updating flags */
} else {
errno = 0;
+ /*
+ * N.B. For subnormal values, strtod may return the
+ * floating-point representation while setting errno to ERANGE.
+ * We force the numeric value to 0 in such cases.
+ */
+ n->numbr = 0;
}
return n;