轉換器工具
0 bits
Enter a binary number (spaces are allowed for readability). Choose between unsigned and signed (two's complement) interpretation.
Bits:
0
Type:
Unsigned
關於此工具
二進位到十進位轉換器是一種將二進位數轉換為十進位等效值的工具。每個二進位數都被解釋為無符號數或使用 2 的補碼表示的有符號數。
如何運作
- The input binary string is validated to ensure it contains only 0s and 1s (spaces are allowed for readability).
- The user can choose between unsigned and signed (two's complement) interpretation.
- For unsigned interpretation, each bit's value is calculated based on its position (2^position) and summed up.
- For signed interpretation (two's complement), if the leftmost bit is 1, the number is negative. The two's complement conversion is applied to determine the magnitude.
- 將顯示生成的十進位值。
常見用途
- 電腦科學教育:瞭解二進位數在計算機中如何解釋為十進位值。
- 數位電子學:將來自硬體的二進位信號轉換為人類可讀的十進位值。
- Programming:將從檔或網路套接字讀取的二進位數據解釋為十進位數。
- 資料分析:將二進位編碼的數據轉換為十進位格式以進行分析。
- Cryptography:將二進位編碼的鍵或值轉換為十進位以進行加密計算。
二進位系統基礎
二進位系統僅使用兩位數位 0 和 1 來表示數位。二進位數中的每個數字稱為一個位。二進位數可用於使用不同的方法表示正數和負數,例如負數的 2 補碼。
二進位到十進位的轉換範例
| Binary | 無符號十進位 | Signed Decimal (Two's Complement) |
|---|---|---|
| 0000 | 0 | 0 |
| 0001 | 1 | 1 |
| 0101 | 5 | 5 |
| 1000 | 8 | -8 |
| 1111 | 15 | -1 |
| 11111111 | 255 | -1 |