8051 floating pt routines

Once you have decided on decimal you might as well pick a better encoding. Excess 3 [1] has many advantages. One is that the 9's complement is the bit complement, another is symmettry. The correction after a binary add/subtract is simpler. By making the fundamental adder a subtractor you can avoid the appearance of negative zero, just as in binary operation.

The sign is detected from a single bit in 9's or 10's complement arithmetic. 9's has the advantage of allowing direct display, and the disadvantage of needing end-around carries.

The only thing that favors the use of BCD is the existence of such instructions as DAA (in X86) for conversion.

[1] Excess 3 coding uses the binary values 0011 thru 1100 to express 0 thru 9. For addition the excess 3's add, so correction is subtract 3. For subtraction, the excess 3's cancel, so correction is add 3. The binary carry is the decimal carry.
--
"If you want to post a followup via groups.google.com, don't use
 the broken "Reply" link at the bottom of the article.  Click on 
 "show options" at the top of the article, then click on the 
 "Reply" at the bottom of the article headers." - Keith Thompson
Reply to
CBFalconer
Loading thread data ...

Of course. But that applies no matter what the precision level actually is. Knuth has a good treatment IIRC.

--
"If you want to post a followup via groups.google.com, don't use
 the broken "Reply" link at the bottom of the article.  Click on 
 "show options" at the top of the article, then click on the 
 "Reply" at the bottom of the article headers." - Keith Thompson
Reply to
CBFalconer

Absitvely. It is pretty easy to get into trouble with 32-bit IEEE short reals and 64 & 80 bit precision is needed. Though with some massaging of the algorithm it is often possible to reduce the precision requirements.

'4-digits is good enough' applies only when talking to humans.

--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer:  Electronics; Informatics; Photonics.
To reply, remove spaces: n o lindan at ix  . netcom . com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/
Reply to
Nicholas O. Lindan

"CBFalconer" wrote

That takes me back to university. When BCD calculati> I understand that the IEEE is currently working on extending the

Any trick that can be used with BCDs WRT to processing one digit at a time are equally applicable to processing one 16-bit digit (nibble) at a time, only more so.

But I would be interested in seeing what my membership fees are up to ...

--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer:  Electronics; Informatics; Photonics.
To reply, remove spaces: n o lindan at ix  . netcom . com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/
Reply to
Nicholas O. Lindan

TV network in Europe?

--
Grant Edwards                   grante             Yow!  Now my EMOTIONAL
                                  at               RESOURCES are heavily
                               visi.com            committed to 23
Reply to
Grant Edwards

Oh, I feel so much younger.

RTL is now 'Register - Transistor Level/Logic', as in silicon compilers - Verilog & Co.: part functional block, part device. Most used in boastful claims: VaporWare III compiles

10,000,000 RTL gates/minute; adding a function block (register) takes about the same compute power as adding a transistor (low level gate).
--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer:  Electronics; Informatics; Photonics.
To reply, remove spaces: n o lindan at ix  . netcom . com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/
Reply to
Nicholas O. Lindan

They did that many years ago. It was IEEE 854 radix-independent floating point. The current effort is to merge it into the next version of IEEE 754.

Reply to
Eric Smith

The IEEE-854 was a more or less abstract definition.

The current IEEE-754R is trying to make a concrete definition of the radix-10 of the abstract IEEE-854 document.

Take a look at

formatting link
and from there, locate the current working document 754r.pdf
formatting link

The decimal resolution is a huge mess with part of the most significant decimal digit intermixed with some exponent bits into the combination (G) field and the significand represented with a series of

10 bit densely packed decimal "declets" storing three decimal digits.

Implementing all this with an 8 or 16 bit processor with reasonable performance is quit a challenge.

Paul

Reply to
Paul Keinanen

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.