aboutsummaryrefslogtreecommitdiffstats
path: root/node.c
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2015-04-16 12:44:14 -0400
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2015-04-16 12:44:14 -0400
commit58dc708e3faa4aa46f81578a9a0ace4f0f7cad69 (patch)
tree82a3ac6b82bc718054313495e629d3d270a90e43 /node.c
parentaaa85643b352f867cfe7198f313b4481ad1f544d (diff)
parente934ad609d3639152324a4211857d87f228cf938 (diff)
downloadegawk-58dc708e3faa4aa46f81578a9a0ace4f0f7cad69.tar.gz
egawk-58dc708e3faa4aa46f81578a9a0ace4f0f7cad69.tar.bz2
egawk-58dc708e3faa4aa46f81578a9a0ace4f0f7cad69.zip
Merge branch 'gawk-4.1-stable'
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;