home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:13706 sci.math:11516 comp.lang.misc:3091 comp.lang.fortran:3577 comp.std.c:2633
- Path: sparky!uunet!elroy.jpl.nasa.gov!sdd.hp.com!network.ucsd.edu!mvb.saic.com!unogate!beckman.com!dn66!a_rubin
- Newsgroups: comp.lang.c,sci.math,comp.lang.misc,comp.lang.fortran,comp.std.c
- Subject: Re: Scientists as Programmers (was Re: Small Language Wanted)
- Message-ID: <a_rubin.716593540@dn66>
- From: a_rubin@dsg4.dse.beckman.com (Arthur Rubin)
- Date: 15 Sep 92 21:45:40 GMT
- Followup-To: comp.std.c
- References: <92Sep1.205116edt.669@neuron.ai.toronto.edu>
- <1992Sep4.162938.29237@dscomsf.desy.de> <Bu2r42.5xr@mentor.cc.purdue.edu>
- <id.I12T.GP4@ferranti.com> <a_rubin.716152347@dn66>
- <1992Sep11.012559.17662@nntpd.lkg.dec.com> <a_rubin.716225408@dn66
- <1992Sep12.164915.10734@jarvis.csri.toronto.edu> <1992Sep15.043224.27920@nntpd.lkg.dec.com>
- Nntp-Posting-Host: dn66.dse.beckman.com
- Lines: 33
-
- In <1992Sep15.043224.27920@nntpd.lkg.dec.com> diamond@jit345.bad.jit.dec.com (Norman Diamond) writes:
-
- >In article <1992Sep12.164915.10734@jarvis.csri.toronto.edu> flaps@dgp.toronto.edu (Alan J Rosenthal) writes:
- >>a_rubin@dsg4.dse.beckman.com (Arthur Rubin) writes:
- >>>>>> int a, b; long c;
- >>>My interpretation (from reading K&R 2) would be that c = a * b should be
- >>>equivalent to c = (int)(a * b).
-
- >Mr. Rubin, please state which section of the standard requires this.
- >If you cannot, then please at least quote the text in K&R 2 that led you to
- >this interpretation, so that we can see if K&R 2 has a bug that would be
- >worth recommending for correction and/or warning about.
-
- My copy of K&R 2 has walked away. K&R 1, in the section on type
- conversions (2.7), states:
-
- Implicit arithmetic conversions work much as expected. In general, if
- an operator like + or * which takes two operands (a "binary operator")
- has operands of different types, the "lower" type is _promoted_ to the
- "higher" type before the operations proceeds. The result is of the
- higher type....
-
- I don't recall exactly what the analogous section of K&R 2 states, but I
- recall that last sentence being there. This implies that the result in
- case of overflow, although undefined, is an undefined int.
-
- Followups to comp.std.c, as it no longer is relevant to any of the other
- groups.
- --
- Arthur L. Rubin: a_rubin@dsg4.dse.beckman.com (work) Beckman Instruments/Brea
- 216-5888@mcimail.com 70707.453@compuserve.com arthur@pnet01.cts.com (personal)
- My opinions are my own, and do not represent those of my employer.
- My interaction with our news system is unstable; please mail anything important.
-