Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!amdahl!uunet!mcvax!cernvax!pan!jw From: jw@pan.UUCP (Jamie Watson) Newsgroups: comp.databases Subject: Informix 4gl - no integer arithmetic??? Message-ID: <466@pan.UUCP> Date: 4 Sep 88 10:47:48 GMT Reply-To: jw@pan.UUCP (Jamie Watson) Organization: Adasoft AG, Solothurn, Switzerland Lines: 32 I have just discovered, the hard way, that in Informix 4gl the following statement, which contains only integer values, yields a most surprising result: main define i integer let i = 630 / 100 * 60 display i end main Running this program produces a result of 378!!! The 4gl manual states that all arithmetic is done in type 'decimal', which might explain what is going on here, but then it goes on to explain that for integer values, the specific type used is 'decimal(10,0)', which would imply that the integer nature of the operations should be preserved. It obviously is not. The only solution I have been able to find is to use an intermediate variable whenever integer division is performed: main define i, botch integer let botch = 630 / 100 let i = botch * 60 display i end main Has anyone found a better work-around? jw