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

Re: 8051 floating pt routines

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.

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

On Wed, 23 Feb 2005 20:34:53 GMT, the renowned "Nicholas O. Lindan"

A couple of possibilities-- the need to both do floating point and to

represent decimal fractions exactly. Or wanting to avoid the overhead

of conversion to/from decimal for display and/or communications.

Or, more likely, he doesn't know exactly what he wants. The request

for log and sqrt may imply that.

It's not really any more difficult to write a math package to handle

BCD than for binary on something like an 8051, but of course the

expensive math operations such as divide and multiply tend to run

slower (or require tables etc.).

Best regards,

Spehro Pefhany

A couple of possibilities-- the need to both do floating point and to

represent decimal fractions exactly. Or wanting to avoid the overhead

of conversion to/from decimal for display and/or communications.

Or, more likely, he doesn't know exactly what he wants. The request

for log and sqrt may imply that.

It's not really any more difficult to write a math package to handle

BCD than for binary on something like an 8051, but of course the

expensive math operations such as divide and multiply tend to run

slower (or require tables etc.).

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

"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

... snip ...

Exactly. When I built my package for the 8080/z80 many moons ago I

used a three byte format, with 8 bits for exponent, and 16 for

significand with the implied leading 1 bit replaced by the sign.

This give 4.7 decimal digits of accuracy, and all the arithmetic

could be done in the registers. With care for proper rounding it

outperformed the available four byte packages in both speed (by a

factor of 5 to 10) and accuracy (over any extended calculations,

such as a three by three matrix reduction). The system included

i/o translation and formatting, and transcendental functions (trig,

log, exp).

The accuracy was always more than enough for the physical things it

was measuring and displaying.

For i/o I scaled to an integer in 6554..65535 and a power of ten,

with a separate sign. Again 3 bytes, because the power of ten byte

had room for a sign bit. The i/o worked with the resultant binary

significands, and BCD never entered the picture.

A slightly less polished version was published in DDJ. It got

faster and more compact later. IIRC it fitted into a single 2k

eprom. Doesn't meet the C standard requirements though.

--

"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

"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

On Thu, 24 Feb 2005 03:09:43 GMT, the renowned CBFalconer

I can't let this go without mentioning that just because 4 digits

might be enough to describe something physical does NOT mean that you

can get away with only 4 or 5 digits internally. I've run into a

couple of situations over that years that made me glad I was paying

rapt attention in university Numerical Methods class. ;-) Sometimes

you can improve the algorithms to make them less sensitive, but it's

not always possible, convenient or cost-effective.

Best regards,

Spehro Pefhany

I can't let this go without mentioning that just because 4 digits

might be enough to describe something physical does NOT mean that you

can get away with only 4 or 5 digits internally. I've run into a

couple of situations over that years that made me glad I was paying

rapt attention in university Numerical Methods class. ;-) Sometimes

you can improve the algorithms to make them less sensitive, but it's

not always possible, convenient or cost-effective.

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

"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

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

"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

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.

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

- » Reverse current into a lithium battery
- — Next thread in » Embedded Programming

- » Video Game Board
- — Previous thread in » Embedded Programming

- » Embedded Ethernet
- — Newest thread in » Embedded Programming

- » geen arduinogroepen op usenet?
- — The site's Newest Thread. Posted in » Electronics (Dutch)