In setfval(), ensure that arithmetic never yields a negative zero
result. Now {echo | awk '{print -1 * 0}'} prints "0" instead of "-0". Fixes PR 36831. Discussed in tech-userlevel.
This commit is contained in:
parent
2b4f2c9caf
commit
22d0439909
1
dist/nawk/tran.c
vendored
1
dist/nawk/tran.c
vendored
@ -285,6 +285,7 @@ Awkfloat setfval(Cell *vp, Awkfloat f) /* set float val of a Cell */
|
||||
{
|
||||
int fldno;
|
||||
|
||||
f += 0.0; /* normalise negative zero to positive zero */
|
||||
if ((vp->tval & (NUM | STR)) == 0)
|
||||
funnyvar(vp, "assign to");
|
||||
if (isfld(vp)) {
|
||||
|
Loading…
Reference in New Issue
Block a user