fixed fract from float data (separation) on SHARC

Status
Not open for further replies.

kirgizz

Member level 2
Joined
Sep 7, 2004
Messages
52
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
644
Hello,

I've got a problem with data format conversion on ADSP 21262 which can process both formats, fixed and floating point data. I give you an example for it:

The floating point number is: 200.15 (f15=200.25).
The DSP represents it as (1).564453125*2^^7 (S=0, E=134, M=.564453125) in floating point format.
I can get the integer part by r12=fix f15.

Here is the most exciting thing: how can I get the real fractional part (=.25) of the number?
Doing
r4= mant f15; //manissa from f15
r5= lshift r4 by 1; //removing hidden bit

results in r5=0.564453125 (as unsigned fractional)

Do anyone have an idea?

Thank you in advance
 

200.25 = 1.5.. times 2^(something)
unless you use 2^something to multiply == shifting by all available exponents we will not get the proper result. you are just taking the fractional part of the normalized number. YOU ARE EXPECTED TO GET A WRONG RESULT.

B R Madhukar
 

thank you, brmadhukar.

Excuse me, my question was not correct. It means how can I get the decimal fraction (.25) from normalized floating? The hidden "1." causes trouble to me.

So I need a fast algorithm to separate the decimal fraction from a floating point data.
Anyway, the compiler can do this (from decimal in normalized float).
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…