Google
 

Conversions - theory, methods and implementations  

The Check Processor button activate a floating-point computation to check if the processor of your computer have the "Pentium floating-point bug" discovered in 1994 by a mathematician.
 


This tool is provided as an implementation of conversion algorithms modeled as Java Scripts.  Below, in the page, you can find some considerations regarding the general representation of numbers.


You can follow the links below to reach the theory and an implementation of a conversion method for a specific type of number:

Integer Numbers
Real Numbers 
Examples Conversion Integer and Real Numbers


The implementations uses JavaScript. The code is not optimized and generally written as singular steps (a step realizes only one operation, with except of variable reservations). They exploit the facilities offered by JavaScript and uses tricks to avoid his lacks.

The representation of numbers

      Generally, a number N(b) in a fixed, positive, integral base b is represented in positional notation following the rule: the positional digits ai, from a number, are integers, such that they satisfies the constraint 0ai≤(b-1) for i=... -2,-1,0,1,2, ... n. The value of each position in a number is known as its position coefficient or weight. For example:
            346(10)=3*102+4*101+6*100=300+40+6=346(10) or the year 1999(10)


Base Weights
            A simple decimal weighting table is

... 103 102 101 100 . 10-1 10-2 10-3 ...

            In general, in a base b system the successive digit positions, from left to right, have the weights

            ... b3 b2 b1 b0 . b-1 b-2 b-3 ...
                                 radix position       
            The symbol "." is called radix point.
            The portion of the number to the right of the radix is called the fraction part of the number, and the portion to the left is called the integral part. In the decimal numbering system, the radix point is called the decimal point.

Integer. Generally an integer is represented as [±]n, where n∈N. Given a base b and an integer number N.
Definition. A sequence of digits anan-1...a1a0 is said to be a representation of the number N in the base b (in b number system) if and only if it satisfies the properties:
            - the digits an,an-1, ..., a1,a0 are natural numbers and satisfies the constraint:
                        0<=ai<= (b-1), i=0,1,2, ..., n
            - we have the equality:
                        N=an*bn+an-1*bn-1+ ... + a0*b0.
            For a given number N we have a representation, and only one, in a base b.

Real. Generally a real number is represented as [±]n.m, where n∈N and m∈N. Given a real number R and a base b.
Definition. A sequence of digits anan-1...a1a0a-1a-2...a-m is said to be a representation in the base b if and only if:
            - the digits an,an-1, ..., a1,a0,a-1,a-2, ..., a-m are natural numbers and satisfy the property:
                        0<=ai<= b-1, i=-m, ...,-1,0,1,2, ..., n
            - we don't have a range j such that:
                        aj=aj-1-aj-2=b-1
            - we have the equality:
                        N=an*bn+an-1*bn-1+... + a0*b0 +a-1*b-1+a-2*b-2 +... +a-m*b-m.
            If the real number R satisfies the proprieties just outlined, by definition we write (express) this number as:

anan-1 ... a1a0 v a-1a-2 ... a-m

 where v is the decimal point (, or .). In this sequence an is said to be the most significant digit and a-m is said to be the most unsignificant digit.
            For a given number R we have a representation, and only one, in a base b, that can be represented in one of the following formats:

1) anan-1an-2…a0a-1a-2…a-m

2)  an*bn+an-1*bn-1+... + a0*b0 +a-1*b-1+a-2*b-2 +... +a-m*b-m

 
3)  Decimal weigths
           



*)The theory in that page is made by excerpts from the books:
- Vasile Avram, Gheorghe Dodescu: Informatics: Computer Hardware and Programming in Visual Basic, Ed. Economică, Bucureşti, 2003
- Vasile Avram, Gheorghe Dodescu: General Informatics, Ed. Economica, 1997

Copyright © 2006-2008 Vasile Avram

Valid CSS! Valid HTML 4.01 Transitional Cynthia Tested!