إرسال رابط إلى التطبيق

Real Base Converter


4.4 ( 9344 ratings )
الأدوات المساعدة التعليم
المطور: 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, this type of calculator returns 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.)

A second reason for the lack of a “complete” conversion might be the difficulty in obtaining accurate fractional results. However, with 32 and 64-bits of precision, fairly accurate results can now be accomplished.

Recall that 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).

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), once a popular numeric base, 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 Real Base Converter (RBC) Application

The Real Base Converter application will handle numbers with 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 real number into the integer and fractional values. Thus, if you want to convert π into hexadecimal and binary, enter “3” to the left of the decimal point (press enter), then enter “14159 2653589793” on the right of the decimal point (press enter).

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

0.0 to FFFFFFFFFFFFFFFF.FFFFFFFFFFFFFFFF

For decimal numbers, the range of unsigned values is:

0.0 to 18446744073709551615.999999999999999
(accurate to 15 +/- 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 just three significant decimal digits. We’ve come a long way, in terms of precision, since 1969!