diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /1964/CH15/EX15.6 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '1964/CH15/EX15.6')
-rwxr-xr-x | 1964/CH15/EX15.6/ex15_6.sce | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/1964/CH15/EX15.6/ex15_6.sce b/1964/CH15/EX15.6/ex15_6.sce new file mode 100755 index 000000000..f35878ce1 --- /dev/null +++ b/1964/CH15/EX15.6/ex15_6.sce @@ -0,0 +1,22 @@ +//Chapter-15, Example 15.6, Page 497
+//=============================================================================
+clc
+clear
+//CALCULATIONS
+x1=base2dec(['110','10'],2)//converting binary to decimal
+x2=base2dec(['1111','110'],2)//converting binary to decimal
+y1=(x1(1))/(x1(2));//dividing
+y2=(x2(1))/(x2(2));//dividing
+z1=dec2base(y1,2);//converting decimal to binary
+[f,e]=frexp(y2);//separting exponent and mantissa
+disp(f)//mantissa
+disp(e)//exponent
+f=f*2;
+g=floor(f);//rounding to nearest integer
+disp(g);
+z2=dec2base(e,2);//converting decimal to binary--------->before point part of resultant binary number
+disp(z2)
+g1=dec2base(g,2);//converting decimal to binary--------->after point part of resultant binary number
+disp(g1)
+//NOTE:here floating point decimal cannot be directly converted to binary for second case.Hence computed to binary
+//=================================END OF PROGRAM=======================================================================================================
|