# Arithmetic Pipeline

Arithmetic Pipelines are mostly used in high-speed computers. They are used to implement floating-point operations, multiplication of fixed-point numbers, and similar computations encountered in scientific problems.

To understand the concepts of arithmetic pipeline in a more convenient way, let us consider an example of a pipeline unit for floating-point addition and subtraction.

The inputs to the floating-point adder pipeline are two normalized floating-point binary numbers defined as:

```    X = A * 2a = 0.9504 * 103
Y = B * 2b = 0.8200 * 102
```

Where A and B are two fractions that represent the mantissa and a and b are the exponents.

The combined operation of floating-point addition and subtraction is divided into four segments. Each segment contains the corresponding suboperation to be performed in the given pipeline. The suboperations that are shown in the four segments are:

1. Compare the exponents by subtraction.
2. Align the mantissas.
3. Add or subtract the mantissas.
4. Normalize the result.

We will discuss each suboperation in a more detailed manner later in this section.

The following block diagram represents the suboperations performed in each segment of the pipeline. ### 1. Compare exponents by subtraction:

The exponents are compared by subtracting them to determine their difference. The larger exponent is chosen as the exponent of the result.

The difference of the exponents, i.e., 3 - 2 = 1 determines how many times the mantissa associated with the smaller exponent must be shifted to the right.

### 2. Align the mantissas:

The mantissa associated with the smaller exponent is shifted according to the difference of exponents determined in segment one.

```	X = 0.9504 *  103
Y = 0.08200 * 103
```

The two mantissas are added in segment three.

```Z = X + Y = 1.0324 * 103
```

### 4. Normalize the result:

After normalization, the result is written as:

```Z = 0.1324 * 104
```
{"ft_lang_label":"__label__en","ft_lang_prob":0.9078155,"math_prob":0.9597908,"size":1901,"snap":"2020-24-2020-29","text_gpt3_token_len":417,"char_repetition_ratio":0.13494992,"word_repetition_ratio":0.026229508,"special_character_ratio":0.2283009,"punctuation_ratio":0.116959065,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.999556,"pos_list":[0,1,2,3,4,5,6,7,8],"im_url_duplicate_count":[null,5,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-07-12T17:15:03Z\",\"WARC-Record-ID\":\"<urn:uuid:7bf16195-1ecc-4609-84af-aaf9fcc4e929>\",\"Content-Length\":\"51719\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:fec8a7e8-7c22-484e-9250-685ec67dbe2c>\",\"WARC-Concurrent-To\":\"<urn:uuid:df8a5c8a-322a-4d80-bc8d-b8b38ff6f944>\",\"WARC-IP-Address\":\"194.169.80.121\",\"WARC-Target-URI\":\"https://www.javatpoint.com/arithmetic-pipeline\",\"WARC-Payload-Digest\":\"sha1:QR64JDZUN3Q2DXX6A22XVY3VSNB2ZL5S\",\"WARC-Block-Digest\":\"sha1:RDPEQHAQQUDKPW3EZUO5MTKNHVXD5HUB\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-29/CC-MAIN-2020-29_segments_1593657138752.92_warc_CC-MAIN-20200712144738-20200712174738-00158.warc.gz\"}"}