[TUT] Hexadecimal system
Quote:
I prefer this system instead of decimal system. Why? It's easier to convert those integers to binary system which is used by computers. It also looks kinda cooler :P Some examples of integers in HEX system
It is quite easy. 0x10 Just don't mind about this first zero. Imagine that x = 16. 0x10 = x(16) * 1 + 0 = 16 Just multiple first number after x (As I said imagine that x = 16) The rest integers you have to sum. We multiplied 16 by 1 and we add there a 0 Some more examples 0x21 = x(16) * 2 + 1 = 33 0xFF = x(16) * 15 + 15 = 255 Oh wait! What is this 'F' character? In this system you can also use letters instead of numbers. Code:
A = 10 Compiler detects that this integer is in HEX System by 0x at the begining. You don't need to use this zero in conversion. How would it look in a PAWN script? PHP Code:
|
Re: [TUT] Hexadecimal system
PHP Code:
Your tut only covers hex values <= 255, which it is typically easier to just use decimals. You should also discuss how larger values are stored which I think will better explain hexadecimal. You should post a link to a calculator so people can calculate they own values. Also, this link helps. Here's another. |
Re: [TUT] Hexadecimal system
Quote:
Quote:
|
Re: [TUT] Hexadecimal system
new sMessage[0x80]
this kind of stuff just makes ur code unreadable, code is for people to read, I don't see any cool thing to declare an array with hex as its size. |
Re: [TUT] Hexadecimal system
I agree with you both, I would never use hex to replace simple numeric values just for the sake of using hex. Why use 0x13 when 19 will do? It would be especially confusing for those viewing code who are not versed in hexadecimal.
The only time I would agree with his statement is when working with bit masks. In this instance they are actually easier to use than decimal numbers. 1111 1111 = binary 255 = decimal FF = hex 1111 0000 1111 0000 = binary 61680 = decimal F0F0 = hex 1111 0000 1111 1111 1111 = binary 987135 = decimal F0FFF = hex |
Re: [TUT] Hexadecimal system
Quote:
Thanks. |
Re: [TUT] Hexadecimal system
Quote:
Bugsy also wrote a tutorial on bits. |
Re: [TUT] Hexadecimal system
Thanks Bugsy, that's a really good point.
|
Re: [TUT] Hexadecimal system
You didnt explained about numbers higher than 0xFF like 0xF0FFF
So can you please cover this part as well ? other wise it will confuse people like me. |
Re: [TUT] Hexadecimal system
what should it cover ? It's just a numeral system, nothing to explain on higher than 0x10
|
All times are GMT -4. The time now is 13:53. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.