# AI News, Difference between revisions of "Computer Logic"

- On 4. oktober 2018
- By Read More

## Difference between revisions of "Computer Logic"

Computer logic is an aspect of computer design concerning the fundamental operations and structures upon which all computer systems are built.

The decimal number system uses the alphabet {0,1,2,3,4,5,6,7,8,9}, called digits, and the basic operations add, subtract, mulitply, and divide, symbolised as {+,-,*,/}.

Thus the numbers 5, 50, 500, 0.000005 all contain the digit 5 to represent different quantities and the 0 digit merely allows us to correctly position the 5.

While this may seem crazy, the fact is this flexibility is exactly what enables computer scientists to design language aware tools, like word-processors, spell checkers, and rudimentary language translators.

Since computer science is utterly based on Number System Theory, the meaning of digits must be expanded beyond mere counting, quantities, and values.

The key to understanding computers lies in unlearning that the digit 1 means one and only one, and learning that the digit 1 identifies something, which may not be a number at all.

The astute reader (and you are, aren't you?) will have noticed that a ten-digit number system can represent nine values, four digits only three values, and twenty no more than nineteen.

For a ten digit system the change is a multiple of ten, a four digit system changes by a multiple of four, and a twenty digit system changes each position by a multiple of twenty.

The number 1104 can now be read as, 'One-one-zero, base four' and know that 'One-one-zero, base eight' (1108) might look similar to 1104, but is actually a different value in another Number System.

Base 2 (binary), Base 8 (octal), and Base 16 (hexadecimal) numeral systems are used because designing a computer system is simpler in this manner than for other bases.

The hexadecimal numeral system has the special property that every digit represents exactly four bits, so it can be used as a compact representation of large values.

For example, the binary equivalent of the hexadecimal number A3 is 10100011, where A is 1010 (10 in decimal) and 3 is 0011 (3 in decimal).

Just as rules exist for arithmetic operations on decimal numbers, there are a number of techniques for evaluating various operations in non-decimal bases.

This system is popular because numbers using this representation are easy to negate, and arithmetic operations can be performed on both positive and negative numbers in the same manner.

In two's complement, binary values whose most significant bit (MSB) is 0 are positive, whereas those whose MSB is 1 are negative.

it takes advantage of the fact that adding 1 forces you to carry that bit during the addition, so we save ourselves some work ahead of time: beginning with the least significant bit (LSB), keep all of the 0-bits and the least significant 1-bit (10 in our example);

In binary, it is slightly easier, because you will notice that after 1, we have already reached the base, so just zero the current position, and carry that 1 to the next position.

Using 4-bit binary strings, each decimal digit is encoded in binary: 48610 = (0100 1000 0110)2.

The limit is of course 10012 because 9 is the largest decimal value and the 4-bit binary string has a capacity of 1510.

The time it takes for a gate to generate an output when it receives new inputs signals is not instantaneous, but it is very fast, on the order of picoseconds.

Decoding is performed by decoder,a combonational circuit with an n-bit binary code applied to its input and an m-bit binary code appears at the output.

An encoder is a digital function that perform the inverse operation of a decoder.An encoder has 2'n input lines and n output lines.The output lines generate the binary code corresponding to the input value.

- On 9. oktober 2018
- By Read More

## Binary number

In mathematics and digital electronics, a binary number is a number expressed in the base-2 numeral system or binary numeral system, which uses only two symbols: typically 0 (zero) and 1 (one).

Because of its straightforward implementation in digital electronic circuitry using logic gates, the binary system is used by almost all modern computers and computer-based devices.

The scribes of ancient Egypt used two different systems for their fractions, Egyptian fractions (not related to the binary number system) and Horus-Eye fractions (so called because many historians of mathematics believe that the symbols used for this system could be arranged to form the eye of Horus, although this has been disputed).[1]

Horus-Eye fractions are a binary numbering system for fractional quantities of grain, liquids, or other measures, in which a fraction of a hekat is expressed as a sum of the binary fractions 1/2, 1/4, 1/8, 1/16, 1/32, and 1/64.

The Song Dynasty scholar Shao Yong (1011–1077) rearranged the hexagrams in a format that resembles modern binary numbers, although he did not intend his arrangement to be used mathematically.[5]

Viewing the least significant bit on top of single hexagrams in Shao Yong's square and reading along rows either from bottom right to top left with solid lines as 0 and broken lines as 1 or from top left to bottom right with solid lines as 1 and broken lines as 0 hexagrams can be interpreted as sequence from 0 to 63. [7]

He used binary numbers in the form of short and long syllables (the latter equal in length to two short syllables), making it similar to Morse code.[10][11]

For that purpose he developed a general method or ‘Ars generalis’ based on binary combinations of a number of simple basic principles or categories, for which he has been considered a predecessor of computing science and artificial intelligence (see Bonner 2007 <http://lullianarts.net/>, Fidora et al.

In 1605 Francis Bacon discussed a system whereby letters of the alphabet could be reduced to sequences of binary digits, which could then be encoded as scarcely visible variations in the font in any random text.[15]

a Sinophile, Leibniz was aware of the I Ching, noted with fascination how its hexagrams correspond to the binary numbers from 0 to 111111, and concluded that this mapping was evidence of major Chinese accomplishments in the sort of philosophical mathematics he admired.[20] Leibniz

Since the binary numeral 100 represents the value four, it would be confusing to refer to the numeral as one hundred (a word that represents a completely different value, or amount).

When the available symbols for this position are exhausted, the least significant digit is reset to 0, and the next digit of higher significance (one position to the left) is incremented (overflow), and incremental substitution of the low-order digit resumes.

As a result, 1/10 does not have a finite binary representation, and this causes 10 × 0.1 not to be precisely equal to 1 in floating point arithmetic.

As an example, to interpret the binary expression for 1/3 = .010101..., this means: 1/3 = 0 × 2−1 + 1 × 2−2 + 0 × 2−3 + 1 × 2−4 + ...

When the result of an addition exceeds the value of a digit, the procedure is to 'carry' the excess amount divided by the radix (that is, 10/10) to the left, adding it to the next positional value.

It is based on the simple premise that under the binary system, when given a 'string' of digits composed entirely of n ones (where: n is any integer length), adding 1 will result in the number 1 followed by a string of n zeros.

That concept follows, logically, just as in the decimal system, where adding 1 to a string of n 9s will result in the number 1 followed by a string of n 0s:

In the following example, two numerals are being added together: 1 1 1 0 1 1 1 1 1 02 (95810) and 1 0 1 0 1 1 0 0 1 12 (69110), using the traditional carry method on the left, and the long carry method on the right:

Instead of the standard carry from one column to the next, the lowest-ordered '1' with a '1' in the corresponding place value beneath it may be added and a '1' may be carried to one digit past the end of the series.

In our simple example using small numbers, the traditional carry method required eight carry operations, yet the long carry method required only two, representing a substantial reduction of effort.

When the result of a subtraction is less than 0, the least possible value of a digit, the procedure is to 'borrow' the deficit divided by the radix (that is, 10/10) from the left, subtracting it from the next positional value.

Two numbers A and B can be multiplied by partial products: for each digit in B, the product of that digit in A is calculated and written on a new line, shifted leftward so that its rightmost digit lines up with the digit in B that was used.

1

2

(

1

2

)

2

=

1

4

1

2

(

1

3

)

The only difficulty arises with repeating fractions, but otherwise the method is to shift the fraction to an integer, convert it as above, and then divide by the appropriate power of two in the decimal base.

A simple divide-and-conquer algorithm is more effective asymptotically: given a binary number, it is divided by 10k, where k is chosen so that the quotient roughly equals the remainder;

Given a decimal number, it can be split into two pieces of about the same size, each of which is converted to binary, whereupon the first converted piece is multiplied by 10k and added to the second converted piece, where k is the number of decimal digits in the second, least-significant piece before conversion.

To convert a hexadecimal number into its decimal equivalent, multiply the decimal equivalent of each hexadecimal digit by the corresponding power of 16 and add the resulting values:

Binary is also easily converted to the octal numeral system, since octal uses a radix of 8, which is a power of two (namely, 23, so it takes exactly three binary digits to represent an octal digit).

a

Another similarity is the existence of alternative representations for any terminating representation, relying on the fact that 0.111111… is the sum of the geometric series 2−1 + 2−2 + 2−3 + ...

- On 9. oktober 2018
- By Read More

## Binary Number System

This is 1×8 + 1×4 + 0×2 + 1 + 1×(1/2) + 0×(1/4) + 1×(1/8) =

Numbers can be placed to the left or right of the point, to show values greater than one and less than one.

To show that a number is a binary number, follow it with a little 2 like this: 1012 This way people won't think it is the decimal number "101"

"There are 10 kinds of people in the world, those who understand binary numbers, and those who don't."

- On 24. september 2021

**Representing Numbers and Letters with Binary: Crash Course Computer Science #4**

Please take our PBS Digital Studios Survey! Today, we're going to take a look at how computers use a stream of 1s ..

**Binary Numbers and Base Systems as Fast as Possible**

Binary numbers, man... How do they work? Get a FREE 7 day trial for lynda.com here: Follow Taran on Twitter @taranvh

**Twos complement: Negative numbers in binary**

How can we represent negative numbers in binary? There are several ways. This video compares using a sign bit, ones complement, and twos complement.

**A brief history of numerical systems - Alessandra King**

View full lesson: 1, 2, 3, 4, 5, 6, 7, 8, 9... and 0. With just these ten symbols, we ..

**GENIUS TRICK - Convert Decimal Numbers To Binary (Base 2)**

This video gives a method to convert decimal numbers to binary numbers quickly. This is a variation of the remainder system that is typically taught in courses.

**Binary Numbers**

Understanding how numbers are represented. Introduction to binary numbers.

**Lesson 6.1 : Basics of signed and unsigned numbers**

See more at -- The basics of signed and unsigned numbers

**Introduction to number systems and binary | Pre-Algebra | Khan Academy**

Watch the next lesson: ...

**Converting from decimal to binary | Applying mathematical reasoning | Pre-Algebra | Khan Academy**

Watch the next lesson: ...

**Binary,Decimal,Octal,Hexadecimal Conversion (PART-1)**

Binary to decimal Binary to octal Binary to hexadecimal.