Path: utzoo!attcan!uunet!kddlab!titcca!sragwa!wsgw!socslgw!diamond From: diamond@csl.sony.JUNET (Norman Diamond) Newsgroups: comp.lang.c Subject: Re: Yet another pcc botch Message-ID: <10013@diamond.csl.sony.JUNET> Date: 26 Jan 89 05:46:52 GMT References: <3310@cbnews.ATT.COM> <398@lakart.UUCP> Organization: Sony Computer Science Laboratory Inc., Tokyo, Japan Lines: 30 In article <398@lakart.UUCP>, dg@lakart.UUCP (David Goodenough) writes: > > lvc@cbnews.ATT.COM (Lawrence V. Cipriani) sez: > ] f = -150.000000, g = 65386.000000 > ] The correct value for g is -150.000000. > > No. The correct value for g is 65386.0 [1]. If you read the gospel > according to Kernighan and Ritchie [2], > > [2] :-) Is this first-edition :-) or second-edition :-) ? The subtraction operator was applied to a short and an unsigned short, and the result (either unsigned short or signed int) converted to float. Under the old unsigned-preserving rules, both f and g should have been 65366.0. Under the ANSI value-preserving rules, both f and g should be -150.0. Mr. Cipriani assumed that System V Releases 2 and 3 should support modern semantics. The gurus that he asked, and Mr. Goodenough, perhaps in the interests of backwards compatibility, feel that they should support Version 7 semantics. The System V Release 2 version, in the interests of pleasing everybody, took the middle road. Conclusion: that wasn't a bug, that was a feature. -- Norman Diamond, Sony Computer Science Lab (diamond%csl.sony.jp@relay.cs.net) The above opinions are my own. | Why are programmers criticized for If they're also your opinions, | re-inventing the wheel, when car you're infringing my copyright. | manufacturers are praised for it?