Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!mit-eddie!genrad!decvax!mcnc!rti-sel!dg_rtp!throopw From: throopw@dg_rtp.UUCP Newsgroups: comp.lang.c Subject: Re: Bug converting unsigned to double in BSD 4.[23] Message-ID: <709@dg_rtp.UUCP> Date: Sat, 22-Nov-86 15:39:41 EST Article-I.D.: dg_rtp.709 Posted: Sat Nov 22 15:39:41 1986 Date-Received: Sun, 23-Nov-86 08:03:18 EST References: <213@cartan.Berkeley.EDU> <618@hadron.UUCP> <295@hao.UUCP> Lines: 30 > woods@hao.UUCP (Greg Woods) > I've seen something similar, and I think your bug probably has to do with > the same thing. On a VAX, and every machine I've worked on EXCEPT the ISI-68K, > the first 32 bits of a double form a float. The two problems are very likely unrelated, except in a most tenuous sense. The original bug in the ((double)~(unsigned)1) was a either a problem in implementing the conversion from type unsigned to double, or a problem in deciding what type a twiddle of an unsigned type was. The nature of the error (integer max becomes -1) made it very likely that the original problem was an integer format problem, not a floating point format problem. > This is a BUG, and it has bitten us > badly in many big libraries where we have little stubs designed to allow > the calling of FORTRAN routines from C without having to observe FORTRAN > calling conventions, It is not clear that this is a bug under K&R semantics. I think it likely that ANSI would consider this a bug, since they already mandated that taking the address of a character formal would "work right". In essence, it means that the compiler would be obliged to copy the declared-float-but-really-double formal argument into an invisible float local variable when the address of the formal is taken. -- There was a radical defect somewhere, and I must search it out and cure it. --- Mark Twain -- Wayne Throop !mcnc!rti-sel!dg_rtp!throopw