~ Question.
#5

here is my quick test
pawn Код:
printf("%d",~1);
result:-2
    printf("%d",~2);
result:-3
    printf("%d",~3);
result:-4
    printf("%d",~4);
result:-5
    printf("%d",~5);
result:-6
    printf("%d",~10);
result:-11
    printf("%d",~100);
result:-101
    printf("%d",~1000);
result:-1001
    printf("%d",~10000);
result:-10001
    printf("%d",~100000);
result:-100001
and reading up about it it takes the binary number and inverts the bits (ie 1010101 would become 0101010)
and then adds one

its seems to be a way or storing negitive numbers in binary
Reply


Messages In This Thread
~ Question. - by Zh3r0 - 01.02.2011, 18:11
Re: ~ Question. - by lavamike - 01.02.2011, 19:29
Re: ~ Question. - by Zh3r0 - 01.02.2011, 20:39
Re: ~ Question. - by MrDeath537 - 01.02.2011, 21:15
Re: ~ Question. - by (SF)Noobanatior - 02.02.2011, 05:03

Forum Jump:


Users browsing this thread: 2 Guest(s)