CSE 123C
February 11, 2008
•
Long long score=10999999;
•
Long is the same as int
•
Unsigned int is a data type
o
Unsigned int x=1000;
o
Unsigned int uses a different range than signed int
•
One bit is used to tell you the sign of the number
•
Computers use a specified number of binary digits (bits) to represent integers
•
Unsigned integers
o
Represent integers from 0 to 2
maxbits
1
o
Represents the integer in binary and all bits represent the value of the
number
•
Two’s complement
o
Used to represent integers
o
Represent in binary
o
Switch 1 and 0
o
Add 1 to the new number
o
Example
127
0111111
switch 1 and 0
1000000
add 1 to new number 1000001
= 127
o
When
added together, should equal 0
•
Float Values
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Documento
Float values are represented in scientific notation with a mantissa and an
exponent
o
288.9= 2.889 * 10
2
= 2.889e2
0.0456= 4.56 * 10
2
= 4.56e2
o
Absolute value of mantissa must be between 1 and 10, not including 10
o
Exponent must be between 38 and 37
o
Mantissa and exponent are represented in binary in the memory
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '08
 elkarboutly
 #include, 16 bit, Exponent overflow Answer

Click to edit the document details