Sign in to follow this  

Any Advantages to use Hexadecimals?

This topic is 1607 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So, just for the fun of it, I learned how to convert numbers into hexadecimals just so I can use it in math operations to confuse those who don't understand it. Although, are there any advantages to coding in hexadecimals compared to regular numbers? Wouldn't it be faster? Right now I would be using it in Lua as that's the only programming language I can code in fluently at the moment.

Share this post


Link to post
Share on other sites
Faster? No, not at all. It's easy to convert back and forth between binary and hexadecimal (each hexadecimal digit corresponds to 4 binary digits), and it's friendlier to humans to type "830f" instead of "1000001100001111".

If you write code that does heavy use of bit manipulations (e.g., bitboards in chess), you'll find yourself using hexadecimal constants all the time. Edited by Álvaro

Share this post


Link to post
Share on other sites

We chatted a little about the benefits of hexadecimal here.

 

Hexadecimal and binary and decimal and octal is converted to the integer's binary format when the program is compiled. It's just a more convenient presentation (to the programmer) because of the power-of-two binary nature of computers.

 

I could sit and convert binary and hexadecimal to decimal, or vise-versa but it'd take me about a minute for hexadecimal values. Nevertheless, I still find it useful when doing things like bit-wise operations on numbers, or as a convenient shorthand for RGBA values.

Share this post


Link to post
Share on other sites

This topic is 1607 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this