[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [oc] How to convert integer to single precision floating point



The easest way is to copy the 32-bit number into the Mantissa (the number
part) and then set the exponent to 32. The resultant number is not
normalized but this should not present you with a problem. On next
compuation the result will be normalized. If there is a possibility that
this technique would result in a roundoff error (it shouldn't as there is no
real fraction) then processing section (in the C code that may be running
inside or outside your FPGA) do something seemingly benign

    float result = *yourFPresult + 0.;

Requires compiler optimizatons are off.

Jim





----- Original Message -----
From: <l.huang@its.tudelft.nl>
To: <cores@opencores.org>
Sent: Friday, August 15, 2003 9:59 AM
Subject: [oc] How to convert integer to single precision floating point


> Hello everyone,
>
> I'm working on a logic unit design.  I run into a problem. After
> computation, I get a 32-bit binary integer number. Now I need to
> convert it into single precision floating point number. Is there
> anyone familiar with how to do? Please tell me the procedure of logic
> design of this part. Thank you very much for your help, and waiting
> for your response.
>
> Linjia
> --
> To unsubscribe from cores mailing list please visit
http://www.opencores.org/mailinglists.shtml

--
To unsubscribe from cores mailing list please visit http://www.opencores.org/mailinglists.shtml