# Lab 7
Name: Manan Chavda
Roll No.: CS22B017
---
## Question 1
```
0.1 * 2 = 0.2
0.2 * 2 = 0.4
0.4 * 2 = 0.8
0.8 * 2 = 1.6
0.6 * 2 = 1.2
0.2 * 2 = 0.4
0.4 * 2 = 0.8
0.8 * 2 = 1.6
0.6 * 2 = 1.2
0.2 * 2 = 0.4
0.4 * 2 = 0.8
0.8 * 2 = 1.6
0.6 * 2 = 1.2
Comment
so , binary number will be 0.0001100110011.
```
___
## Question 2
```
binary number in IEEE 754 standard is 1.1001100110011 * 2-4.
```
___
## Question 3
```
0.2 * 2 = 0.4
0.4 * 2 = 0.8
0.8 * 2 = 1.6
0.6 * 2 = 1.2
Comment
0.2 * 2 = 0.4
0.4 * 2 = 0.8
0.8 * 2 = 1.6
0.6 * 2 = 1.2
0.2 * 2 = 0.4
0.4 * 2 = 0.8
0.8 * 2 = 1.6
0.6 * 2 = 1.2
so , binary number will be 0.001100110011.
binary number in IEEE 754 standard is 1.1001100110011 * 2-3.
By converting this binary number to decimal we get 0.199951171875.
which is not quite the same value which we began from.
```
___
## Question 4
```
The representation is divided in four crucial parts:
Comment
1.sign bit: stores the sign bit in first bit consisting of 1 bit.
2.integer bits: let there 16 bit register storing the integer part.
3.fractional bits: there is a 16 bit register storing the fractional part.
4.overflow part: there is a one bit register storing if there exists a overflow in addition it will store 1.
Firstly, the sign of the number is stored in first block of the data segment.
In second part, the first digit of the number is stored in the data segment block.
eg: 5 = 00000000000000101.
In third part , the rest of the number is stored in the data segment block.
eg: 0.391 = 0110010000011000.
Here addition between the corresponding registers such as integer part of first integer with integer part of second part. And the fractional part as well.Then overflow is added to sum is added with overflow.
```
___
## Question 5
```c=
lw x0, 0(intA)
# Load the second floating-point number into a different floating-point register (f1)
lw x1, 0(intB)
# Add the two floating-point numbers
fadd.s x2, x0, x1
# Store the result back into memory
sw x2, 0(result)
```
```
This code assumes that the floating-point numbers are stored as single-precision floating-point values (32 bits each) in IEEE 754 format. The lw instruction loads a word (32 bits) from memory into a register, and the sw instruction stores a word from a register into memory.
```
___