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: "Jim Dempsey" <tapedisk@a...>
    Date: Fri, 15 Aug 2003 17:21:14 -0500
    Subject: Re: [oc] How to convert integer to single precision floating point
    Top

    Thanks for clearing that up. The reason I mentioned this technique is I used
    this technique 25 years ago in FORTRAN II for a fast conversion from integer
    to floating point. This worked because in it's format the msb was present.
    
    However note now the same technique can be used by changing the constent of
    the dummy add.
    
        float    fixup = 2.^32;
        ...
        float result = *yourFPresult - fixup;
        ...
    
    However, in reading (but not fully understanding)
    http://http.cs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF
    
    
    I found http://www.cs.umass.edu/~weems/CmpSci535/535lecture6.shtml
    interesting as well.
    
    The original question left too many particulars out to answer properly.
    
    Jim
    
    ----- Original Message -----
    From: "Rudolf Usselmann" <rudi@a...>
    To: <cores@o...>
    Sent: Friday, August 15, 2003 2:00 PM
    Subject: Re: [oc] How to convert integer to single precision floating point
    
    
    > 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
    Re: [oc] How to convert integer to single precision floating pointRudolf Usselmann

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