Java知识分享网 - 轻松学习从此开始!    

Java知识分享网

Java1234官方群25:java1234官方群17
Java1234官方群25:838462530
        
SpringBoot+SpringSecurity+Vue+ElementPlus权限系统实战课程 震撼发布        

最新Java全栈就业实战课程(免费)

springcloud分布式电商秒杀实战课程

IDEA永久激活

66套java实战课程无套路领取

锋哥开始收Java学员啦!

Python学习路线图

锋哥开始收Java学员啦!
当前位置: 主页 > Java文档 > Java基础相关 >

Computer Systems A Programmer'Perspective PDF 下载


分享到:
时间:2021-10-17 08:47来源:http://www.java1234.com 作者:转载  侵权举报
Computer Systems A Programmer'Perspective PDF 下载
失效链接处理
Computer Systems A Programmer'Perspective PDF 下载


本站整理下载:
提取码:sjyo 
 
 
相关截图:
 
主要内容:

Representing and Manipulating
Information
Modern computers store and process information represented as two-valued signals. These lowly binary
digits, or bits, form the basis of the digital revolution. The familiar decimal, or base-10, representation has
been in use for over 1000 years, having been developed in India, improved by Arab mathematicians in the
12th century, and brought to the West in the 13th century by the Italian mathematician Leonardo Pisano,
better known as Fibonacci. Using decimal notation is natural for ten-fingered humans, but binary values
work better when building machines that store and process information. Two-valued signals can readily
be represented, stored, and transmitted, for example, as the presence or absence of a hole in a punched
card, as a high or low voltage on a wire, or as a magnetic domain oriented clockwise or counterclockwise.
The electronic circuitry for storing and performing computations on two-valued signals is very simple and
reliable, enabling manufacturers to integrate millions of such circuits on a single silicon chip.
In isolation, a single bit is not very useful. When we group bits together and apply some interpretation that
gives meaning to the different possible bit patterns, however, we can represent the elements of any finite set.
For example, using a binary number system, we can use groups of bits to encode nonnegative numbers. By
using a standard character code, we can encode the letters and symbols in a document. We cover both of
these encodings in this chapter, as well as encodings to represent negative numbers and to approximate real
numbers.
We consider the three most important encodings of numbers. Unsigned encodings are based on traditional
binary notation, representing numbers greater than or equal to 0. Two’s complement encodings are the most
common way to represent signed integers, that is, numbers that may be either positive or negative. Floating-
point encodings are a base-two version of scientific notation for representing real numbers. Computers
implement arithmetic operations such as addition and multiplication, with these different representations
similar to the corresponding operations on integers and real numbers.
Computer representations use a limited number of bits to encode a number, and hence some operations can
overflow when the results are too large to be represented. This can lead to some surprising results. For
example, on most of today’s computers, computing the expression
200 * 300 * 400 * 500
21
22 CHAPTER 2. REPRESENTING AND MANIPULATING INFORMATION
yields ? 884,901,888. This runs counter to the properties of integer arithmetic—computing the product of a
set of positive numbers has yielded a negative result.
On the other hand, integer computer arithmetic satisfies many of the familiar properties of true integer arith-
metic. For example, multiplication is associative and commutative, so that computing all of the following C
expressions yields ? 884,901,888:
(500 * 400) * (300 * 200)
((500 * 400) * 300) * 200
((200 * 500) * 300) * 400
400 * (200 * (300 * 500))
The computer might not generate the expected result, but at least it is consistent!
Floating point arithmetic has altogether different mathematical properties. The product of a set of positive
numbers will always be positive, although overflow will yield the special value +1 . On the other hand,
floating point arithmetic is not associative due to the finite precision of the representation. For example,
the C expression (3.14+1e20)-1e20 will evaluate to 0.0 on most machines, while 3.14+(1e20-
1e20) will evaluate to 3.14.
By studying the actual number representations, we can understand the ranges of values that can be repre-
sented and the properties of the different arithmetic operations. This understanding is critical to writing
programs that work correctly over the full range of numeric values and that are portable across different
combinations of machine, operating system, and compiler. Our treatment of this material is very mathe-
matical. We start with the basic definitions of the encodings and then derive such properties as the range of
representable numbers, their bit-level representations, and the properties of the arithmetic operations. We
believe it is important to examine this material from such an abstract viewpoint, because programmers need
to have a solid understanding of how computer arithmetic relates to the more familiar integer and real arith-
metic. Although it may appear intimidating, the mathematical treatment requires just an understanding of
basic algebra. We recommend working the practice problems as a way to solidify the connection between
the formal treatment and some real-life examples.
We derive several ways to perform arithmetic operations by directly manipulating the bit-level representa-
tions of numbers. Understanding these techniques will be important for understanding the machine-level
code generated when compiling arithmetic expressions.
The C++ programming language is built upon C, using the exact same numeric representations and opera-
tions. Everything said in this chapter about C also holds for C++. The Java language definition, on the other
hand, created a new set of standards for numeric representations and operations. Whereas the C standard is
designed to allow a wide range of implementations, the Java standard is quite specific on the formats and
encodings of data. We highlight the representations and operations supported by Java at several places in
the chapter.

 

------分隔线----------------------------

锋哥公众号


锋哥微信


关注公众号
【Java资料站】
回复 666
获取 
66套java
从菜鸡到大神
项目实战课程

锋哥推荐