~vcs-imports/gawk/master

« back to all changes in this revision

Viewing changes to test/forcenum.awk

  • Committer: Andrew J. Schorr
  • Date: 2014-08-03 18:44:47 UTC
  • mfrom: (408.7.1)
  • mto: (408.2.352)
  • mto: This revision was merged to the branch mainline in revision 507.
  • Revision ID: git-v1:ff21da5c7f072a69e9582f1a7ae2039f27f564cf
Merge branch 'gawk-4.1-stable' to get --profile to work with -M.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
BEGIN {
2
 
        # make some strnums
3
 
        nf = split("|5apple|NaN|-NaN|+NaN| 6|0x1az|011Q|027", f, "|")
4
 
 
5
 
        for (i = 1; i <= nf; i++) {
6
 
                # NaN values on some systems can come out with
7
 
                # a sign in front of them. So instead of using %g to
8
 
                # convert the strnum to a double, do it manually, and
9
 
                # then remove any leading sign so that the test will
10
 
                # work across systems.
11
 
                val = f[i] + 0
12
 
                val = val ""
13
 
                val = tolower(val)
14
 
                sub(/^[-+]/, "", val)
15
 
                printf "[%s] -> %s (type %s)\n", f[i], val, typeof(f[i])
16
 
        }
17
 
}