8051 floating pt routines

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
I am looking for  assembly language decimal floating pt arithmetic
routines for the 8051 uC. They must aslo compute sqroot and logs.
Willinng to purchase.
E.Stepp
snipped-for-privacy@mozaert.cas.uc.edu

Re: 8051 floating pt routines
I am looking for 8051 assembly language decimal floating point
arithmetic routines. I need to compute sqroot and logs also.
Willing to purchase.
E. Stepp
snipped-for-privacy@mozart.cas.uc.edu

Re: 8051 floating pt routines
I am looking for 8051 assembly language decimal floating ptarithmetic
routines. Need to compute sqroot and log as well.
Willing to purchase.
E. Stepp
snipped-for-privacy@cinci.rr.com

Re: 8051 floating pt routines
I am trying to location 8051 assembly langauge decimal floating pt
arithmetic routines. Need to compute sqroot and logs as well.Willing
to purchase.
snipped-for-privacy@mozart.cas.uc.edu

Re: 8051 floating pt routines

| I am trying to location 8051 assembly langauge decimal floating pt
| arithmetic routines. Need to compute sqroot and logs as well.Willing
| to purchase.
| snipped-for-privacy@mozart.cas.uc.edu

You could try math51.zip off this website:
http://margo.student.utwente.nl/el/micros/80xx /

--
MT

To reply directly, take all 5 occurrences of the letter 'y' out of my
address.



Re: 8051 floating pt routines
Quoted text here. Click to load it

US Software had a product called '8051 FPAC', now sold to/by
MicroDigital:

 http://www.smxinfo.com/index.html

Most C compilers come with a floating point library.

Point of warning:  I have spent much time fixing client problems
where the problem was traced to the math package.  I would recommend
getting a very mature and bug-free package if you are going
to design it into a product.

The US Software package has been around for 20+ years and I do
not know of any bugs in it, however, that doesn't mean the
software hasn't been "improved" or isn't crawling with bugs I have
never come accross.

Remember Intel's first Pentium that couldn't divide by 30,472 (or some
such number).  Tread carefully.

--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer:  Electronics; Informatics; Photonics.
We've slightly trimmed the long signature. Click to see the full one.
Re: 8051 floating pt routines

Quoted text here. Click to load it

And many of them suck rather badly. ;)

I've use US Software's floating point libraries for 6811, and
they were an order of magnitude faster than the ones that came
with the C compiler.  IIRC, there were some things that US did
right (NaNs, infities) that the compiler library didn't handle
correctly.

I also know people who used US Sotware's FP libs on 8051 and
were happy with them.

--
Grant Edwards                   grante             Yow!  I'm also against
                                  at               BODY-SURFING!!
We've slightly trimmed the long signature. Click to see the full one.
Re: 8051 floating pt routines

Quoted text here. Click to load it

I use Keil's f.p. libs and they seem ok - but *SLOOOOOOW*


Bob

Re: 8051 floating pt routines
On Wed, 23 Feb 2005 16:51:37 GMT, the renowned Bob Stephens

Quoted text here. Click to load it

'e did axe for decimal. Any of these decimal? Not that it's a problem
typically.


Best regards,
Spehro Pefhany
--
"it's the network..."                          "The Journey is the reward"
snipped-for-privacy@interlog.com             Info for manufacturers: http://www.trexon.com
We've slightly trimmed the long signature. Click to see the full one.
Re: 8051 floating pt routines

Quoted text here. Click to load it

I guess we all silently agree that he didn't really mean what he said,
there.  FP arithmetic on an 8051 is quite certainly slow enough
already, without the extra burden of doing it in decimal.

--
Hans-Bernhard Broeker ( snipped-for-privacy@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.

Re: 8051 floating pt routines
Quoted text here. Click to load it

I certainly assumed the OP didn't really mean decimal, and my
comments were about IEEE binary FP.  If the OP erally wants BCD
FP for the 8051, I've no idea where to look.

--
Grant Edwards                   grante             Yow!  Yow! Did something
                                  at               bad happen or am I in a
We've slightly trimmed the long signature. Click to see the full one.
Re: 8051 floating pt routines

Quoted text here. Click to load it
Same here: a stranger walks up and says "I just murdered your wife."  Well
I would think he is just having a bad med day.  Wouldn't even
cross my mind he was serious.

OK, now as to BCD floating point:

What is the reason for _needing_ decimal?
And why _floating point_ decimal?

To my mind this is maybe a false requirement: there is no need
for BCD floating point on an 8051 and therefore there is no
readily available package.

US Software FPAC/GoFast is what you need.

"You can't always get what you want,
     You can't always get what you want,
         But you just may find,
             If you try sometime,
                  you get what you need."  Jagger

Rule of thumb: "If you can't find it then you don't need it."
Conversely: "Everything you need is right at hand."
Try it out for a day or two ... pretty amazing how well it works.

The US Software package will do ASCII <> float (I think).  I never
used this facility.  

For interface to humans I convert float -> integer -> ASCII BCD
for display.  I scale the floating point value so it is between
-9999, 9999 convert to BCD/ASCII and stick the decimal point
where I need it.  There isn't much physical that needs more than
4 digits to describe it.

The only time I have found myself using BCD math as the native
number base is on PIC projects, using a 16C54.

Cash registers and calculators use (or used) BCD as a native
mode.  Historically these were one-bit machines.  The first
uP (a 4 bit machine - 4004) was to go in an adding machine
and so it had lots of BCD support.

Ergo cognito there must exist humungous libraries of BCD math
functions.  Slow, though, but so are calculator processors.  
There may be an advantage to BCD if _really_ long strings
of numbers have to be dealt with:

  2.3948820409852223123412349347e0047 * 9.3248751304512349817612341254e-004

Then the horrors of decimal -> binary -> decimal conversion might send me
up a tree.

A 64 bit integer is equivalent to having 20 decimal digits, though,
so I am sure the problem has been well solved.

--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer:  Electronics; Informatics; Photonics.
We've slightly trimmed the long signature. Click to see the full one.
Re: 8051 floating pt routines

Quoted text here. Click to load it

The only situation I can think of this might be useful is in some
financial calculations with strange rounding rules, especially in
exchange rate conversions etc.

IIRC, before 2001 in the euro zone, the conversion from one national
currency to an other had to go through the euro, with a euro
representation of _exactly_ 5 decimal digits, which would have
required either some BCD floating point or doing some intermediate
step calculations on long binary integers, in which the actual unit
would have meant a millicent :-). This would have required some
multiplications and divisions of the _long_ integer by some powers of
the ten.  In a BCD floating implementation, these multiplications and
divisions could simply be handled with exponent additions and
subtractions.

So indeed a simple handheld exchange rate calculator might have used
BCD floating point even on a much more simpler processor than the
8051.

Paul


Re: 8051 floating pt routines

Quoted text here. Click to load it

I agree, accounting rules are the only compelling reason for using
BCD.  But the accounting specification could have just as easily
specified 16 binary digits.

Besides, BCD is decimalist.  If only we were born with 16 fingers ...

--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer:  Electronics; Informatics; Photonics.
We've slightly trimmed the long signature. Click to see the full one.
Re: 8051 floating pt routines
Quoted text here. Click to load it

Yup. Financial calcualations are pretty much the only time BCD
is used.  For engineering and scientific stuff, it's binary FP.

--
Grant Edwards                   grante             Yow!  I like the way ONLY
                                  at               their mouths move... They
We've slightly trimmed the long signature. Click to see the full one.
Re: 8051 floating pt routines

Quoted text here. Click to load it

I understand that the IEEE is currently working on extending the
floating point specification to also include decimal floating numbers.
If I understood the proposal correctly, the internal (binary)
representation would have been quite strange.

Paul
 

Re: 8051 floating pt routines
Quoted text here. Click to load it

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.

Re: 8051 floating pt routines

Quoted text here. Click to load it

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

Quoted text here. Click to load it

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 http://754r.ucbtest.org/ and from there, locate the
current working document 754r.pdf
(http://754r.ucbtest.org/drafts/754r.pdf )

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
 

Re: 8051 floating pt routines
Quoted text here. Click to load it

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
We've slightly trimmed the long signature. Click to see the full one.
Re: 8051 floating pt routines

Quoted text here. Click to load it

That takes me back to university.  When BCD calculations were done
with 2-input nand/nor's.  And 'RTL' meant something completely
different. "A micro-what?  And who is 'Intel'?"

Paul wrote:

Quoted text here. Click to load it

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.
We've slightly trimmed the long signature. Click to see the full one.

Site Timeline