bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Field changed to numeric in assignment when Arbitrary-Precision (-M) is


From: Jin Chen
Subject: Field changed to numeric in assignment when Arbitrary-Precision (-M) is on
Date: Sun, 27 Jun 2021 18:19:32 +1000

Hi, 

When enable the arbitrary precision arithmetic with gawk, it apparently 
alters field's type into numeric during comparision. This has impact on 
following assignment. The data file and awk file are listed at the end 
of this email.

>gawk -M -f ./verify.awk data.csv 
0,r1f1,r1f2
0,r2f1,r2f2

while 
>gawk -f ./verify.awk data.csv 
r1f1,r1f1,r1f2
r2f1,r2f1,r2f2

Below is the awk file and data file.

verify.awk:
---------------
BEGIN { FS=","; OFS=",";  }

{ "test" == $1
  field1 = $1
  field2 = $2
  print field1,$1,field2
}

data.csv:
--------
r1f1,r1f2
r2f1,r2f2


My gawk version is

GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.1)
Copyright (C) 1989, 1991-2020 Free Software Foundation.

My OS is 

Arch Linux 
Linux 5.10.24-1-lts #1 SMP Wed, 17 Mar 2021 16:53:52 +0000 x86_64 
GNU/Linux

Regards,

Jin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]