krishvamsi
Junior Member level 2
could anyone explain me the 32 bit representation of a decimal number (ex-36.5) in logarithmic number system ?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
. Hello thanks a lot for the reply sir . I'm clear with fixed point and floating point representations . I searched a lot regarding logarithmic number system but didn't get any detailed explanation with an example . In the question I meant represening a decimal number +36.5 in a 32 bit logarithmic number system of base 2 . Could you please provide a detailed solution to this ?I think you will need to make your question a bit clearer if you want a proper answer.
There can be any number of ways to represent a number using 32 bits. I *think* you want to understand one of the IEEE encoding systems (which are very widely used can be supported in hardware on some devices) in which case I suggest that you do a search of the Internet as there are many references that explain this.
An alternative is to use a fixed-point representation which effectively assumes there is a 'binary point' somewhere between two of the bits - in effect this is a scaled value that gives you fractional values.
On the subject of logarithmic number systems, you need to be more specific. What number base are you thinking about: 10, 2 e???
I suspect you may mean values that are expressed as a mantissa and a number base exponent - if that is the case then look back at the IEEE systems mentioned above.
Susan
sir how you got 5.18982 ? And also could you give the logarithmic number representation as a triplet {z,s,x} where z is a flag bit which is asserted when the original number is 0 since logarithm of 0 is undefined . S represents sign and x = log b(X) b is the base , X is the original number .36.5 = 2^5.18982
Save the 5.18982 in whatever way you want.
Susan
Answer to the math question:
2^x = 36.5
=>
ln(2^x) = ln(36.5)
=>
x * ln(2) = ln(36.5)
=>
x = ln(36.5) / ln(2) = 5.18982...
The calculation will also work with the 10-based logarithm:
x = log(36.5) / log(2) = 5.18982...
The 'z' bit is easy - if(x==0) z = 1 else z = 0 - use whatever equivalent code is in your favourite language.And also could you give the logarithmic number representation as a triplet {z,s,x} where z is a flag bit which is asserted when the original number is 0 since logarithm of 0 is undefined . S represents sign and x = log b(X) b is the base , X is the original number .