barcodeaddin.com

DATA REPRESENTATION in .NET Integrated pdf417 2d barcode in .NET DATA REPRESENTATION

DATA REPRESENTATION using visual .net toinsert pdf-417 2d barcode with asp.net web,windows application ISO Specification We can check the result by c .net vs 2010 PDF 417 onverting it from base 2 back to base 10 using the polynomial method: (10111)2 = 1 24 + 0 23 + 1 22 + 1 21 + 1 20 = 16 + 0 + 4 + 2 + 1 = (23)10 At this point, we have converted the integer portion of (23.375)10 into base 2.

Converting the Fractional Part of a Fixed Point Number The Multiplication Method The conversion of the fractional portion can be accomplished by successively multiplying the fraction by 2 as described below. A binary fraction is represented in the general form:. b 1 2. + b 2 2 + b 3 2 If we multiply the fraction .NET PDF-417 2d barcode by 2, then we will obtain:. b 1 + b 2 2 + b 3 2 We thus discover the coef ci ent b 1. If we iterate this process on the remaining fraction, then we will obtain successive bi. This process forms the basis of the multiplication method of converting fractions between bases.

For the example used here (Figure 2-2), the initial fraction (.375)10 is less than 1. If we multiply it by 2, then the resulting number will be less than 2.

The digit to the left of the radix point will then be 0 or 1. This is the rst digit to the right of the radix point in the converted base 2 number, as shown in the gure. We repeat the process on the fractional portion until we are either left with a fraction of 0, at which point only trailing 0 s are created by additional iterations, or we have reached the limit of precision used in our representation.

The digits are collected and the result is obtained: (.375)10 = (.011)2.

For this process, the multiplier is the same as the target base. The multiplier is 2 here, but if we wanted to make a conversion to another base, such as 3, then we. DATA REPRESENTATION Most significant bit .375 .75 .5 2 2 2 = = = 0.75 1.50 1.00 Least significant bit (.375)10 = (.011)2.

Figure 2-2 A conversion from a base 10 fraction to a base 2 fraction using the multiplication method.. would use a multiplier of 3. VS .NET pdf417 2d barcode 1 We again check the result of the conversion by converting from base 2 back to base 10 using the polynomial method as shown below: (.

011)2 = 0 2 1 + 1 2 2 + 1 2 3 = 0 + 1/4 + 1/8 = (.375)10. We now combine the integer and fractional portions of the number and obtain the nal result: (23.

375)10 = (10111.011)2. Non Terminating Fractions Although this method of conversion will work among all bases, some precision can be lost in the process.

For example, not all terminating base 10 fractions have a terminating base 2 form. Consider converting (.2)10 to base 2 as shown in Figure 2-3.

In the last row of the conversion, the fraction .2 reappears, and the process repeats ad in nitum. As to why this can happen, consider that any non-repeating base 2 fraction can be represented as i/2k for some integers i and k.

(Repeating fractions in base 2 cannot be so represented.) Algebraically, i/2k = i 5k/(2k 5k) = i 5k/10k = j/10k. 1. Alternatively, we can use the base 10 number system and also avoid the conversion if we retain a base 2 representation, in which combinations of 1 s and 0 s represent the base 10 digits. This is known as binary coded decimal (BCD), which we will explore later in the chapter.

. DATA REPRESENTATION .2 .4 .

8 .6 .2.

2 2 2 2 2. = = = = =. 0.4 0.8 1.

6 1.2 0.4.

. . .

. Figure 2-3 A terminating base 10 fraction that does not have a terminating base 2 form. where j is the integer i 5k. The fraction is thus non-repeating in base 10. This hinges on the fact that only non-repeating fractions in base b can be represented as i/bk for some integers i and k.

The condition that must be satis ed for a non-repeating base 10 fraction to have an equivalent non-repeating base 2 fraction is: i/10k = i/(5k 2k) = j/2k where j = i/5k, and 5k must be a factor of i. For one digit decimal fractions, only (.0)10 and (.

5)10 are non-repeating in base 2 (20% of the possible fractions); for two digit decimal fractions, only (.00)10, (.25)10, (.

50)10, and (.75)10 are non-repeating (4% of the possible fractions); etc. There is a link between relatively prime numbers and repeating fractions, which is helpful in understanding why some terminating base 10 fractions do not have a terminating base 2 form.

(Knuth, 1981) provides some insight in this area. Binary versus Decimal Representations While most computers use base 2 for internal representation and arithmetic, some calculators and business computers use an internal representation of base 10, and thus do not suffer from this representational problem. The motivation for using base 10 in business computers is not entirely to avoid the terminating fraction problem, however, but also to avoid the conversion process at the input and output units which historically have taken a signi cant amount of time.

.
Copyright © barcodeaddin.com . All rights reserved.