$ awk 'BEGIN{ pat111=0x1000000002E3E02; snBegin=0x1000000002E3E01; if (pat111<=snBegin) printf "a\n"}'
a
Result is not correct.
Looks like the number is too big.
Any idea?
Thx!
$ awk 'BEGIN{ pat111=0x1000000002E3E02; snBegin=0x1000000002E3E01; if (pat111<=snBegin) printf "a\n"}'
a
Result is not correct.
Looks like the number is too big.
Any idea?
Thx!
Looks like a bug in awk
awk 'BEGIN{ pat111=sprintf ("%d", 0x1000000002E3E02); snBegin=sprintf("%d",0x1000000002E3E01);print pat111;print snBegin; if (pat111<=snBegin) printf "a\n"}'
72057594040958464
72057594040958464
a
$ awk 'BEGIN{printf "%X", 72057594040958464}'
1000000002E3E00
$ awk 'BEGIN{printf "%X", 72057594040958465}'
1000000002E3E00
$ echo $((0x1000000002E3E02))
72057594040958466
$ echo $((0x1000000002E3E01))
72057594040958465
I believe this is an implementation limit, not a bug, i.e. these numbers are large for awk.
You may use Perl though:
perl -le'
$pat111 = 0x1000000002E3E02;
$snBegin = 0x1000000002E3E01;
$pat111 <= snBegin
and print " ... "
'