Numerals Plan: Numeral system Types of numeral systems Positional systems in detail


Download 91.5 Kb.
bet2/3
Sana15.11.2023
Hajmi91.5 Kb.
#1775159
1   2   3
Bog'liq
Numerals reja

Position

3

2

1

0

−1

−2

. . .

Weight

b3

b2

b1

b0

b − 1

b − 2



Digit

a3

a2

a1

a0

c1

c2



Decimal example weight

1000

100

10

1

0.1

0.01

. . .

Decimal example digit

4

3

2

7

0

0

. . .

Note that a number has a terminating or repeating expansion if and only if it is rational; this does not depend on the base. A number that terminates in one base may repeat in another (thus 0.310 = 0.0100110011001...2). An irrational number stays unperiodic (infinite amount of unrepeating digits) in all integral bases. Thus, for example in base 2, π = 3.1415926...10 can be written down as the unperiodic 11.001001000011111...2.
Putting overscoresn, or dots, , above the common digits is a convention used to represent repeating rational expansions. Thus:
14/11 = 1.272727272727... = 1.27  or 321.3217878787878... = 321.3217̇8̇.
If b = p is a prime number, one can define base-p numerals whose expansion to the left never stops; these are called the p-adic numbers.

[edit]Generalized variable-length integers


More general is using a notation (here written little-endian) like a0a1a2 for a0 + a1b1 + a2b1b2, etc.
This is used in punycode, one aspect of which is the representation of a sequence of non-negative integers of arbitrary size in the form of a sequence without delimiters, of "digits" from a collection of 36: a–z and 0–9, representing 0–25 and 26–35 respectively. A digit lower than a threshold value marks that it is the most-significant digit, hence the end of the number. The threshold value depends on the position in the number. For example, if the threshold value for the first digit is b (i.e. 1) then a (i.e. 0) marks the end of the number (it has just one digit), so in numbers of more than one digit the range is only b–9 (1–35), therefore the weight b1 is 35 instead of 36. Suppose the threshold values for the second and third digits are c (2), then the third digit has a weight 34 × 35 = 1190 and we have the following sequence:
a (0), ba (1), ca (2), .., 9a (35), bb (36), cb (37), .., 9b (70), bca (71), .., 99a (1260), bcb (1261), etc.
Unlike a regular based numeral system, there are numbers like 9b where 9 and b each represents 35; yet the representation is unique because ac and aca are not allowed – the a would terminate the number.
The flexibility in choosing threshold values allows optimization depending on the frequency of occurrence of numbers of various sizes.
The case with all threshold values equal to 1 corresponds to bijective numeration, where the zeros correspond to separators of numbers with digits which are non-zero.

Download 91.5 Kb.

Do'stlaringiz bilan baham:
1   2   3




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling