[net.lang.c] More Naughty Bits

Cottrell@BRL.ARPA, James (08/09/85)

/*
me		->> What other kind of zero is there?
Doug Gwyn	->  How about 0.0?

How about it? Any pattern of all zeros is considered zero by any
*sane* floating point unit. You are perfectly welcome to use insane
FPU's, but then you'd have to write an insane C compiler, wouldn't you?
What's that you say? They're *all* insane? Got to keep the loonies on the path!

	jim		cottrell@nbs

*/
------

meissner@rtp47.UUCP (Michael Meissner) (08/10/85)

In article <575@brl-tgr.ARPA> Cottrell@BRL.ARPA, James writes:
>/*
>me		->> What other kind of zero is there?
>Doug Gwyn	->  How about 0.0?
>
>How about it? Any pattern of all zeros is considered zero by any
>*sane* floating point unit. You are perfectly welcome to use insane
>FPU's, but then you'd have to write an insane C compiler, wouldn't you?
>What's that you say? They're *all* insane? Got to keep the loonies on the path!

While I agree with the comment about *sane* floating point, a similar topic was
raised in the the ANSI C meetings when discussing the implied initialization
of static/extern variables to 0.  To my surprise, there is at least one machine
out there where 0.0 does not have all bits set to zero!  Also, there was some
discussion that a NULL pointer might not have all bits zero either, just as
long as a zero integer can be converted to the bit pattern used, and vica versa.
The reason given was for ring/segment machines, you might want to put in
the current segment, or an unused segment.

BTW, I believe the machine with the unusual floating point might have been a
univac 1100, but I could be mistaken.

	Michael Meissner
	Data General
	...{ ihnp4, allegra, decvax }!mcnc!rti-sel!rtp47!meissner

jgd@uwmcsd1.UUCP (John G Dobnick) (08/12/85)

[Just who was that masked line eater, anyway?]

> 
> BTW, I believe the machine with the unusual floating point might have been a
> univac 1100, but I could be mistaken.
> 
> 	Michael Meissner
> 	Data General

Speaking of the Sperry 1100 (Univac ceased to exist when Sperry Corp., in their
infinite wisdom, decided to make a name change at the start of their fiscal
year (April 1 -- yup! You heard me right!)) floating point formats...

It *is* possible to have a floating point zero on the Sperry 1100 that is
*not* all zero bits (or all *one* bits -- this is a one's-complement machine
and thus has *two* zeros).  However, such a F.P. zero is *un*-normalized,
and is likely to cause undefined results when used in computations.  A
*normalized* F.P. zero is defined as a floating point number with *all*
bits the same as the sign bit; this is what one normally sees and uses.

Aside:  Un-normalized F.P. operands *do* produce defined results when used
	with the ADD and ADD-NEGATIVE (also known as SUBTRACT in certain
	circles) operations.  You may get less precision in the results
	if you do this.  I have seen one case where this was, in fact,
	done deliberately to produce a *scaled* result.  Needless to say,
	such *trickery* is highly machine dependent.
-- 

--
John G Dobnick
Computing Services Division @ University of Wisconsin - Milwaukee
(...ihnp4!uwmcsd1!jgd)

atbowler@watmath.UUCP (Alan T. Bowler [SDG]) (08/17/85)

On the Honeywell large machines (including Multics).
A proper floating point zero (i.e. one that is normalized)
is NOT all zero bits.  A word of all zero bits is taken
as zero by the floating hardware, but it is not properly
normalized, and may cause problems in some calculations.

jjg@security.UUCP (Jeff Glass) (08/18/85)

> (discussion about machines where 0.0 does not have same representation as 0)

The CDC Cyber series represents floating-point zero with the (12-bit)
exponent zero.  It doesn't matter whether the (48-bit) mantissa is zero
or not.  If you normalize such a number, though, I believe you get back
a mantissa of zero.

Integer zero is 60 bits of all zeros or all ones (1's-complement machine).

/jeff
-- 
  security!jjg@mitre-bedford.ARPA				(MIL)
 {allegra,ihnp4,utzoo,philabs,uw-beaver}!linus!security!jjg	(UUCP)

dik@zuring.UUCP (08/22/85)

In article <944@security.UUCP> jjg@security.UUCP (Jeff Glass) writes:
>> (discussion about machines where 0.0 does not have same representation as 0)
>
>The CDC Cyber series represents floating-point zero with the (12-bit)
>exponent zero.  It doesn't matter whether the (48-bit) mantissa is zero
>or not.

Not quite, for floating-point multiplication: yes; for floating-point
addition: no.  (There are numbers such that 2.0*x = 0.0, but x+x /= 0.0)
-- 
dik t. winter, cwi, amsterdam, nederland
UUCP: {seismo|decvax|philabs}!mcvax!dik