[comp.sys.amiga.programmer] ffp numbers

"luciano bertato" <luciano.bertato@canrem.uucp> (05/20/91)

I want to program a function wh'in assembler' which takes a double
(64-bits) floating point number and convert it to an ascii string.
In the ROM kernal manual it only explains the 32-bit single
precision FFP number format, with bit 1-6 as th exponent,
bit 7 the sign, and bit 8-31 as the mantissa.
Now what is the format for the double precision FFP number which
is used in the 'C' functions??
--
Canada Remote Systems.  Toronto, Ontario
NorthAmeriNet Host

"luciano bertato" <luciano.bertato@canrem.uucp> (05/21/91)

I want to program a function in assembler which takes a double
(64-bits) floating point number and convert it to an ascii string.
In the ROM kernal manual it only explains the 32-bit single
precision FFP number format, with bit 1-6 as the exponent,
bit 7 the sign, and bit 8-31 as the mantissa.
Now what is the format for the double precision FFP number which
is used in the 'C' functions??
--
Canada Remote Systems.  Toronto, Ontario
NorthAmeriNet Host

markv@kuhub.cc.ukans.edu (05/23/91)

In article <1991May20.848.3220@canrem.uucp>, luciano.bertato@canrem.uucp (luciano bertato) writes:
> I want to program a function wh'in assembler' which takes a double
> (64-bits) floating point number and convert it to an ascii string.
> In the ROM kernal manual it only explains the 32-bit single
> precision FFP number format, with bit 1-6 as th exponent,
> bit 7 the sign, and bit 8-31 as the mantissa.
> Now what is the format for the double precision FFP number which
> is used in the 'C' functions??

There are no double precision FFP numbers.  FFP is single precision
only.  In C if you compile with FFP, doubles become floats
essentially.  All 64 bit FFP numbers on the Amiga are IEEE.

> --
> Canada Remote Systems.  Toronto, Ontario
> NorthAmeriNet Host
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mark Gooderum			Only...		\    Good Cheer !!!
Academic Computing Services	       ///	  \___________________________
University of Kansas		     ///  /|         __    _
Bix:	  mgooderum	      \\\  ///  /__| |\/| | | _   /_\  makes it
Bitnet:   MARKV@UKANVAX		\/\/  /    | |  | | |__| /   \ possible...
Internet: markv@kuhub.cc.ukans.edu
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

peic@core.north.de (Peter Eichler) (05/24/91)

In article <1991May21.848.3222@canrem.uucp>, luciano bertato writes:

>I want to program a function in assembler which takes a double
>(64-bits) floating point number and convert it to an ascii string.
>In the ROM kernal manual it only explains the 32-bit single
>precision FFP number format, with bit 1-6 as the exponent,
>bit 7 the sign, and bit 8-31 as the mantissa.
>Now what is the format for the double precision FFP number which
>is used in the 'C' functions??
>--
>Canada Remote Systems.  Toronto, Ontario
>NorthAmeriNet Host

There is no *double* FFP format (double won't be fast anymore). The
alternative is to use either IEEE single or double precision FP
format. Has anyone out there any idea how the format looks like?

The other way would be to use really the C function from assembler,
since most assembler produce same object-code as C compilers.

Cheerio,
Peter



Q:What's the problem of being drunk?  A:Ask a glass of water.     (Hitchhiker)
------------------------------------------------------------------------------
Peter Eichler         VOICE: (+)49 421 530642     SYSTEM  : Amiga 3000,6MB RAM
Hegelstrasse 3        EMAIL: peic@core.north.de   CPU     : 68030/68882, 25MHz
2800 Bremen, Germany  EMAIL: peic@skuld.north.de  HARDDISK: 105MB Quantum,19ms

tom@clipper.ingr.com (Tom Granvold) (05/31/91)

In article <193023b4.ARN00a9@core.north.de> peic@core.north.de (Peter Eichler) writes:
>There is no *double* FFP format (double won't be fast anymore). The
>alternative is to use either IEEE single or double precision FP
>format. Has anyone out there any idea how the format looks like?
>
>Cheerio,
>Peter


    The IEEE format is as follows:

Single Precision (32 bits):

	----------------------
	| S | EXP | MANTISSA |
	----------------------

	Where: S = 1 bit, indicates sign, 0 = +, 1 = -.
	       EXP = 8 bits, exponant
	       MANTISSA = 23 bits, mantissa (fractional part)

	Notes: The mantissa is always assumed to have a leading 1 bit
	       attached in front of the value in its field, unless the
	       exponant is 0 or all 1's.  For example, if the MANTISSA
	       field held in binary 101 0000 0000 0000 0000 0000, then
	       the true value would be 1.101 0000 0000 0000 0000 0000.

	       The value of the exponant is kind of strange.  The get
	       the true value of the exponant subtract 126 decimal,
	       0111 1110 binary, for the value in the EXP field.
	       This allows both positive and negative exponants without
	       another sign bit.  For example if the EXP field holds
	       1000 0000 binary, then the true exponent is (after
	       subtracting 0111 1110 from it) 10 binary or 2 decimal.
	       Note that this represents a BINARY exponant not a decimal
	       exponant.  This is the exponant represents a power of 2
	       not a power of 10.

Double Precision (64 bits):

	----------------------
	| S | EXP | MANTISSA |
	----------------------

	Where: S = 1 bit, indicates sign, 0 = +, 1 = -.
	       EXP = 11 bits, exponant
	       MANTISSA = 52 bits, mantissa (fractional part)

	Notes: The mantissa is always assumed to have a leading 1 bit
	       attached in front of the value in its field, unless the
	       exponant is 0 or all 1's.  See the example for single
	       precision.

	       The value of the exponant is kind of strange.  The get
	       the true value of the exponant subtract 1022 decimal,
	       0011 1111 1110 binary, for the value in the EXP field.
	       This allows both positive and negative exponants without
	       another sign bit.  For example if the EXP field holds
	       0100 0000 0000 binary, then the true exponent is (after
	       subtracting 0011 1111 1110 from it) 10 binary or 2 decimal.
	       Note that this represents a BINARY exponant not a decimal
	       exponant.  This is the exponant represents a power of 2
	       not a power of 10.

Special Values (all show in hexidecimal):

	Value		Single Precision	Double Precision
	-----		----------------	----------------
	+ infinity	7580 0000		7ff0 0000 0000 0000
	- infinity	ff80 0000		fff0 0000 0000 0000
		(Infinities have an exponant of all 1's and mantissa
		 of all 0's.)

	NAN		7fff ffff		7fff ffff ffff ffff
	NAN		ffff ffff		ffff ffff ffff ffff
	NAN		7fbf ffff		7ff7 ffff ffff ffff
		(NAN = Not A Number, i.e. invalid result, the exponant
		 is all 1's, and the mantissa is NOT all 0's.)

	+ 0		0000 0000		0000 0000 0000 0000
	- 0		8000 0000		8000 0000 0000 0000
		(+0 and -0 are equivelent and test as being equal.  In
		 this case there is no implied loading 1 bit in front
		 of the binary point.)

	+ Denormalized	007f ffff		000f ffff ffff ffff
	- Denormalized	807f ffff		800f ffff ffff ffff
		(The true exponant is taken to be 0, and it can have
		 any mantissa except 0.  This represents values very
		 close to 0, with a lose of precission.  In this case
		 there is no implied leading 1 bit in front of the
		 binary point.)

    Note that not all floating point hardware implements all of the IEEE
standard, especially Denormalized numbers.  I don't know what the Motorola
chips do, so check the documentation.

    I hope that this brief description is not too confusing.

------------------------------------------------------
Name:    Tom Granvold
Mail:    2400 Geng Rd., Palo Alto, Calif., 94303
UUCP:    ucbvax!decvax!decwrl!pyramid!garth!tom
  or:    tom@clipper.ingr.com
------------------------------------------------------