This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: exotic floating point formats test


On Fri, Mar 09, 2001 at 02:58:15PM -0800, Zack Weinberg wrote:
> On Fri, Mar 09, 2001 at 05:34:54PM -0500, David Edelsohn wrote:
> > >>>>> "Zack Weinberg" writes:
> > 
> > Zack> I'd appreciate knowing what this program prints on a VAX (or an Alpha
> > Zack> asked to use VAX floating point), an IBM mainframe target, and a C4x
> > Zack> processor.  For reference:
> > 
> > 	Linux for S/390 prints:
> > 
> > 3.25098346789696250880e+01      40404142 43444546       @@AB CDEF
> 
> big-endian IEEE - that matches i370/xm-linux.h; good.
> 
> > 	The C compiler on OS/390 USS (aka z/OS) prints:
> > 
> > 3.25098346789696300000e+01      42208284 86888a8c       ..bd fh..
> 
> Aha, this is what GCC means by IBM_FLOAT_FORMAT.  Interesting how the
> latter six bytes have all been multiplied by two (rounding?) - and
> then the EBCDIC conversion changes the letter values around; 0x82
> isn't ascii anything...

IIRC, IBM floating point's exponent is expressed in terms of hexidecimal digits
and not in terms of binary digits, which IEEE & VAX use (ie, FLT_RADIX is 16,
not 2).  There is also no hidden bit (and no NaNs or Infinities).  The use of
hexidecimal digits means on average you loose 2-3 bits of precision.  Also,
unlike the IEEE format, the float format is exactly the same as the double
format, with the additional 32 bits being all mantissa.

> If you have time and patience, could you see if you can come up with a
> floating-point literal that translates to eight printable characters?
> (*not* @@ABCDEF) This is eventually going to wind up as autoconf doing
> greps on an object file, and I'd really rather not deal with
> unprintable bytes in the middle of the pattern.  Finding one is not
> hard if you have a compiler that supports C99 hexadecimal float
> literals (I need it in decimal at the end, though).

Note that there still is a translation from the C99 hexadecimal float literals
into IBM floating point.

-- 
Michael Meissner, Red Hat, Inc.  (GCC group)
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work:	  meissner@redhat.com		phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org	fax:   +1 978-692-4482


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]