From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 1964/CH15/EX15.6/ex15_6.sce | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 1964/CH15/EX15.6/ex15_6.sce (limited to '1964/CH15/EX15.6') 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======================================================================================================= -- cgit