Memory & Data
- Basic Unit is a bit
- Byte: 8 bits
- Data & instructions are stored in memory
Word: " natural unit of data in a processor "
unfortunately, in today's world you will encounter 16-, 32-, & 64-bit processors.
at present, a word is most often 32 bits.
Variable declaration
int someVar ;
- Byte: 8 bits
- Data & instructions are stored in memory
- Every byte of memory has a unique numeric address
- To fetch or store in formation, the CPU must specify the numeric address of the information.
Terminology
Byte: 8 bitsWord: " natural unit of data in a processor "
unfortunately, in today's world you will encounter 16-, 32-, & 64-bit processors.
at present, a word is most often 32 bits.
Variable declaration
int someVar ;
Java Data Types
*Java is a strongly typed language
Integer Types:
byte 1 - 2^7 2^7 - 1
short 2 -2^15 2^15 -1
int 4 -2^31 2^31 -1
long 8 -2^63 2^63 - 1
2^31 - 1 = 2,147,484,647
.4224 * 10^18
Current representation: IEEE 754
float occupies 4 bytes the range roughly is +- 3.4* 10^38 which gives us a 7 digit accuracy
double occupies 8 bytes, the range is roughly +11.7*10^308 15 digit accuracy.
(when evaluating range, accuracy, remember that 10 ~= 2^3.3
In 32 bits, there are 2^32 unique codes .
computer arithmetic has severe accuracy challenges.
*Java is a strongly typed language
Integer Types:
byte 1 - 2^7 2^7 - 1
short 2 -2^15 2^15 -1
int 4 -2^31 2^31 -1
long 8 -2^63 2^63 - 1
2^31 - 1 = 2,147,484,647
Floating Point
42.24 *10^16.4224 * 10^18
Current representation: IEEE 754
float occupies 4 bytes the range roughly is +- 3.4* 10^38 which gives us a 7 digit accuracy
double occupies 8 bytes, the range is roughly +11.7*10^308 15 digit accuracy.
(when evaluating range, accuracy, remember that 10 ~= 2^3.3
In 32 bits, there are 2^32 unique codes .
computer arithmetic has severe accuracy challenges.
No comments:
Post a Comment