It is 0 and 1.0=OFF AND 1=ON.
Chat with our AI personalities
Binary.
Binary numbers have only 2 digits, 0 and 1. Binary came from a need to represent information based in magnetics that only offer an "on" or "off" state. Decimal numbers have 10 digits, 0,1,2,3,4,5,6,7,8,9. Decimal numbers came about from humans having 10 fingers to count with. Once they reach 10, they start reusing fingers (digits). When humans count to 3, they count to their 3rd digit. Here's how to count to 3 in binary, which only has 2 digits: 01,10,11 Here's counting to 7 in decimal: 1,2,3,4,5,6,7 Here's counting to 7 in binary: 001,010,011,100,101,110,111 All of the mathematics done in decimal can be done in binary. No matter how fancy computers get, the bottom line is they have to store and manipulate information at a physical level, something physical must store all of that information. In computers, that physical storage is magnetic. All information is stored and manipulated at the lowest level as a combination of large binary values, large combinations of "on" and "off". Scientists are inventing new ways to store information in computers, so perhaps in time computer storage won't be limited to binary values.
Whenever a computer program uses integers - for example, in a game, to store a player's score, but also for many other situations - this will internally be stored as a binary number. This number may be signed or unsigned. Some programming languages, such as Java, only use signed numbers. In other cases, the programmer may decide to use either signed or unsigned numbers, depending on his needs.
Floating point numbers are stored in scientific notation using base 2 not base 10.There are a limited number of bits so they are stored to a certain number of significant binary figures.There are various number of bytes (bits) used to store the numbers - the bits being split between the mantissa (the number) and the exponent (the power of 10 (being in the base of the storage - in binary, 10 equals 2 in decimal) by which the mantissa is multiplied to get the binary/decimal point back to where it should be), examples:Single precision (IEEE) uses 4 bytes: 8 bits for the exponent (encoding ±), 1 bit for the sign of the number and 23 bits for the number itself;Double precision (IEEE) uses 8 bytes: 11 bits for the exponent, 1 bit for the sign, 52 bits for the number;The Commodore PET used 5 bytes: 8 bits for the exponent, 1 bit for the sign and 31 bits for the number;The Sinclair QL used 6 bytes: 12 bits for the exponent (stored in 2 bytes, 16 bits, 4 bits of which were unused), 1 bit for the sign and 31 bits for the number.The numbers are stored normalised:In decimal numbers the digit before the decimal point is non-zero, ie one of {1, 2, ..., 9}.In binary numbers, the only non-zero digit is 1, so *every* floating point number in binary (except 0) has a 1 before the binary point; thus the initial 1 (before the binary point) is not stored (it is implicit).The exponent is stored by adding an offset of 2^(bits of exponent - 1), eg with 8 bit exponents it is stored by adding 2^7 = 1000 0000Zero is stored by having an exponent of zero (and mantissa of zero).Example 10 (decimal):10 (decimal) = 1010 in binary → 1.010 × 10^11 (all digits binary) which is stored in single precision as:sign = 0exponent = 1000 0000 + 0000 0011 = 1000 00011mantissa = 010 0000 0000 0000 0000 0000 (the 1 before the binary point is explicit).Example -0.75 (decimal):-0.75 decimal = -0.11 in binary (0.75 = ½ + ¼) → 1.1 × 10^-1 (all digits binary) → single precision:sign = 1exponent = 1000 0000 + (-0000 0001) = 0111 1111mantissa = 100 0000 0000 0000 0000 0000Note 0.1 in decimal is a recurring binary fraction 0.1 (decimal) = 0.0001100110011... in binary which is one reason floating point numbers have rounding issues when dealing with decimal fractions.
1111 1111 1111 1111 = 2^16 = 65536