Return to the home page.

The Ultimate Windows Math Toolbox

 

bullet Ver 3.0.697
23 June 2008
bullet Free support
bullet Only $44.85 (US)
(Professional)
Click to buy UltimaCalc Professional
bullet Only $34.85 (US)
(Standard)
Click to buy UltimaCalc Standard.

bullet Free download

<<< Prev  Next >>>

 

Decimal and Hexadecimal

Numbers are normally written in a decimal base, in other words, using the digits 1, 2, 3, 4, 5, 6, 7, 8, 9 and 0. (Why people traditionally put the 0 last, I don’t know.)

In a decimal base, a number such as 2345 is interpreted as 2 thousands (10 x 10 x 10) plus 3 hundreds (10 x 10) plus 4 tens (10) plus 5 ones.

In hexadecimal, the number base is 16, so in hexadecimal, 2345 is interpreted as 2 lots of 16 x 16 x 16 plus 3 lots of 16 x 16 plus 4 lots of 16 plus 5, which is 9029 in decimal. Hexadecimal needs to use 16 different symbols to the values from 0 to 15, so it uses 0 to 9 as the decimal representation does, plus the letters A, B, C, D, E, F (or a, b, c, d, e, f) to represent the digits of values 10, 11, 12, 13, 14, and 15 in decimal.

To show that you want a number to be read in as hexadecimal, several systems are in use. For UltimaCalc, put a ‘0x’ or a ‘0X’ in front of it. (That’s a leading zero, not a letter ‘O’).

So a number written 0xABC in hexadecimal is written 2748 in decimal (10 times 16 x 16 plus 11 times 16 plus 12). Of course, if you want to use an exponent notation for hexadecimal numbers, you can’t use the letter ‘e’ or ‘E’ as you would for decimal numbers, as this letter would be far too easily confused with the digit value 14.

Instead, UltimaCalc uses the letter ‘x’ or ‘X’ to indicate an exponent that indicates a power of 16, for example 0x3x4 is the value 3 with a multiplier of 16x16x16x16, or 196608 in decimal. In hexadecimal mode, it would be shown as 0x30000. However, to make hexadecimal numbers more readable, UltimaCalc inserts spaces every four digits away from the decimal point, so 0x3x4 is actually displayed as 0x3 0000, though no spaces should be included when you are typing in a number.

And of course you can use a sign in front of a hexadecimal number. Some calculators that pretend to handle hexadecimal numbers assume that any number whose first digit is 8 or greater is a negative number. UltimaCalc makes no such assumption, as such an assumption is based on an assumption about the number of digits that a hexadecimal number is allowed to have, and this is nonsense.

Also, in UltimaCalc you can put decimal points in hexadecimal numbers. This is something very rarely done on calculators, presumably because of an incorrect assumption that if a number is written in hexadecimal form then it must be an integer.

So, for example, 0x3.4 is 3.25 in decimal (3 plus 4/16) and –0x2.2 is –2.125 in decimal, and –0x1x-1 is –0.0625 in decimal, being minus one divided once by 16. (This number is shown as –0x0.1 in hexadecimal mode). Finally, the value of pi in hexadecimal is certainly not 3, as some calculators would have it, but something like 0x3.243F 6A88 85A3 08D3...

To choose between viewing the results in decimal or in hexadecimal, choose the appropriate view mode in the ‘Format’ menu. On this menu, a tick shows which mode your are in. To turn hexadecimal mode off, simply choose some other view mode, such as Standard.