Re: Fixed-point Math help

From: CBFalconer (cbfalconer_at_yahoo.com)
Date: 12/15/04


Date: Wed, 15 Dec 2004 15:51:38 GMT

Jonathan Kirwan wrote:
>
... snip ...
>
> I don't have a convenient web site in mind, but Tim Wescott's
> suggestion of using google is probably a good one. Use "floating
> point" and "normalization" and "denormalization" and "exponent"
> and "mantissa" and "hidden bit" and perhaps the four common
> operations to help track something down. This is more your 'do
> diligence,' until you've done this yourself and can explain why
> it's not getting you there.
>
> The basic idea is that you have an exponent (signed,
> twos-complement) and an unsigned mantissa (with a possible
> hidden bit for non-zero values) and a separate sign bit. These
> can be packed in any format you like or is convenient to you.
> Each of these is an integer. There is no explicit radix (decimal)
> point, but it is usually assumed for the mantissa at any convenient
> place and the exponent then adjusts this, left or right, for - or +
> values of the exponent. The mantissa is usually stored 'normalized'
> which means that it is shifted until the leading bit is always a '1'
> (which is always possible unless the value is actually zero, but
> that is easily detected.) Some formats simply throw away the
> leading bit, because it is always '1', and put it back when needed
> in order to add one apparent bit of precision.
>
> The rest is just software. Try a paper exercise and see where it
> takes you. That's a good start, if you plan to try and implement
> something yourself. Another choice would be to examine library
> code -- again, search google.

You can find a complete example in the Dr. Dobbs Journal archives.
I published a complete system for the 8080 there about 25 years
ago. It's purpose was to supply dynamic range, and used a 16 bit
significand with an 8 bit exponent. The result was much faster
than anything else available at the time, because it could all be
done in registers, and in addition was re-entrant. The system
included i/o procedures, transcendentals, etc. and had
over/underflow detection. The system underwent minor revisions and
continuous use in the ten years or so since publication, and
processed the majority of tests in a 1000 bed hospital for much
longer. I.E. it was reliable and accurate.

-- 
Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net)
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!


Relevant Pages

  • Re: Use of explicit J-bit in extended double precision format?
    ... IEEE extended double format is specified as ... having at least 15 bits of exponent and 64 apparent bits of mantissa ... Several implementations exist. ... mantissa with an explicit 1 bit). ...
    (comp.lang.asm.x86)
  • Re: floating point calculations.
    ... algorithms, especially on smaller micros. ... In small systems it can be more practical to use some other format ... For really small systems a 3 byte format with 8 bit exponent and 16 ... bit mantissa is often enough and easy to implement. ...
    (comp.arch.embedded)
  • Re: floating point calculations.
    ... In small systems it can be more practical to use some other format ... was the 6 byte Turbo-Pascal real data type format with 8 bit exponent ... For really small systems a 3 byte format with 8 bit exponent and 16 ... bit mantissa is often enough and easy to implement. ...
    (comp.arch.embedded)
  • Re: canonical conversion of float/double to strings
    ... field in IEEE 745 "binary64" format contains; thus, the exponent should ... with leading zeros in the mantissa. ...
    (comp.lang.java.programmer)
  • Re: Fixed-point Math help
    ... If you're doing floating point on a fixed point DSP, for dynamic range ... why would you bother with an unsigned mantissa or implied ... One can go a long way with a simple two-word format: ...
    (comp.arch.embedded)