LOGIN   :::   RECOVER PASS   :::   GET ACCOUNT    
Browse
  • Projects
  • Code (CVS)
  • Forums
  • News
  • Articles
  • Polls
  •  
    OpenCores
  • FAQ
  • CVS HowTo
  • Mission
  • Media
  • Tools
  • Advertise
  • Mirrors
  • Logos
  • Contact us
  • Job Opportunity
  •  
    Tools
  • Search
      
  • Download Cores (CVSGet)
  •  
    More
  • Wishbone
  • Perlilog
  • EDA tools
  • OpenTech CD
  •  
    Navigation: All forums > Cores > Message List > Message Post

    Message

    Reply | Reply all
    Date Prev | Date Next | Thread Prev | Thread Next Date Index | Thread Index

    From: Rudolf Usselmann <rudi@a...>
    Date: 16 Aug 2003 02:00:44 +0700
    Subject: Re: [oc] How to convert integer to single precision floating point
    Top

    On Sat, 2003-08-16 at 00:14, Jim Dempsey wrote:
    > 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
    
    Actually this will not quite work. If the exponent is
    non zero, the mantissa is expected to have a hidden bit.
    
    So you really have to shift the integer left until the
    first '1' falls out, and than adjust the exponent
    appropriately.
    
    Further, to be IEEE754 compliant, you will have to
    do rounding, as you can end up with more bits in the
    mantissa than you can represent in a 32 bit float.
    
    Regards,
    rudi               
    --------------------------------------------------------
    www.asics.ws  --- Solutions for your ASIC/FPGA needs ---
    ----------------- FPGAs * Full Custom ICs * IP Cores ---
    FREE IP Cores --> http://www.asics.ws/ <-- FREE IP Cores
    
    
    
    

    ReferenceAuthor
    [oc] How to convert integer to single precision floating pointL huang
    Re: [oc] How to convert integer to single precision floating pointJim Dempsey

    Follow upAuthor
    Re: [oc] How to convert integer to single precision floating pointJim Dempsey

     
    Copyright (c) 1999 OPENCORES.ORG. All rights reserved.