I am trying to find the maximum value of a column of data using gawk:
gawk 'BEGIN{max=0} {if($1>0+max) max=$1} END {print max}' dataset.dat where dataset.dat looks like this:
2.0
2.0e-318
The output of the command is
2.0e-318
which is clearly smaller than 2.
Where is my mistake?
Edit
Interestingly enough, if you swap the rows of the input file, the output becomes
2.0
Edit 2
My gawk version is GNU Awk 4.2.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.1.2).