12.07.2015 Views

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

computational science basics 17TABLE 1.3Tag Forms for javadoc@author Loren Rose@version 12.3@parameter sum@exception @return weight for trap integration@see Before classBefore classBefore methodBefore methodBefore methodBefore methodmust contain key words, such as @param. The documentation page in Figure 1.6 isnamed TrapMethods.html and is produced by operating on the TrapMethods.javafile with the javadoc command% javadoc DocDemo.java Create documentationNot visible in the figure are the specific definition fields produced by the @paramtags. Other useful tags are given in Table 1.3.1.5 Computer Number Representations (Theory)Computers may be powerful, but they are finite. A problem in computer designis how to represent an arbitrary number using a finite amount of memory spaceand then how to deal with the limitations arising from this representation. As aconsequence of computer memories being based on the magnetic or electronicrealization of a spin pointing up or down, the most elementary units of computermemory are the two binary integers (bits) 0 and 1. This means that all numbers arestored in memory in binary form, that is, as long strings of zeros and ones. As aconsequence, N bits can store integers in the range [0, 2 N ], yet because the sign ofthe integer is represented by the first bit (a zero bit for positive numbers), the actualrange decreases to [0, 2 N−1 ].Long strings of zeros and ones are fine for computers but are awkward for users.Consequently, binary strings are converted to octal, decimal,orhexadecimal numbersbefore the results are communicated to people. Octal and hexadecimal numbersare nice because the conversion loses no precision, but not all that nice because ourdecimal rules of arithmetic do not work for them. Converting to decimal numbersmakes the numbers easier for us to work with, but unless the number is a powerof 2, the process leads to a decrease in precision.A description of a particular computer system normally states the word length,that is, the number of bits used to store a number. The length is often expressed inbytes, with1 byte ≡ 1 B def= 8bits.−101<strong>COPYRIGHT</strong> <strong>2008</strong>, PRINCET O N UNIVE R S I T Y P R E S SEVALUATION COPY ONLY. NOT FOR USE IN COURSES.ALLpup_06.04 — <strong>2008</strong>/2/15 — Page 17

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!