Computing.Net > Forums > Unix > Hex to Decimal

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Hex to Decimal

Reply to Message Icon

Name: paul
Date: October 15, 2002 at 10:16:27 Pacific
OS: AIX 4.3
CPU/Ram: 375
Comment:

I am trying to figure out the cpu speed for an AIX box. The CPU speed is given in HEX. How can I convert HEX to a decimal number? Is there a function?



Sponsored Link
Ads by Google

Response Number 1
Name: LANkrypt0
Date: October 15, 2002 at 11:31:29 Pacific
Reply:

May want to have a look at:
http://www.computing.net/unix/wwwboard/forum/2886.html


0

Response Number 2
Name: Don Arnett
Date: October 15, 2002 at 12:13:35 Pacific
Reply:

First, remember that the hex digits A - F have the values 10 - 15 (A=10, B=11...F=15).

Then, number the columns from right to left starting with zero.

Then calculate the value of each digit and add them together. If x is the column number, you calculate the value of a column with

digit * 16^x


So, for the hex value 3AE:

E = 14 * 16^0 = 14 * 1 = 14

A = 10 * 16^1 = 10 * 16 = 160

3 = 3 * 16^2 = 3 * 256 = 768


15 + 160 + 768 = 943


For $15 or less you can buy a calculator that does hex, octal and binary math in addition to decimal.


0

Response Number 3
Name: Leigh
Date: October 16, 2002 at 16:29:34 Pacific
Reply:

I think you'll find there is a Hex calculator in the Scientific mode of the Windows calculator.

I've tried it and it works fine.


0

Response Number 4
Name: Richard
Date: October 17, 2002 at 04:20:56 Pacific
Reply:

Why so complicated?

$ bc
ibase=16
ABC
2748

or the other way round
$ bc
obase=16
1000
3E8

I would imagine bc was part of AIX.


0

Response Number 5
Name: James Boothe
Date: October 17, 2002 at 08:55:39 Pacific
Reply:

Or from my earlier post, as LANkrypt0 referenced, ksh has built-in support for very easy base conversions, such as:

((mydec=16#$myhex))


1

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

Suse Live eval installation



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Hex to Decimal

Hex to ascii www.computing.net/answers/unix/hex-to-ascii/6894.html

dec to hex www.computing.net/answers/unix/dec-to-hex/2407.html

Unix Hexadecimal www.computing.net/answers/unix/unix-hexadecimal/2886.html