# Binary Number Calculation – How It Works

Well, I present a Binary calculator that performs arithmetic operations on binary numbers. Technically, it is made on the basis of a calculator. Mathematical calculator. It was made at the request of the user Arithmetic of binary numbers.

That’s all, actually – we enter the expression using binary numbers, the calculator parses it and gives the result.

By the numerous requests of users, I decided to combine the logic of calculators Arithmetic of binary numbers and converting of fractional numbers from one number system to another and make a universal calculator that can perform basic mathematical operations (addition, subtraction, multiplication, division and raising to a power) on numbers in any number system.

To indicate the number system, the parameter “Base of the number system in which the expression is written” is used, in which you can specify any number from 2 to 36. For example, 2 for binary, 8 for octal, 16 for hexadecimal, and so on.

Fractional number expressions are also supported. Since all calculations are implemented through the decimal number system, the results for fractional numbers may not always be accurate. The accuracy of the conversion can be set by the parameter “Precision of conversion of fractional numbers (digits).” Read about conversion accuracy here. Transfer of fractional numbers from one number system to another

To raise to a power, a construction of the form number ^ degree is used (below, for example, 110 ^ 10).

## Binary Addition

Addition of two binary numbers is made by a column bitwise. Starting with the least significant digit (from right to left), as in the case of addition of decimal numbers by a column. But since there are only two digits (0 and 1), their addition occurs according to the following rules:

## Subtraction Of Binary Numbers

Subtraction of binary numbers is carried out similarly to addition – a column, but according to the following rules:

## Binary Number Multiplication

Multiplication of binary numbers is performed in a column similar to multiplication in the decimal system, but according to the following rules:

## Binary Division

Externally, the division of binary numbers is similar to the division of decimal numbers, but there are some nuances: such division is performed by subtracting the divisor with a shift to the right if the remainder is greater than zero. To understand this process, consider an example:

After I made several calculators for translating between different number systems – here is a list from the first to the latest version, from the simplest to the most complex: converting of a number into other number systems , convert from a decimal number system , Transfer from one number system to another – in the comments they began to periodically ask – what about supposedly fractional numbers, how can we translate them? And when asked more than three times, I decided to study this issue.

The result was a calculator, which you see at the other side of the link. I

t can translate fractional numbers as well. As usual, for the curious, there’s a little theory under the calculator.

I hope someone will find this helpful.