Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!indri!lll-winken!uunet!mcrware!davely From: davely@mcrware.UUCP (Dave Lyons) Newsgroups: comp.sys.mac.programmer Subject: Re: LSC arithmetic problem Message-ID: <1168@mcrware.UUCP> Date: 8 May 89 22:20:51 GMT References: <1837@etive.ed.ac.uk> Reply-To: davely@mcrware.UUCP (Dave Lyons) Organization: Microware Systems Corp., Des Moines, Iowa Lines: 20 Oops. I cut the number of the original message. >Presumably LSC does its intermediate arithmetic >in 16-bit ints, so I'd have to say something like: > > long L = ((long)1 << 16) + 1 > >to enforce long intermediate values. But, this is a bit of a gotcha, and I >couldn't find any "beware of the leopard" paragraphs in the LSC manual where >it talks about portability. > > Nick. I think it's generally true that constants are assumed to be the "int" type unless otherwise specified. In order to get a "long" constant you need to say something like 1L (pg. 35 in the old K&R). Davely ...!sun!mcrware!davely The usual "only my opinion" stuff applies.