[comp.arch] conversion algorithm, floating pt formats

padama@batcomputer.tn.cornell.edu (padama) (03/03/88)

I'm posting the following for a friend who does not have access to the net:

Does anyone know of an algorithm for converting IEEE format floating point
numbers to bcd floating point? Is there a commercially available  program in 'C' or 68881 assembler to do this? Please respond to the net or to my mail id 
You could also email to kri@cornella.ccs.cornell.edu.
 Thanks, Padma Krishnaswamy

geof@imagen.UUCP (Geoffrey Cooper) (03/04/88)

In article <3910@batcomputer.tn.cornell.edu>, padama@batcomputer.tn.cornell.edu (padama) writes:
> Does anyone know of an algorithm for converting IEEE format floating point
> numbers to bcd floating point?

You're in luck.  BCD and IEEE are two formats supported by the 68881
hardware.  The machine co-instructions of the 68881-68020 combination
include commands to fetch a number from either format into a register
and write it back in either format.  So you can accomplish what you want
in two 68881 FMOVE.x instructions.  See the manual for details.

- Geof
-- 
{decwrl,sun,saber}!imagen!geof

stever@videovax.Tek.COM (Steven E. Rice, P.E.) (03/05/88)

In article <3910@batcomputer.tn.cornell.edu>, Padma Krishnaswamy
(padama@batcomputer.tn.cornell.edu) writes:

> I'm posting the following for a friend who does not have access to the net:
> 
> Does anyone know of an algorithm for converting IEEE format floating point
> numbers to bcd floating point? Is there a commercially available program
> in 'C' or 68881 assembler to do this? Please respond to the net or to my
> mail id.

The 68881 fmove instruction will do this.  Storing a value as a BCD
result will convert it to a packed decimal string (2 digits per byte)
with an exponent, as appropriate.  The 68020 has an unpack instruction
which allows unpacking the result as one digit per byte, with an
appropriate value (hex '3' is useful) in the upper 4 bits of each byte.

					Steve Rice

-----------------------------------------------------------------------------
* Every knee shall bow, and every tongue confess that Jesus Christ is Lord! *
new: stever@videovax.tv.Tek.com
old: {decvax | hplabs | ihnp4 | uw-beaver}!tektronix!videovax!stever