send link to app

Real Base Converter


Ferramentas de programação Ensino Ensino
Developer: Chris Pappas
2.99 USD

Real Numbers and Numeric Bases

Have you ever wondered why base change calculators typically do not convert the fractional parts of real numbers to the new base? Usually, only the integer portion of a real number is converted. So, if you want to convert 11.375 to hexadecimal and binary, what you get from this type of calculator is B (hex) and 1011 (binary) instead of B.6 and 1011.011.

One of the reasons for this lack of a complete conversion is the fact that integer number conversions from one base to another are encountered 99% of the time, due to the fact that the least-significant bit on any data bus is either a 1 or a 0. There are no fractional values on a computer’s data bus. This simply means that only integers are sent across the data bus, and if you want to transmit “real” number values with fractional or decimal components other means must be employed. The “other means” typically requires that real numbers be encoded to appear as integers. (for more information on this topic, see the IEEE 754 conversion standards).

Another reason might be the difficulty in obtaining accurate fractional results. However, with 32 and 64-bits of precision, fairly accurate results can now be accomplished.

One single wire on a computer’s data bus represents a single data bit. When multiple bits are used to transmit data, the multiple wires are called a data bus. Early PC and Mac® computers had 8-bit data busses (eight wires). Today, most personal computers use 64-bit data busses (sixty-four wires). This Real Base Converter application will handle up to 64-bits of precision for the integer portion of a real number and up to 64-bits of precision for the fractional portion. The “uniqueness” of up to 128-bits of total precision is achieved by separating the data entry portions of the integer and fractional values of the real number and performing separate conversions for each.

If you have programmed with assembly language or perhaps C/C++, then you are familiar with the need to convert from one base, or radix, to another. Usually binary (base 2), hexadecimal (base 16) and decimal (base 10) are encounter in computer work. Octal (base 8) was once a popular base, but is seldom used today.

Base 16, or hexadecimal, uses the digits 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E and F

Base 10, or decimal, uses the digits 0,1,2,3,4,5,6,7,8 and 9

Base 2, or binary, uses the digits 0 and 1

The range of hexadecimal numbers, for the Real Base Converter application is unsigned values from:

0.0 to FFFFFFFFFFFFFFFF.FFFFFFFFFFFFFFFF

For decimal numbers, the range of unsigned values is:

0.0 to 18446744073709551615.999999999999999….
99994
(accurate to 19 +/- 1 decimal places.)

Finally, for binary numbers, this range of unsigned values is:

0.0 to 1111111111111111111111111111111111111111111111111111111111111111.
1111111111111111111111111111111111111111111111111111111111111111

The numeric range of values and the precision of the conversions represent a very wide range of values from the very large to the very small.

As a note of interest, America put a man on the moon using calculations made with slide rules. Slide rules have an accuracy of three significant decimal digits. We’ve come a long way since 1969!