aboutsummaryrefslogtreecommitdiffstats
path: root/node.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2015-04-26 22:41:07 +0300
committerArnold D. Robbins <arnold@skeeve.com>2015-04-26 22:41:07 +0300
commit20834c2a3086611f15814f24abfbb4b16d20275c (patch)
treeafb3fd232f7dfa0e70ccfe94f011a59d531f8a84 /node.c
parent559a3395fcb32cdee8a6cdf482656c0b78628f8a (diff)
parent1770ada8bd6e72dfd3138d72cd6049edca79a4f5 (diff)
downloadegawk-20834c2a3086611f15814f24abfbb4b16d20275c.tar.gz
egawk-20834c2a3086611f15814f24abfbb4b16d20275c.tar.bz2
egawk-20834c2a3086611f15814f24abfbb4b16d20275c.zip
Merge branch 'master' into feature/wasted-byte
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 2de93374..b15159f0 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;