Data Types
Signed vs. unsigned datatypes.
Data Types | Bits | Range of Values |
---|---|---|
Unsigned char | 8 | 0 to 255 |
Signed char | 8 | -128 to 127 |
Unsigned short | 16 | 0 to 65535 |
Signed short | 16 | -32768 to 32767 |
Unsigned int | 32 | 0 to 4294967295 |
Signed int | 32 | -2147483648 to 2147483647 |
Float | 32 | -3.4028 1038 to 3.4028 1038 |
Double | 64 | -1.7977 10308 to -1.7977 10308 |
- one byte is 8 bits
Example - Unsigned char (byte)
The unsigned char with 8 bits can represent integers from 0 to 255 - check the Binary - to Decimal, Hexadecimal and ASCII Converter
- The unsigned char (byte) 01100100 represents the decimal number 100.
Example - Signed char (byte)
With the signed char the leading bit indicates the sign of the number. 1 is negative and 0 is positive.
- The signed char (byte) 01100100 represents the decimal number 100.
- The signed char (byte) 10011100 represents the decimal number -100.
Example - Unsigned short
- The unsigned short 00000000 01100100 represents the decimal number 100.
Example - Signed short
- The signed short 00000000 01100100 represents the decimal number 100.
- The signed short 11111111 10011100 represents the decimal number -100.
Example - Unsigned int
- The unsigned int 00000000 00000000 00000000 01100100 represents the decimal number 100.
Example - Signed int
- The signed int 00000000 00000000 00000000 01100100 represents the decimal number 100.
- The signed int 11111111 11111111 11111111 10011100 represents the decimal number -100.
Example - Float
- The Float 01000010 11001000 00000000 00000000 represents the decimal number 100.
- The Float 11000010 11001000 00000000 00000000 represents the decimal number -100.
Example - Double
- The Double 01000000 01011001 00000000 00000000 00000000 00000000 00000000 00000000 represents the decimal number 100.
- The Double 11000000 01011001 00000000 00000000 00000000 00000000 00000000 00000000 represents the decimal number -100.
Related Topics
-
Mathematics
Mathematical rules and laws - numbers, areas, volumes, exponents, trigonometric functions and more.
Related Documents
-
ASCII Codes
ASCII codes and characters. -
Binary to Decimal, Hexadecimal and ASCII Converter
Convert between binary, decimal and hexadecimal numbers. -
Binary, Octal and Hexadecimal Numbers
Decimal, binary, octal and hexadecimal numbers. -
Boolean Algebra
Logic functions where the values of variables are true (1) or false (0). -
Bytes, Kilobytes and Megabytes
Computer bytes. -
HTML Color Codes
Safe html color codes. -
Prefixes for Binary Multiplies
IEC International Standard names and symbols