[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: One more question



Am Mon, 27 Dez 1999 hast Du wahrscheinlich geschrieben:
>Came in to my mind, Is there any better way to see if some integer is 
>+- 10 from another integer, than:
>
>if((a<b+11) && (a>b-11))

Nice:
if (abs(a-b)<10)
Dirty, perhaps faster:
if ((unsigned)10+a-b)<20)

Many greetings,
-- 
~ Philipp Gühring              p.guehring@poboxes.com
~ http://www.poboxes.com/p.guehring  ICQ UIN: 6588261
~ gcc perl.c -o perl -larry -Wall