Message Edited by J2MEJediMaster on 05-04-2006 03:06 PM
Message Edited by J2MEJediMaster on 05-04-2006 03:16 PM
Hello Tom,
J2MEJediMaster wrote:
The difference between the binary representations of fractional and integer numbers is where that implicit binary point lies. The easiest way to explain this is with the attached diagram, which will be clearer and more concise than the thousand words it would take to explain things. What this means is that you can convert between the two formats by multiplying or dividing by 32767.0 for 16-bit numbers. For conversion to fractional values, the following macro was originally used:
#define CFF(x) (x * 32767.0)
There was a one-bit error in that computation, so now the Frac16 conversion macro is:
#define FRAC16(x) (x < 1 ? ( x >= -1 ? x * 0x7FFF : 0x8000) : 0x7FFF)
My limited understanding of a signed fractional number representation suggests that the effective magnitude of the fraction will always be less than 1, i.e. a maximum represented value of 32767 / 32768 for integer size.
By this reckoning, the multiplier/divider value should be 32768 ($8000), rather than 32767. Therefore, a value of 0.75 would be represented by $6000.
Regards,
Mac
Message Edited by bigmac on 05-06-200605:16 PM
bigmac wrote:My limited understanding of a signed fractional number representation suggests that the effective magnitude of the fraction will always be less than 1, i.e. a maximum represented value of 32767 / 32768 for integer size.
By this reckoning, the multiplier/divider value should be 32768 ($8000), rather than 32767. Therefore, a value of 0.75 would be represented by $6000.
Having used the Motorola DSPs for years, first the DSP56002 and currently the DSP56303, I can verify that what Mac says is correct and cast in silicon.
bigmac wrote:By this reckoning, the multiplier/divider value should be 32768 ($8000), rather than 32767. Therefore, a value of 0.75 would be represented by $6000.