[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Arithmetic strange behaviour on numbers bigger than 0xFFFFFFFFFFFFF
From: |
BEAUGY Alexandre |
Subject: |
Arithmetic strange behaviour on numbers bigger than 0xFFFFFFFFFFFFF |
Date: |
Mon, 15 Nov 2010 17:53:20 +0100 |
Dear all,
Today, I experienced the following strange behaviour of gawk:
$ gawk 'BEGIN{x=0xA000000000000}{++x}{print x}' input.file
2814749767106561
2814749767106562
2814749767106563
2814749767106564
$ gawk 'BEGIN{x=0xA0000000000000}{++x}{print x}' input.file
45035996273704960
45035996273704960
45035996273704960
45035996273704960
How could that be? Why is my counter incremented in one case and not in
the other one? Did I correctly use awk? Or didn't I?
I read that gawk was able to manipulate 64-bits integer. That's why I
incremented such a big counter, in my awk script.
Thanks a lot in advance.
Regards,
--
Alexandre BEAUGY
- Arithmetic strange behaviour on numbers bigger than 0xFFFFFFFFFFFFF,
BEAUGY Alexandre <=