# A NEW REPRESENTATION OF THE RATIONAL NUMBERS FOR FAST EASY ARITHMETIC. E. C. R. HEHNER and R. N. S. HORSPOOL

Size: px
Start display at page:

Download "A NEW REPRESENTATION OF THE RATIONAL NUMBERS FOR FAST EASY ARITHMETIC. E. C. R. HEHNER and R. N. S. HORSPOOL"

## Transcription

1 A NEW REPRESENTATION OF THE RATIONAL NUMBERS FOR FAST EASY ARITHMETIC E. C. R. HEHNER and R. N. S. HORSPOOL Abstract. A novel system for representing the rational numbers based on Hensel's p-adic arithmetic is proposed. The new scheme uses a compact variable-length encoding that may be viewed as a generalization of radix complement notation. It allows exact arithmetic, and approximate arithmetic under programmer control. It is superior to existing coding methods because the arithmetic operations take particularly simple, consistent forms. These attributes make the new number representation attractive for use in computer hardware. Key words. number systems, number representation, rational arithmetic, p-adic numbers, radix complement, floating-point 1. Introduction. It's very illuminating to think about the fact that some at most four hundred years ago, professors at European universities would tell the brilliant students that if they were very diligent, it was not impossible to learn how to do long division. You see, the poor guys had to do it in Roman numerals. Now, here you see in a nutshell what a difference there is in a good and bad notation. (Dijkstra 1977) We consider that a good scheme for representing numbers, especially for computers, would have the following characteristics. (a) All rational numbers are finitely representable. This requires that the representation be variable-length. (b) The representation is compact. It should require less space, on average, than the fixedlength schemes commonly used in computers. Since the numbers provided by a fixed-length representation are not used equally often, compactness can be achieved by giving frequentlyoccurring numbers short encodings at the expense of longer encodings for less-frequent numbers. (c) The addition, subtraction, and multiplication algorithms are those of the usual integer arithmetic. The division algorithm is as easy as multiplication, and it proceeds in the same direction as the other three algorithms. This property is important for the storage and retrieval of variable-length operands and results. Although the desired representation is variable-length, there is no implication that operations must be performed serially by digit. Just as data can be retrieved and stored d digits at a time, so the arithmetic unit can be designed to perform operations d digits at a time. By choosing d to be large compared to the average length of operands, we can obtain the speed of a fixed-length design together with the ability to handle operands that are not representable in a fixed length (Wilner 1972). 2. Background. Before we present our proposal, we shall briefly review representations in common use. (For their history, see (Knuth 1969a).) Almost universally, the sequence of digits d i d 3 d 2 d 1 d 0 is used to represent the nonnegative integer i n = db i i

2 where b (the base) is an integer greater than one (usually two or ten), and each digit d i, represents an integer in the range 0 di < b. As a rule, we do not write leading 0s. We must break the rule, however, to represent zero (if we follow it, there is nothing to write). There is no direct representation of negative integers in common use. Instead we prefix a unary operator to the representation of positive integers. The combination of sign and magnitude is indirect because, to perform arithmetic, we may first have to apply some algebraic transformations. If asked to add two numbers, we first examine the signs to determine whether to use the addition or subtraction algorithm; if we are using the subtraction algorithm, we compare the magnitudes to determine which is to be subtrahend, and which minuend. With a direct representation, if asked to add, we simply add. The radix complement representation is direct in this sense, but it includes only a finite subset of the integers. Rationals are commonly represented by a pair of integers: a numerator and denominator. In this form, multiplication and division are reasonably easy, but addition and subtraction are relatively hard, and normalization is difficult (Horn 1977). When addition and subtraction are wanted more often than multiplication and division, a representation that makes the former easier at the expense of the latter would be preferable. For this reason, we usually restrict our numbers to a subset of the rationals known as the fixed-point or floating-point numbers. By inserting a radix point in a sequence of digits (fixed-point), or indicating by means of an exponent where a radix point should be placed (floating-point), we represent those rationals such that, in lowest terms, the denominator divides some power of the base. In this form, addition and subtraction are, after alignment of the radix point, the same as for integers. With a variable-length representation, a major diffculty with the usual division algorithm is that it proceeds from left to right, opposite to the direction of the other three algorithms. To simplify retrieval, processing, and storage, all algorithms should examine their operands and produce their results in the same direction. The left-to-right division algorithm gives us a way of extending the fixed/floating point representation to include all positive rationals: an infinite but eventually repeating sequence of digits can be finitely denoted by indicating the repeating portion. On paper, the repeating portion is sometimes denoted by overscoring it; for example, 611/ 495 = A minor annoyance is the fact that representations are not unique; for example, 09. = 1and 049. = 05.. A major annoyance is that further arithmetic is awkward: addition normally begins with the rightmost digit, but a sequence that extends infinitely to the right has no rightmost digit. The usual representation of nonnegative integers can be extended in various ways. The base may be negative (Songster 1963), or even imaginary (Knuth 1960). In the balanced ternary representation (Avizienis 1971), the base is three, and the digits represent the integers minus-one, zero, and one. Our extension, which we now present, is in quite a different direction. 3. Constructing the representation. To construct our representation, we shall follow the approach of Hensel's p-adic arithmetic (Hensel 1908, 1913). Hensel begins with the usual representation of nonnegative integers, that is, a sequence of digits d 3 d 2 d 1 d 0. Each digit di represents an integer in the range 0 di < b, where the base b is an integer greater than one. He then constructs the representation of other numbers (all rationals, some irrationals and some

3 imaginary numbers (Knuth 1969b)) by means of arithmetic. We shall limit ourselves to rational numbers, and give a finite representation of them that is implementable in computer hardware Addition, subtraction and multiplication. For the addition and subtraction algorithms, we adopt the usual algorithms for positive integers, with one qualification. When subtracting a digit of the subtrahend from a smaller digit of the minuend, rather than borrow one from a minuend digit some distance away, we carry one to the immediately neighboring digit of the subtrahend. For example, beginning at the right, we subtract 6 from 4 to get 8 with a carry; then, rather than subtracting the 2 in the next position, we subtract 3 from 0 to get 7 with a carry; etc. Whether we carry or borrow is inconsequential; the important point is that we affect only the immediately neighboring digit, not a digit an arbitrary distance away. This form of subtraction is usual in circuit design; it is crucial to our number representation. We now construct minus-one by subtracting one from zero Beginning at the right, the subtraction algorithm generates a sequence of 9s. Though the sequence is unending, it is repetitive, and can be specified finitely. We shall use a quote (quotation mark) to mean that the digit(s) to its left is (are) to be repeated indefinitely to the left. Twenty-five, for example, is represented by 0'25 or by 0'025 or by 00'25. The first of these is called normalized ; in general, a representation is normalized when it is as short as possible. A table of normalized representations of integers follows; each entry specifies the usual representation together with our representation. 0: 0' 1: 0'1-1: 9' 2: 0'2-2: 9'8 3: 0'3-3: 9'7 : : 9: 0'9-9: 9'1 10: 0'10-10: 9'0 11: 0'11-11: 9'89 : : For brevity on the written page (the abbreviation is inapplicable in computer memories), we make the convention that when no quote appears in a number, 0' is assumed to be appended to its left. Thus the positive integers take their familiar form. The reader may verify. with examples, that the addition and subtraction algorithms work consistently throughout the scheme. This is no surprise to anyone familiar with radix

4 complement arithmetic, for the similarity is apparent. The rule for negation is the radix complement rule: complement each digit (in decimal, change 0 to 9, 1 to 8, 2 to 7, etc.) and then add one. (Negation can be performed more simply; for example, in binary starting at the right, leave trailing 0s and rightmost 1 alone, flip the rest.) The definition of radix complement is made in terms of a fixed-size space available for storing numbers in computers (the word ); for example, if w bits are available for encoding integers, two's complement is defined by performing arithmetic modulo 2 w. We prefer to define it independent of space constraints, and to view the fixed-size scheme as a truncation of p-adic numbers to w bits. Radix complement is often preferred in computers because of its nice arithmetic properties; our finite representation of p- adic rationals enjoys these properties without suffering from the wasted space and overflow problems inherent in a fixed-length representation. The usual multiplication algorithm need not be altered for use with negative integers. For example, multiplying minus-two by three, either way round, yields the desired result. 9'8 3 * 3 * 9'8 9' : : 9'4 3.2 Division. Before we present the division algorithm, let us look at a simple example. Since 9' represents minus-one, we may expect division by 3 to give 3' as the representation of minus-one-third. Let us test the consistency of this representation with our arithmetic. To negate, we first complement, obtaining 6' (since 6' is double 3', it represents minus-two-thirds); then we add one, obtaining 6'7 as our representation of one-third. Subtracting 3' from 0' also produces 6'7. Multiplying 6'7 by 3 yields 1, confirming its consistency. complement of 3' = 6' or or 0'-3'= 6'7 6'7*3 = 1 0'-1 = 9' (minus-one) 9' 3 = 3' (minus-one-third) 3'*2 = 6' (minus-two-thirds) 6'+1 = 6'7 (one-third) We now present the division algorithm by means of an example. For the moment, we restrict ourselves to integer dividends and divisors, and further to divisors whose rightmost digit is nonzero and relatively prime to the base. (Two integers are relatively prime if and only if their only common divisor is 1. In decimal, the divisor's final digit must be 1, 3, 7, or 9.) We shall remove all restrictions shortly. For our example, we divide 191 by 33. The rightmost digit of the result, d 0, when multiplied by the rightmost digit of the divisor, 3, must produce a number whose rightmost digit

5 is the rightmost digit of the dividend, 1. Our restrictions ensure that there is exactly one such digit: d 0 * 3 must end with 1, therefore d 0 = 7. We subtract 7 * 33 from 191; ignoring the rightmost digit, which must be 0, we use the difference in place of the dividend, and repeat = 1 2' ' ' '6 When the difference is one we have seen before, we can insert the quote, and stop. Like multiplication, the division algorithm produces each digit by table look-up. Compare this with the left-to-right division algorithm: a hand calculation requires a guess that may need to be revised; a machine calculation requires repeated subtraction to produce each digit of the result. The right-to-left division algorithm is well-defined only when the divisor's final digit is relatively prime to the base. For example, an attempt to divide 1 by 2 in decimal fails because no multiple of 2 has 1 as its final digit. Therefore, the means presented so far enable us to represent only a subset of the rationals: those rationals such that, in lowest terms, the denominator has no factors that are factors of the base. Compare this with the fixed/floating-point representation; it represents those rationals such that, in lowest terms, the denominator has only factors that are factors of the base. The two representations are, in a sense, complementary; combining them, we are able to represent all rationals. We allow a radix point, whose position is independent of the quote, or an exponent, as in scientific notation. For example, 12'34 10 = 12'3.4 12' = 12!34 12!34 10 = 1.2'34 1.2'34 10 =.12'34.12'34 10 =.21'234 The last example is probably best written with an exponent, and suggests that the more appropriate machine representation uses an exponent rather than a radix point. This requires a normalization rule: when normalized, the mantissa's rightmost digit is not 0. Thus 12'300E2 becomes 12'3E4, and 120'E2 becomes 012'E3. All rationals except zero have a unique normalized representation. To divide two arbitrary integers in decimal, we must first cast out all 2 and 5 factors from the divisor. These factors can be determined, one at a time, by inspecting the divisor's final digit. A 2 is cast out by multiplying both dividend and divisor by 5; similarly, a 5 is cast out with a multiplication by 2. The generalization to arbitrary (rational) operands is now easy.

6 4. Binary is beautiful. Base two, a common choice in computers for circuit reasons, has two important advantages for us. First, it is a prime number. Since it has no factors, there is no casting out ; division of two normalized operands can always proceed directly. Second, multiplication and division tables are trivial. This advantage for multiplication is well-known: the right-to-left division algorithm is a true analogue of multiplication, so the same advantage applies. At each step, the rightmost bit of the dividend remaining (a) is the next bit of the result, and (b) specifies whether or not to subtract the divisor. For example, dividing 1 (one) by 11 (three) proceed as follows = 0 1' ' '0 1. Dividend = 1. Its rightmost bit = 1. Therefore (a) Rightmost bit of result = 1. (b) Subtract divisor, and ignore rightmost Dividend remaining = 1'. Its rightmost bit = 1. Therefore (a) Next bit of result = 1. (b) Subtract divisor, and ignore rightmost Dividend remaining = 1'0. Its rightmost bit = 0. Therefore (a) Next bit of result = 0. (b) Do not subtract divisor; ignore rightmost Dividend remaining = 1' as in step 2. Therefore insert quote. Result = 01'1. 5. Radix conversion algorithm. The algorithm for converting the representation of a positive integer from one base to another is well-known. The given integer is repeatedly divided by the base of the new representation; the sequence of remainders gives, from right to left, the digits of the new representation. For example, converting eleven from decimal to binary 11 = 2*5+1 5 = 2*2+1 2 = 2*1+0 1 = 2*0+1 gives 1011.The algorithm is usually considered to terminate when the quotient is zero; if it is allowed to continue, an endless sequence of 0s is produced. Let us apply the algorithm to a negative integer. For example, converting minus-eleven from decimal to binary

7 -11 = 2* = 2* = 2* = 2* = 2* = 2* gives , which is the p-adic form. Note that the remainders must be digits in the new base. By recognizing a repeated state of the computation, we are able to insert a quote and arrive at our finite representation 1'0101. If we begin with a fraction, we must allow the quotients to be fractions. We then need an extra criterion to make the algorithm deterministic. For example, converting one-third to binary, we might begin either with or with 1/3 = 2* -1/3 +1 1/3 = 2* 1/6 +0 To produce a result without a radix point, the original fraction, and each quotient fraction, in lowest terms, must have denominators that are relatively prime to the new base. The implied criterion is that the denominator must remain unchanged. 1/3 = 2* -1/3 +1-1/3 = 2* -2/3 +1-2/3 = 2* -1/3 +0 When a quotient is obtained that has appeared before, a cycle is recognized. Placing the quote accordingly, we have produced the binary representation of one-third, namely 01'1. Thus the usual radix conversion algorithm naturally produces our representation. In the preceding examples, we began with numbers in their familiar decimal representations: sign-and-magnitude, numerator/denominator. If we begin instead with our representation, the algorithm remains the same for rationals (without radix points) as for positive integers. For example, beginning with 6'7 (one-third in decimal), we see that the rightmost digit is odd, therefore the rightmost binary digit is 1. (6'7-1) 2 = 3' (3'-1) 2 = 6' (6'-0) 2 = 3' The division by two is performed as a multiplication by five, discarding the rightmost digit of the result, which is 0. In general, when converting from base bl to base b2, a finite number of rightmost digits of each quotient is sufficient to determine the next digit of the result if all factors of b2 are factors of bl.

8 6. Properties of the proposed number system. Excluding the radix point or exponent, the general form of our representation is The number represented is d n+m d n+m 1 d n+1 'd n d n 1 d 2 d 1 d 0 n n+ m i i m db i db i /( b 1) i= 0 i= n+ 1 where b is the base of the representation. To justify this formula, we shall break the digit sequence into two parts: the digits to the left of the quote will be called the negative part, and the digits to its right will be called the positive part. The positive part was our starting point for the construction of the representation. n d n d 0 = Σ d i b i i=0 The negative part can be found as follows. d n+m d n+m 1 d n+1 ' = d n+m d n+m 1 d n+1 '0 0 + d n+m d n+m 1 d n+1 n+m = d n+m d n+m 1 d n+1 ' * b m + Σ d i b i n 1 i=n+1 Therefore n+m d n+m d n+1 ' = Σ d i b i n 1 /(b m 1) i=n+1 Putting the positive and negative parts together, we find d n+m d n+1 'd n d 0 = d n+m d n+1 ' * b n+1 + d n d 0 and hence we obtain the above formula. From the formula, we see that sign determination is trivial. If both positive and negative parts are present, we merely compare their leading digits. Assuming the representation to be normalized, dn+ m dn. If dn+ m< dn, the number is positive. If dn+ m> dn, the number is negative. If one part is absent, the sign is given by the part that is present. If both parts are absent, the number is zero. The formula can be used to convert from our representation to numerator/denominator representation, if one so desires. For example, in decimal 12'7 = 7 120/99=191/33; in binary

9 01'1=1 010/11=1/11 (one-third). From this formula, we can also derive an easy method for converting to a right-repeating decimal expansion (or binary expansion). Simply subtract the negative part from the positive part with their leading digits aligned and the negative part repeated indefinitely to the right. 12'345 = = '45 = = '21 = = The opposite conversion can be performed by reversing the steps = 2 34' = 56'8 The above paragraphs suggest two comparison algorithms. The first is to subtract the comparands, then determine the sign of the result. The second is to convert the comparands to right-repeating form, then perform the usual digit-by-digit comparison. The first has the advantage that it is a right-to-left algorithm, but the second may have an efficiency advantage. 7. Length of representation. When two p-adic rational numbers are added, subtracted, multiplied, or divided, the result is an infinite but eventually repeating sequence of digits. For termination of the arithmetic algorithms, and for finite representation of the result (placing the quote), one must be able to recognize when the state of the computation is one that has occurred before. In a hand calculation, recognition poses no problem: one merely scans the page. The analogous approach for machines requires the arithmetic unit to contain some associative memory. Each state of the computation is compared (associatively, in parallel) with all stored states; if a match is found, the operation is complete, otherwise the state is stored and the operation continues. The resulting digit sequence must be checked for normalization. A method of recognizing the repeated state that requires storing only one state, at the expense of possibly delaying recognition by a few digits, is the following (Brent 1978). If the states are S 1, S 2, S 3,, then test (S 1 vs. S 2 ), (S 2, vs. S 3, S 4 ), (S 4 vs. S 5,,S 8 ), etc., until a match is found. Again, the resulting digit sequence must be normalized Length Bounds. An alternative method of implementing the arithmetic algorithms is as follows: (a) calculate a bound for the length (number of digits) of the result; (b) calculate a correct, though not necessarily minimal, length for the negative (repeating) part; (c) produce a sufficient number of digits to ensure that a repetition of the length calculated in (b) has occurred; (d) normalize the result. This approach obviates the need to recognize a repeated state. However, the complexity of our formulae for the length bounds makes the approach unattractive.

10 The bounds are summarized in Table 1. The notation used in the table is the following. b: the base of the representation p i : the length of the positive part (i.e. the number of digits to the right of the quote) in the base p representation of x i n i : the length of the negative part (i.e. the number of digits to the left of the quote) in the base p representation of x i φ : Euler's φ function; φ (m) is defined, for positive integer m, as the number of positive integers not exceeding m that are relatively prime to m. Table 1 Length Bounds x 3 =x 1 +x 2 p 3 MAX(p 1,p 2 )+n 3 +2 x 3 =x 1 x 2 n 3 is a divisor of LCM(n 1,n 2 ) x 3 =x 1 *x 2 p 3 p 1 +p 2 +n 3 +1 n 3 is a divisor of LCM(n 1,n 2 ) x 3 =x 1 x 2 p 3 p 1 +p 2 +n 3 +1 if p 2 n 2 p 3 p 1 p 2 +n 3 +1 if n 2 <p 2 p 1 p 3 n 3 +1 if p 1,n 2 <p 2 n 3 is a divisor of LCM(n 1,φ (x 2 (b n 2 1))) 7.2. Approximation. Our representation provides a service that is unavailable to users of fixed-length floating-point hardware: exact results. As arithmetic operators are applied repeatedly during a computation, this extra service may begin to cost extra: the length of representation of the results may tend to grow. As the lengths grow, storage costs increase; as the lengths become greater than the number of digits that a data path or arithmetic unit can accommodate at one time, processing time increases. Many users do not require perfect accuracy, and are unwilling to pay extra for it. Users of fixed-length floating-point hardware have their accuracy and expense chosen for them by the computer designer. The designer's impossible task is to choose one accuracy and expense (amount of storage per number) to satisfy all users at all times. Some designers give their users a choice of two accuracies (single and double precision); it seems preferable to allow each user to choose any accuracy, from none to complete. For reasons of mathematical cleanliness, we prefer not to provide approximate versions of the addition, subtraction, multiplication, and division operators, but to provide a separate approximation operator. Two possible (and ideal) forms of this operator are: (a) Given a number n, and a number of digits d, d = a number that is closest to n and whose representation has no more than d digits. (b) Given a number n, and a tolerance t, t = a number in the range n± nt whose representation is shortest.

11 The second form has the advantage that its specification is independent of representation. In either form, the problem of finding a closest or shortest result is a hard one; in practice, a reasonably close or short result is easy to obtain, and acceptable. One method is to convert the number to right-repeating form (using the algorithm in 6) and then truncate the result. For example, 12' is first converted to and this may be approximated to 0' , to 0'22.436, or to 0'22.45, etc. In general, if the final truncated result has k digits to the right of the radix point, then it is easy to show that the error introduced by the approximation is less than b k where b is the base of the number system. This form of approximation corresponds to the first style of approximation operator given above. The role of the numerical analyst has traditionally been to analyze the accuracy (error) provided by the manufacturer, and to design algorithms which make the best use of this accuracy (i.e., whose final result is most accurate). With our proposal, the numerical analyst's role will be to choose approximations that make a computation as cheap as possible, while achieving the desired accuracy. Correctness proofs will be facilitated by making the chosen approximations explicit Compactness. We would like to compare the computing expense of solving a sample of numerical problems using a fixed-length floating-point representation with the expense using our representation. To make the comparison, it would be unfair to use existing programs, since they are designed to run on existing floating-point machines. We should proceed as follows. 1. Ascertain the accuracy achieved by each of the existing programs for floating-point. 2. Write programs for our representation that achieve the same accuracy as cheaply as possible. This requires numerical analysis that has not yet been developed. 3. Compare the cost of running the programs on their respective machines. Even then, the comparison will be biased in favor of fixed-length floating-point, since its users are not given the option of more or less accuracy. Needless to say, we have not made the desired comparison. We have, however, tested our representation on integer data (Hehner 1976). Our sample was a large, well-known compiler (XCOM, the compiler for XPL (McKeeman 1970)). The integer constants in the program require, on average, 5.7 bits each. A complete trace of the values of all integer variables and integer-valued array elements during an execution of the program (compiling itself) revealed that they require, on average, 6.4 bits each. There are some essential overhead costs associated with the use of variable-length data items. To be easily accessible, the data items may need to be addressed indirectly. Furthermore, memory compactions may be necessary with data items dynamically changing in size. Even when these costs are taken into account, there is a 31% saving compared to a 32-bit fixed-length encoding. (The cost is measured as a space-time product, since space is being traded for time when using a variable-length encoding.) Therefore, for this data, our representation is significantly more economical than a well-known standard.

12 8. Conclusion. The representation of the rational numbers presented in this paper has several appealing properties. Given the usual representation of the positive integers, it is, in a genuine sense, the natural extension to the rationals. The algorithms for addition, subtraction, and multiplication are those of the usual integer arithmetic; the division algorithm is truly the analogue of multiplication. The complexity of rational arithmetic in numerator/denominator form has not been reduced by our representation, but it has been redistributed and its character has changed. For humans, the problems of detecting a repeated state and normalization have the character of a pattern-match. If they can be solved economically for computers, then we believe rational arithmetic with programmer-controlled accuracy will become an attractive proposition. The notation introduced in this paper may be generalized in several directions. For integer base b > 1, the digit set can represent any b integers that are all different modulo b (balanced ternary is a special case). The base need not be a positive integer. And the representation can be used for rational power series. Krishnamurthy has considered the use of a fixed-length truncation of p-adic numbers with the result that arithmetic is exact within a limited range (Krishnamurthy 1977). Acknowledgments. We thank Art Sedgwick and Bill McKeeman for their interest in and comments on this work. We especially thank Don Knuth for informing us of previous related work. REFERENCES A. AVlZIENIS (1971), Digital Computer Arithmetic: A Unified Algorithmic Specification, Proc. Symposium on Computers and Automata. Polytechnic Press. Polytechnic Institute. Brooklyn, NY. R. BRENT (1978), communicated via D. E. Knuth. EDSGER W. DIJKSTRA (1977), An interview with prof. dr. Edsger W. Dijkstra, Datamation, 23. no. 5, p E. C. R. HEHNER (1976). Computer design to minimize memory requirements, Computer, 9. no. 8. pp K. HENSEL (1908). Theorie der algebraischen Zahlen, Leipzig-Berlin. (1913), Zahlentheorie, Berlin-Leipzig. B. K. P. HORN (1977), Rational Arithmetic for Minicomputers, MIT Press, Cambridge, MA. D. E. KNUTH (1960), An Imaginary Number System, Comm. ACM. 3, pp (1969a). Seminumerical algorithms, The Art of Computer Programming, vol. 2. Addison-Wesley, Reading, MA. (1969b). Ibid., 4.1. ex. 31, p E. V. KRISHNAMURTHY (1977), Matrix processors using p-adir arithmetic for exact linear computations, IEEE Trans. Computers, C-26. pp W. M. MCKEEMAN, J. J. HORNING AND D. B. WORTMAN (1970), A Compiler Generator, Prentice-Hall, Englewood Cliffs. NJ. G. F. SONGSTER (1963), Negative base number representation systems, IEEE Trans. Computers. EC-l 2, pp W. T. WILNER (1975). Design of the B1700, Proceedings of AFIPS 1972, FJCC vol. 41, AFIPS Press, Montvale, NJ, pp This paper is published in SIAM J. Comput. 8 no.2 pp , May 1979.

### Computer Science 281 Binary and Hexadecimal Review

Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two

### ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

ECE 0142 Computer Organization Lecture 3 Floating Point Representations 1 Floating-point arithmetic We often incur floating-point programming. Floating point greatly simplifies working with large (e.g.,

### The string of digits 101101 in the binary number system represents the quantity

Data Representation Section 3.1 Data Types Registers contain either data or control information Control information is a bit or group of bits used to specify the sequence of command signals needed for

### Data Storage 3.1. Foundations of Computer Science Cengage Learning

3 Data Storage 3.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List five different data types used in a computer. Describe how

### Notes on Factoring. MA 206 Kurt Bryan

The General Approach Notes on Factoring MA 26 Kurt Bryan Suppose I hand you n, a 2 digit integer and tell you that n is composite, with smallest prime factor around 5 digits. Finding a nontrivial factor

### RN-Codings: New Insights and Some Applications

RN-Codings: New Insights and Some Applications Abstract During any composite computation there is a constant need for rounding intermediate results before they can participate in further processing. Recently

### Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:

Chapter 3 Data Storage Objectives After studying this chapter, students should be able to: List five different data types used in a computer. Describe how integers are stored in a computer. Describe how

### RN-coding of Numbers: New Insights and Some Applications

RN-coding of Numbers: New Insights and Some Applications Peter Kornerup Dept. of Mathematics and Computer Science SDU, Odense, Denmark & Jean-Michel Muller LIP/Arénaire (CRNS-ENS Lyon-INRIA-UCBL) Lyon,

### Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1

Divide: Paper & Pencil Computer Architecture ALU Design : Division and Floating Point 1001 Quotient Divisor 1000 1001010 Dividend 1000 10 101 1010 1000 10 (or Modulo result) See how big a number can be

### Copy in your notebook: Add an example of each term with the symbols used in algebra 2 if there are any.

Algebra 2 - Chapter Prerequisites Vocabulary Copy in your notebook: Add an example of each term with the symbols used in algebra 2 if there are any. P1 p. 1 1. counting(natural) numbers - {1,2,3,4,...}

### JobTestPrep's Numeracy Review Decimals & Percentages

JobTestPrep's Numeracy Review Decimals & Percentages 1 Table of contents What is decimal? 3 Converting fractions to decimals 4 Converting decimals to fractions 6 Percentages 6 Adding and subtracting decimals

### CSI 333 Lecture 1 Number Systems

CSI 333 Lecture 1 Number Systems 1 1 / 23 Basics of Number Systems Ref: Appendix C of Deitel & Deitel. Weighted Positional Notation: 192 = 2 10 0 + 9 10 1 + 1 10 2 General: Digit sequence : d n 1 d n 2...

### CHAPTER 3 Numbers and Numeral Systems

CHAPTER 3 Numbers and Numeral Systems Numbers play an important role in almost all areas of mathematics, not least in calculus. Virtually all calculus books contain a thorough description of the natural,

### 4 Operations On Data

4 Operations On Data 4.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, students should be able to: List the three categories of operations performed on

### Lecture 8: Binary Multiplication & Division

Lecture 8: Binary Multiplication & Division Today s topics: Addition/Subtraction Multiplication Division Reminder: get started early on assignment 3 1 2 s Complement Signed Numbers two = 0 ten 0001 two

### The finite field with 2 elements The simplest finite field is

The finite field with 2 elements The simplest finite field is GF (2) = F 2 = {0, 1} = Z/2 It has addition and multiplication + and defined to be 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 0 0 0 = 0 0 1 = 0

### Math Review. for the Quantitative Reasoning Measure of the GRE revised General Test

Math Review for the Quantitative Reasoning Measure of the GRE revised General Test www.ets.org Overview This Math Review will familiarize you with the mathematical skills and concepts that are important

### Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 INTRODUCTION TO DIGITAL LOGIC

Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 1 Number Systems Representation Positive radix, positional number systems A number with radix r is represented by a string of digits: A n

### Continued Fractions and the Euclidean Algorithm

Continued Fractions and the Euclidean Algorithm Lecture notes prepared for MATH 326, Spring 997 Department of Mathematics and Statistics University at Albany William F Hammond Table of Contents Introduction

### Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit

Decimal Division Remember 4th grade long division? 43 // quotient 12 521 // divisor dividend -480 41-36 5 // remainder Shift divisor left (multiply by 10) until MSB lines up with dividend s Repeat until

### Binary Number System. 16. Binary Numbers. Base 10 digits: 0 1 2 3 4 5 6 7 8 9. Base 2 digits: 0 1

Binary Number System 1 Base 10 digits: 0 1 2 3 4 5 6 7 8 9 Base 2 digits: 0 1 Recall that in base 10, the digits of a number are just coefficients of powers of the base (10): 417 = 4 * 10 2 + 1 * 10 1

### To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic:

Binary Numbers In computer science we deal almost exclusively with binary numbers. it will be very helpful to memorize some binary constants and their decimal and English equivalents. By English equivalents

### Math Workshop October 2010 Fractions and Repeating Decimals

Math Workshop October 2010 Fractions and Repeating Decimals This evening we will investigate the patterns that arise when converting fractions to decimals. As an example of what we will be looking at,

### Fixed-Point Arithmetic

Fixed-Point Arithmetic Fixed-Point Notation A K-bit fixed-point number can be interpreted as either: an integer (i.e., 20645) a fractional number (i.e., 0.75) 2 1 Integer Fixed-Point Representation N-bit

### Binary Numbering Systems

Binary Numbering Systems April 1997, ver. 1 Application Note 83 Introduction Binary numbering systems are used in virtually all digital systems, including digital signal processing (DSP), networking, and

### CS321. Introduction to Numerical Methods

CS3 Introduction to Numerical Methods Lecture Number Representations and Errors Professor Jun Zhang Department of Computer Science University of Kentucky Lexington, KY 40506-0633 August 7, 05 Number in

### Elementary Number Theory We begin with a bit of elementary number theory, which is concerned

CONSTRUCTION OF THE FINITE FIELDS Z p S. R. DOTY Elementary Number Theory We begin with a bit of elementary number theory, which is concerned solely with questions about the set of integers Z = {0, ±1,

### NUMBER SYSTEMS. William Stallings

NUMBER SYSTEMS William Stallings The Decimal System... The Binary System...3 Converting between Binary and Decimal...3 Integers...4 Fractions...5 Hexadecimal Notation...6 This document available at WilliamStallings.com/StudentSupport.html

### FPGA Implementation of an Extended Binary GCD Algorithm for Systolic Reduction of Rational Numbers

FPGA Implementation of an Extended Binary GCD Algorithm for Systolic Reduction of Rational Numbers Bogdan Mătăsaru and Tudor Jebelean RISC-Linz, A 4040 Linz, Austria email: bmatasar@risc.uni-linz.ac.at

### DNA Data and Program Representation. Alexandre David 1.2.05 adavid@cs.aau.dk

DNA Data and Program Representation Alexandre David 1.2.05 adavid@cs.aau.dk Introduction Very important to understand how data is represented. operations limits precision Digital logic built on 2-valued

### 2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal

2/9/9 Binary number system Computer (electronic) systems prefer binary numbers Binary number: represent a number in base-2 Binary numbers 2 3 + 7 + 5 Some terminology Bit: a binary digit ( or ) Hexadecimal

### Decimal Numbers: Base 10 Integer Numbers & Arithmetic

Decimal Numbers: Base 10 Integer Numbers & Arithmetic Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 )+(1x10 0 ) Ward 1 Ward 2 Numbers: positional notation Number

### This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers

This Unit: Floating Point Arithmetic CIS 371 Computer Organization and Design Unit 7: Floating Point App App App System software Mem CPU I/O Formats Precision and range IEEE 754 standard Operations Addition

### Lecture 2. Binary and Hexadecimal Numbers

Lecture 2 Binary and Hexadecimal Numbers Purpose: Review binary and hexadecimal number representations Convert directly from one base to another base Review addition and subtraction in binary representations

### 1. The Fly In The Ointment

Arithmetic Revisited Lesson 5: Decimal Fractions or Place Value Extended Part 5: Dividing Decimal Fractions, Part 2. The Fly In The Ointment The meaning of, say, ƒ 2 doesn't depend on whether we represent

### A Second Course in Mathematics Concepts for Elementary Teachers: Theory, Problems, and Solutions

A Second Course in Mathematics Concepts for Elementary Teachers: Theory, Problems, and Solutions Marcel B. Finan Arkansas Tech University c All Rights Reserved First Draft February 8, 2006 1 Contents 25

### U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, 2009. Notes on Algebra

U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, 2009 Notes on Algebra These notes contain as little theory as possible, and most results are stated without proof. Any introductory

### The BBP Algorithm for Pi

The BBP Algorithm for Pi David H. Bailey September 17, 2006 1. Introduction The Bailey-Borwein-Plouffe (BBP) algorithm for π is based on the BBP formula for π, which was discovered in 1995 and published

### Systems I: Computer Organization and Architecture

Systems I: Computer Organization and Architecture Lecture 2: Number Systems and Arithmetic Number Systems - Base The number system that we use is base : 734 = + 7 + 3 + 4 = x + 7x + 3x + 4x = x 3 + 7x

### Fractional Numbers. Fractional Number Notations. Fixed-point Notation. Fixed-point Notation

2 Fractional Numbers Fractional Number Notations 2010 - Claudio Fornaro Ver. 1.4 Fractional numbers have the form: xxxxxxxxx.yyyyyyyyy where the x es constitute the integer part of the value and the y

### Correctly Rounded Floating-point Binary-to-Decimal and Decimal-to-Binary Conversion Routines in Standard ML. By Prashanth Tilleti

Correctly Rounded Floating-point Binary-to-Decimal and Decimal-to-Binary Conversion Routines in Standard ML By Prashanth Tilleti Advisor Dr. Matthew Fluet Department of Computer Science B. Thomas Golisano

### Simulation & Synthesis Using VHDL

Floating Point Multipliers: Simulation & Synthesis Using VHDL By: Raj Kumar Singh - B.E. (Hons.) Electrical & Electronics Shivananda Reddy - B.E. (Hons.) Electrical & Electronics BITS, PILANI Outline Introduction

### Measures of Error: for exact x and approximation x Absolute error e = x x. Relative error r = (x x )/x.

ERRORS and COMPUTER ARITHMETIC Types of Error in Numerical Calculations Initial Data Errors: from experiment, modeling, computer representation; problem dependent but need to know at beginning of calculation.

### Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

ECE Department Summer LECTURE #5: Number Systems EEL : Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz Decimal Number System: -Our standard number system is base, also

### arxiv:1112.0829v1 [math.pr] 5 Dec 2011

How Not to Win a Million Dollars: A Counterexample to a Conjecture of L. Breiman Thomas P. Hayes arxiv:1112.0829v1 [math.pr] 5 Dec 2011 Abstract Consider a gambling game in which we are allowed to repeatedly

### Polynomials. Dr. philippe B. laval Kennesaw State University. April 3, 2005

Polynomials Dr. philippe B. laval Kennesaw State University April 3, 2005 Abstract Handout on polynomials. The following topics are covered: Polynomial Functions End behavior Extrema Polynomial Division

### Recall the process used for adding decimal numbers. 1. Place the numbers to be added in vertical format, aligning the decimal points.

2 MODULE 4. DECIMALS 4a Decimal Arithmetic Adding Decimals Recall the process used for adding decimal numbers. Adding Decimals. To add decimal numbers, proceed as follows: 1. Place the numbers to be added

### Integer multiplication

Integer multiplication Suppose we have two unsigned integers, A and B, and we wish to compute their product. Let A be the multiplicand and B the multiplier: A n 1... A 1 A 0 multiplicand B n 1... B 1 B

### An Efficient RNS to Binary Converter Using the Moduli Set {2n + 1, 2n, 2n 1}

An Efficient RNS to Binary Converter Using the oduli Set {n + 1, n, n 1} Kazeem Alagbe Gbolagade 1,, ember, IEEE and Sorin Dan Cotofana 1, Senior ember IEEE, 1. Computer Engineering Laboratory, Delft University

### COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about

### Paramedic Program Pre-Admission Mathematics Test Study Guide

Paramedic Program Pre-Admission Mathematics Test Study Guide 05/13 1 Table of Contents Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 Page 7 Page 8 Page 9 Page 10 Page 11 Page 12 Page 13 Page 14 Page 15 Page

### Number Representation

Number Representation CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Topics to be Discussed How are numeric data

### Unit 1 Number Sense. In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions.

Unit 1 Number Sense In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions. BLM Three Types of Percent Problems (p L-34) is a summary BLM for the material

### YOU MUST BE ABLE TO DO THE FOLLOWING PROBLEMS WITHOUT A CALCULATOR!

DETAILED SOLUTIONS AND CONCEPTS - DECIMALS AND WHOLE NUMBERS Prepared by Ingrid Stewart, Ph.D., College of Southern Nevada Please Send Questions and Comments to ingrid.stewart@csn.edu. Thank you! YOU MUST

### Zuse's Z3 Square Root Algorithm Talk given at Fall meeting of the Ohio Section of the MAA October 1999 - College of Wooster

Zuse's Z3 Square Root Algorithm Talk given at Fall meeting of the Ohio Section of the MAA October 1999 - College of Wooster Abstract Brian J. Shelburne Dept of Math and Comp Sci Wittenberg University In

### The Ideal Class Group

Chapter 5 The Ideal Class Group We will use Minkowski theory, which belongs to the general area of geometry of numbers, to gain insight into the ideal class group of a number field. We have already mentioned

### > 2. Error and Computer Arithmetic

> 2. Error and Computer Arithmetic Numerical analysis is concerned with how to solve a problem numerically, i.e., how to develop a sequence of numerical calculations to get a satisfactory answer. Part

### MATH-0910 Review Concepts (Haugen)

Unit 1 Whole Numbers and Fractions MATH-0910 Review Concepts (Haugen) Exam 1 Sections 1.5, 1.6, 1.7, 1.8, 2.1, 2.2, 2.3, 2.4, and 2.5 Dividing Whole Numbers Equivalent ways of expressing division: a b,

### Chapter 1: Digital Systems and Binary Numbers

Chapter 1: Digital Systems and Binary Numbers Digital age and information age Digital computers general purposes many scientific, industrial and commercial applications Digital systems telephone switching

### Solution for Homework 2

Solution for Homework 2 Problem 1 a. What is the minimum number of bits that are required to uniquely represent the characters of English alphabet? (Consider upper case characters alone) The number of

### Integer roots of quadratic and cubic polynomials with integer coefficients

Integer roots of quadratic and cubic polynomials with integer coefficients Konstantine Zelator Mathematics, Computer Science and Statistics 212 Ben Franklin Hall Bloomsburg University 400 East Second Street

### High-Precision C++ Arithmetic

Base One International Corporation 44 East 12th Street New York, NY 10003 212-673-2544 info@boic.com www.boic.com High-Precision C++ Arithmetic - Base One s Number Class fixes the loopholes in C++ high-precision

### The gas can has a capacity of 4.17 gallons and weighs 3.4 pounds.

hundred million\$ ten------ million\$ million\$ 00,000,000 0,000,000,000,000 00,000 0,000,000 00 0 0 0 0 0 0 0 0 0 Session 26 Decimal Fractions Explain the meaning of the values stated in the following sentence.

### Square Roots. Learning Objectives. Pre-Activity

Section 1. Pre-Activity Preparation Square Roots Our number system has two important sets of numbers: rational and irrational. The most common irrational numbers result from taking the square root of non-perfect

### CONTINUED FRACTIONS AND FACTORING. Niels Lauritzen

CONTINUED FRACTIONS AND FACTORING Niels Lauritzen ii NIELS LAURITZEN DEPARTMENT OF MATHEMATICAL SCIENCES UNIVERSITY OF AARHUS, DENMARK EMAIL: niels@imf.au.dk URL: http://home.imf.au.dk/niels/ Contents

### VISUAL ALGEBRA FOR COLLEGE STUDENTS. Laurie J. Burton Western Oregon University

VISUAL ALGEBRA FOR COLLEGE STUDENTS Laurie J. Burton Western Oregon University VISUAL ALGEBRA FOR COLLEGE STUDENTS TABLE OF CONTENTS Welcome and Introduction 1 Chapter 1: INTEGERS AND INTEGER OPERATIONS

### Integer Operations. Overview. Grade 7 Mathematics, Quarter 1, Unit 1.1. Number of Instructional Days: 15 (1 day = 45 minutes) Essential Questions

Grade 7 Mathematics, Quarter 1, Unit 1.1 Integer Operations Overview Number of Instructional Days: 15 (1 day = 45 minutes) Content to Be Learned Describe situations in which opposites combine to make zero.

### On Generalized Fermat Numbers 3 2n +1

Applied Mathematics & Information Sciences 4(3) (010), 307 313 An International Journal c 010 Dixie W Publishing Corporation, U. S. A. On Generalized Fermat Numbers 3 n +1 Amin Witno Department of Basic

### CS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011

CS101 Lecture 11: Number Systems and Binary Numbers Aaron Stevens 14 February 2011 1 2 1 3!!! MATH WARNING!!! TODAY S LECTURE CONTAINS TRACE AMOUNTS OF ARITHMETIC AND ALGEBRA PLEASE BE ADVISED THAT CALCULTORS

### quotient = dividend / divisor, with a remainder Given dividend and divisor, we want to obtain quotient (Q) and remainder (R)

Binary division quotient = dividend / divisor, with a remainder dividend = divisor quotient + remainder Given dividend and divisor, we want to obtain quotient (Q) and remainder (R) We will start from our

### Monday January 19th 2015 Title: "Transmathematics - a survey of recent results on division by zero" Facilitator: TheNumberNullity / James Anderson, UK

Monday January 19th 2015 Title: "Transmathematics - a survey of recent results on division by zero" Facilitator: TheNumberNullity / James Anderson, UK It has been my pleasure to give two presentations

### Fractions and Decimals

Fractions and Decimals Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles December 1, 2005 1 Introduction If you divide 1 by 81, you will find that 1/81 =.012345679012345679... The first

### Florida Math for College Readiness

Core Florida Math for College Readiness Florida Math for College Readiness provides a fourth-year math curriculum focused on developing the mastery of skills identified as critical to postsecondary readiness

### Useful Number Systems

Useful Number Systems Decimal Base = 10 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Binary Base = 2 Digit Set = {0, 1} Octal Base = 8 = 2 3 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7} Hexadecimal Base = 16 = 2

### THE NAS KERNEL BENCHMARK PROGRAM

THE NAS KERNEL BENCHMARK PROGRAM David H. Bailey and John T. Barton Numerical Aerodynamic Simulations Systems Division NASA Ames Research Center June 13, 1986 SUMMARY A benchmark test program that measures

### Prime Numbers and Irreducible Polynomials

Prime Numbers and Irreducible Polynomials M. Ram Murty The similarity between prime numbers and irreducible polynomials has been a dominant theme in the development of number theory and algebraic geometry.

### Florida Math 0018. Correlation of the ALEKS course Florida Math 0018 to the Florida Mathematics Competencies - Lower

Florida Math 0018 Correlation of the ALEKS course Florida Math 0018 to the Florida Mathematics Competencies - Lower Whole Numbers MDECL1: Perform operations on whole numbers (with applications, including

### Some facts about polynomials modulo m (Full proof of the Fingerprinting Theorem)

Some facts about polynomials modulo m (Full proof of the Fingerprinting Theorem) In order to understand the details of the Fingerprinting Theorem on fingerprints of different texts from Chapter 19 of the

### THE NUMBER OF REPRESENTATIONS OF n OF THE FORM n = x 2 2 y, x > 0, y 0

THE NUMBER OF REPRESENTATIONS OF n OF THE FORM n = x 2 2 y, x > 0, y 0 RICHARD J. MATHAR Abstract. We count solutions to the Ramanujan-Nagell equation 2 y +n = x 2 for fixed positive n. The computational

### COMPSCI 210. Binary Fractions. Agenda & Reading

COMPSCI 21 Binary Fractions Agenda & Reading Topics: Fractions Binary Octal Hexadecimal Binary -> Octal, Hex Octal -> Binary, Hex Decimal -> Octal, Hex Hex -> Binary, Octal Animation: BinFrac.htm Example

### APPLICATIONS OF THE ORDER FUNCTION

APPLICATIONS OF THE ORDER FUNCTION LECTURE NOTES: MATH 432, CSUSM, SPRING 2009. PROF. WAYNE AITKEN In this lecture we will explore several applications of order functions including formulas for GCDs and

### TYPES OF NUMBERS. Example 2. Example 1. Problems. Answers

TYPES OF NUMBERS When two or more integers are multiplied together, each number is a factor of the product. Nonnegative integers that have exactly two factors, namely, one and itself, are called prime

### Some Polynomial Theorems. John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 rkennedy@ix.netcom.

Some Polynomial Theorems by John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 rkennedy@ix.netcom.com This paper contains a collection of 31 theorems, lemmas,

### 2. Perform the division as if the numbers were whole numbers. You may need to add zeros to the back of the dividend to complete the division

Math Section 5. Dividing Decimals 5. Dividing Decimals Review from Section.: Quotients, Dividends, and Divisors. In the expression,, the number is called the dividend, is called the divisor, and is called

### 3.2 The Factor Theorem and The Remainder Theorem

3. The Factor Theorem and The Remainder Theorem 57 3. The Factor Theorem and The Remainder Theorem Suppose we wish to find the zeros of f(x) = x 3 + 4x 5x 4. Setting f(x) = 0 results in the polynomial

### Chapter 5. Binary, octal and hexadecimal numbers

Chapter 5. Binary, octal and hexadecimal numbers A place to look for some of this material is the Wikipedia page http://en.wikipedia.org/wiki/binary_numeral_system#counting_in_binary Another place that

### CHAPTER 5. Number Theory. 1. Integers and Division. Discussion

CHAPTER 5 Number Theory 1. Integers and Division 1.1. Divisibility. Definition 1.1.1. Given two integers a and b we say a divides b if there is an integer c such that b = ac. If a divides b, we write a

### This 3-digit ASCII string could also be calculated as n = (Data[2]-0x30) +10*((Data[1]-0x30)+10*(Data[0]-0x30));

Introduction to Embedded Microcomputer Systems Lecture 5.1 2.9. Conversions ASCII to binary n = 100*(Data[0]-0x30) + 10*(Data[1]-0x30) + (Data[2]-0x30); This 3-digit ASCII string could also be calculated

### A Dynamic Programming Approach for Generating N-ary Reflected Gray Code List

A Dynamic Programming Approach for Generating N-ary Reflected Gray Code List Mehmet Kurt 1, Can Atilgan 2, Murat Ersen Berberler 3 1 Izmir University, Department of Mathematics and Computer Science, Izmir

### How do you compare numbers? On a number line, larger numbers are to the right and smaller numbers are to the left.

The verbal answers to all of the following questions should be memorized before completion of pre-algebra. Answers that are not memorized will hinder your ability to succeed in algebra 1. Number Basics

### Quick Reference ebook

This file is distributed FREE OF CHARGE by the publisher Quick Reference Handbooks and the author. Quick Reference ebook Click on Contents or Index in the left panel to locate a topic. The math facts listed

### PURSUITS IN MATHEMATICS often produce elementary functions as solutions that need to be

Fast Approximation of the Tangent, Hyperbolic Tangent, Exponential and Logarithmic Functions 2007 Ron Doerfler http://www.myreckonings.com June 27, 2007 Abstract There are some of us who enjoy using our

### Math Circle Beginners Group October 18, 2015

Math Circle Beginners Group October 18, 2015 Warm-up problem 1. Let n be a (positive) integer. Prove that if n 2 is odd, then n is also odd. (Hint: Use a proof by contradiction.) Suppose that n 2 is odd

### A Programming Language for Mechanical Translation Victor H. Yngve, Massachusetts Institute of Technology, Cambridge, Massachusetts

[Mechanical Translation, vol.5, no.1, July 1958; pp. 25-41] A Programming Language for Mechanical Translation Victor H. Yngve, Massachusetts Institute of Technology, Cambridge, Massachusetts A notational

### CHAPTER 5 Round-off errors

CHAPTER 5 Round-off errors In the two previous chapters we have seen how numbers can be represented in the binary numeral system and how this is the basis for representing numbers in computers. Since any