Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.
|
|
|
Re: data convertion
Posted:
Apr 7, 2011 5:31 PM
|
|
hi sir,
for calculating the exponent i have a formula like this here x= 3.3 %user can enter the value like this ymax = 1023 N =int(log2(x/ymax)) = -8 there is a another way to get the N value also like this Ymax/X = 1023/3.3 =310 max(2^-N) <310 ==> 256 % 2^-N value is always less then the result so N=-8 = 11000
and finding the 11-bit mantissa i am calculating like this ==> X*2^-N = 3.3*256 =844.8 =845 == 01101001101 =Y
finally i am adding this two binary like ==> 11000 01101001101 if i convert this binary value into hex it will give like 'C34D'
i tried with formula to finding the N value its giving the error like ??? Undefined function or method 'int' for input arguments of type 'double'.
how can i solve this problem..
thank you,
|
|
|
|