in reply to Re: comparison of packed signed integers
in thread comparison of packed signed integers
I'm not sure that will work if negative numbers come into it.
knoppix@Microknoppix:~$ perl -E ' > $pos = pack q{N}, 10000; > say unpack q{B*}, $pos; > $neg = pack q{N}, -10000; > say unpack q{B*}, $neg; > say $pos gt $neg ? q{Good} : q{Bad};' 00000000000000000010011100010000 11111111111111111101100011110000 Bad knoppix@Microknoppix:~$
You'd probably have to expand the tests to cater for that.
Cheers,
JohnGG
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: comparison of packed signed integers
by BrowserUk (Patriarch) on Oct 30, 2011 at 12:00 UTC | |
by johngg (Canon) on Oct 30, 2011 at 12:28 UTC | |
by BrowserUk (Patriarch) on Oct 30, 2011 at 12:33 UTC |