• PL
  • EN

System szesnastkowy (hexadecymalny)

To również system pozycyjny (tak jak binarny czy dziesiętny). Jest on dość specyficzny, ponieważ oprócz cyfr, do zapisu wartości liczbowych używane są również litery alfabetu! 16 kolejnych wartości w tym systemie to:

Zapis większych liczb wygląda dość ciekawie i z pewnością coś Ci przypomina. Weźmy dla przykładu taką liczbę: 6E. Aby dowiedzieć się co to za liczba w systemie dziesiętym, najłatwiej wykonać takzwaną konwersję pośrednią, czyli przejść najpierw na system binarny, a z binarnego na dziesiętny. Jeśli nie potrafisz jeszcze wykonywać tych konwersji, możesz przejść do dwóch ostatnich lekcji tego działu i zobaczyć na czym to polega. Możesz też spróbować zrozumieć to na omawianym niżej przykładzie.

Konwersja pośrednia to przejście między jednym systemem liczbowym, a drugim z wykorzystaniem trzeciego.
HEX >> BIN >> DEC to przejście z systemu szesnastkowego, przez binarny do dziesiętnego. Aby wykonać pierwszą konwersję, wykorzystajmy fakt że maksymalną liczbę jaką można zapisać w systemie szesnastkowym to 15D, czyli FHEX. Z lekcji o systemie binarnym wiemy, że liczba 15D binarnie to 1111B

Inny przykład liczby szesnastkowej to 7B. Zapiszmy ją w postaci dziesiętnej.

Ostatni przykład to 8B. Konwertujemy ją do postaci dziesiętnej dokładnie taką samą metodą.

Zauważ, że po sklejeniu wszystkich trzech przykładów powstanie szesnastkowa liczba 6E7B8B(HEX). Jeśli zapiszemy tą samą liczbę w sposób następujący: RGB(110,123,139). To można Powiedzieć, że właśnie udało nam się odkryć, że te trzy przypadkowe liczby to po prostu zwyczajny kolor . Jeśli chcesz ustawić kolor czcionki, tła lub innego obiektu na stronie internetowej, możesz użyć następującego kodu: #6E7B8B

CIEKAWOSTKA!

System hexadecymalny wykorzystywany jest do zapisywania bardzo dużych liczb. Dobrym przykładem jest identyfikator urządzeia sieciowego czyli po porstu unikalna nazwa każdego urządzenia elektronicznego, które może połączyć się z siecią. Może to być nie tylko karta sieciowa, router lub switch ale każde inne urządzenie jak włącznik światła wi-fi, kamerka internetowa lub inteligentna lodówka. Przykładowy MAC adres wygląda w następujący sposób: 00-3F-A3-E2-5C-C3.
W powyższych przykładach zauważyć można, że liczbę, którą zapisujemy szesnastkowo na dwóch pozycjach, binarnie zajmuje aż osiem pozycji. W związku z tym MAC adres binarnie zajmowałby jednym ciągiem aż 48 zer i jedynek, a tymczasem szesnastkowo tylko 12 . Przyznasz chyba, że system ten jest bardzo przydatny i potrzebny.

Hexadecimal system

It is also a positional system (just like binary or decimal). It is quite specific because, in addition to digits, letters of the alphabet are used to numerical values, letters of the alphabet are also used! The 16 consecutive values in this system are:

The notation of larger numbers looks quite interesting and certainly reminds you of something. Let's take a number like this as an example: 6E. In order to find out what a number is in the decimal system, the easiest way is to do the so-called intermediate conversion, i.e. to go first to the binary system and from binary to the decimal system. If you are not yet able to perform these conversions, you can skip to the last two lessons of this section and see what it actually involves. You can also try to understand it using the example below.

Intermediate conversion is the transition between one number system and another using a third.
HEX >> BIN >> DEC s the transition from the hexadecimal system, through binary to decimal. To perform the first conversion, let's take advantage of the fact that the maximum number that can be written in hexadecimal is 15(D), that is, F(HEX) . From our lessons on the binary system, we know that the number 15(D) binary is 1111(B)

Another example of a hexadecimal number is 7B. Let's write it down in decimal form.

The latest example is 8B. We convert it to decimal form using exactly the same method.

Note that gluing all three examples together will produce the hexadecimal number 6E7B8B(HEX). If we write the same number as follows: RGB(110,123,139). It can be said that we have just discovered, that these three random numbers are just regular colour . If you want to set the colour of a font, background or other object on a web page, you can use the following code: #6E7B8B

GOOD TO KNOW!

The hexadecimal system is used to write very large numbers. A good example is network device identifier, which is simply the unique name of each electronic device that can connect to a network. It may not only be a network card, router or switch but any other device like wi-fi light switch, webcam or smart fridge. An example MAC address looks like this: 00-3F-A3-E2-5C-C3.
In the examples above, you can see that the number we write hexadecimal in two positions, binary occupies as many as eight positions. Therefore, the MAC address would binary occupy one string of as many as 48 ones and zeros, and meanwhile hexadecimal only 12. You will probably admit that this system is very useful and necessary.