Article View: net.lang.c
Article #9758Bug converting unsigned to double in BSD 4.[23]
From: Kenneth R. Ballou
Date: Sat, 08 Nov 1986 06:55
Date: Sat, 08 Nov 1986 06:55
22 lines
1131 bytes
1131 bytes
I recently had occasion to perform this experiment:
% cat bug.c
main ()
{
printf ("%u\n", ~ ((unsigned) 0));
printf ("%lf\n", (double) (~ ((unsigned) 0)));
printf ("%lf\n", 4294967295.0); /* surely double is large enough for this? */
}
% bug
4294967295
-1.000000
4294967295.000000
The results were the same on BSD 4.2 and BSD 4.3. Of course, the question
is, did I miss something? (I don't believe so.)
--------
Kenneth R. Ballou ...!ucbvax!cartan!brahms!ballou
Dept. of Mathematics
University of California
Berkeley, California 94720
Technical Details
Message-ID:
<213@cartan.Berkeley.EDU>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!nike!ucbcad!ucbvax!cartan!brahms!ballouShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!nike!ucbcad!ucbvax!cartan!brahms!ballou From: ballou@brahms (Kenneth R. Ballou) Newsgroups: net.lang.c Subject: Bug converting unsigned to double in BSD 4.[23] Message-ID: <213@cartan.Berkeley.EDU> Date: Sat, 8-Nov-86 01:55:37 EST Article-I.D.: cartan.213 Posted: Sat Nov 8 01:55:37 1986 Date-Received: Sun, 9-Nov-86 03:13:06 EST Sender: daemon@cartan.Berkeley.EDU Reply-To: ballou@brahms (Kenneth R. Ballou) Organization: Math Dept. UC Berkeley Lines: 22