Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!ukc!etive!lfcs!nick From: nick@lfcs.ed.ac.uk (Nick Rothwell) Newsgroups: comp.sys.mac.programmer Subject: LSC arithmetic problem Message-ID: <1837@etive.ed.ac.uk> Date: 24 Apr 89 14:36:53 GMT Sender: news@etive.ed.ac.uk Reply-To: nick@lfcs.ed.ac.uk (Nick Rothwell) Organization: LFCS Enya Admiration Society Lines: 19 Well, perhaps not a problem, but certainly a "gotcha". The following declaration: long L = (1<<16) + 1; results in L being (long) 1. 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. Nick Rothwell, Laboratory for Foundations of Computer Science, Edinburgh. nick@lfcs.ed.ac.uk !mcvax!ukc!lfcs!nick ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ Fais que ton reve soit plus long que la nuit.