diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2017-10-17 21:44:16 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2017-10-17 21:44:16 +0300 |
commit | adf9117f975ab24f21ea6d11e555a83f1a218bf5 (patch) | |
tree | bcfab8e962a0377f45aae7700c6208b6a54ad7fd /test/forcenum.awk | |
parent | cf79df35d1569a1c1f60c51e66e2ab44566ea4d5 (diff) | |
parent | 9842a449bf7612c763790c34be7eef39774f63be (diff) | |
download | egawk-adf9117f975ab24f21ea6d11e555a83f1a218bf5.tar.gz egawk-adf9117f975ab24f21ea6d11e555a83f1a218bf5.tar.bz2 egawk-adf9117f975ab24f21ea6d11e555a83f1a218bf5.zip |
Merge branch 'master' into feature/fix-comments
Diffstat (limited to 'test/forcenum.awk')
-rw-r--r-- | test/forcenum.awk | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/test/forcenum.awk b/test/forcenum.awk index 1a7ddce7..d4ff5d5e 100644 --- a/test/forcenum.awk +++ b/test/forcenum.awk @@ -1,6 +1,17 @@ BEGIN { # make some strnums - nf = split("|5apple|+NaN| 6|0x1az|011Q|027", f, "|") - for (i = 1; i <= nf; i++) - printf "[%s] -> %g (type %s)\n", f[i], f[i], typeof(f[i]) + nf = split("|5apple|NaN|-NaN|+NaN| 6|0x1az|011Q|027", f, "|") + + for (i = 1; i <= nf; i++) { + # NaN values on some systems can come out with + # a sign in front of them. So instead of using %g to + # convert the strnum to a double, do it manually, and + # then remove any leading sign so that the test will + # work across systems. + val = f[i] + 0 + val = val "" + val = tolower(val) + sub(/^[-+]/, "", val) + printf "[%s] -> %s (type %s)\n", f[i], val, typeof(f[i]) + } } |