Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ncar!oddjob!mimsy!chris
From: chris@mimsy.UUCP (Chris Torek)
Newsgroups: comp.lang.c
Subject: Re: BUG - unsigned long cast to double
Summary: Old PCC bug; fixed in 4.3BSD, e.g.
Message-ID: <12987@mimsy.UUCP>
Date: 13 Aug 88 15:13:25 GMT
References: <1239500001@osiris.cso.uiuc.edu>
Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
Lines: 19

In article <1239500001@osiris.cso.uiuc.edu> olson@osiris.cso.uiuc.edu writes:
>... found this problem on Pyramid and Masscomp machines, and not on Sun
>machines.

The same bug *does* exist in 4.1BSD, and *not* in 4.3BSD (and I am not
sure about 4.2BSD).

>... casting unsigned long to double ... treat the cast as SIGNED long
>to double.

Actually, any conversion of u_long to double, regardless of context.

>	printf ("y: %d -> %lf   z: %u -> %lf\n", y, (double) y, z, (double) z);

%lf makes no sense here.  In K&R C, %f prints a double, since there are
no float rvalues.  In dpANS C, %lf prints a long double.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris