BUG - unsigned long cast to double
Chris Torek
chris at mimsy.UUCP
Sun Aug 14 01:13:25 AEST 1988
In article <1239500001 at osiris.cso.uiuc.edu> olson at 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 at mimsy.umd.edu Path: uunet!mimsy!chris
More information about the Comp.lang.c
mailing list