blob: ba7a5a7a15f34c7d4893f8ddfb72c8b1c2a54d18 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
//example 1.11//
clc
//clears the screen//
clear
//clears all existing variables//
a=-142;
//given number//
b=a*-1;
c=dec2bin(b);
//converting it to binary number//
c1=10001110;
d=c1/(10000000);
m=(d-1)*(10^23);
//mantissa//
e=dec2bin(7,8)
//exponent//
f=bin2dec('01111111')
g=7+f;
be=dec2bin(g)
//biased exponent//
be2=10000110
be1=be2*(10^23);
s=1*(10^31);
n=s+be1+m;
//result//
disp('Thus -142 = ')
disp(n);
|