Thread: Binary numbers
View Single Post
Re: Binary numbers
Old
  (#6)
botmeister
Ex-Council Member
 
botmeister's Avatar
 
Status: Offline
Posts: 1,090
Join Date: Nov 2003
Location: Canada
Default Re: Binary numbers - 02-04-2004

Quote:
I cannot figure out how to use binary numbers without having to convert them to decimal first
All numbers are stored as binary values inside your computer, therefore a "conversion to decimal" is only a way of thinking about numbers, and not a real conversion to decimal.

I suggest that you get used to working with the hexadecimal representation instead of decimal or binary.

Why use Hex?
http://www.cs.ualberta.ca/~casey/c101/101notes/hex.html

Decimal to Hex table
http://www.jaworski.com/htmlbook/dec-hex.htm

C/C++ has all the operators you need to do bit level operations without resorting to inline asm code.

Arithmetic + Binary plus (add)
- Binary minus (subtract)
* Multiply
/ Divide
% Remainder (modulus)
Bitwise << Shift left
>> Shift right
& Bitwise AND
^ Bitwise XOR (exclusive OR)
| Bitwise inclusive OR
Logical && Logical AND
|| Logical OR
Assignment = Assignment
*= Assign product
/= Assign quotient
%= Assign remainder (modulus)
+= Assign sum
-= Assign difference
<<= Assign left shift
>>= Assign right shift
&= Assign bitwise AND
^= Assign bitwise XOR
|= Assign bitwise OR
Relational < Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
== Equal to
!= Not equal to


Maker of the (mEAn) Bot.Admin Manager

"In theory, there is no difference between theory and practice. But, in practice, there is." - Jan L.A. van de Snepscheut

Last edited by botmeister; 02-04-2004 at 08:31..
  
Reply With Quote