🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Kenneth R. Ballou Sat, 08 Nov 1986 06:55
Bug converting unsigned to double in BSD 4.[23]
#9758
Author: Kenneth R. Ballou
Date: Sat, 08 Nov 1986 06:55
22 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads