To: djgpp AT delorie DOT com Subject: Re: Allegro fixed math routines Message-ID: <19970204.171826.4847.3.chambersb@juno.com> References: From: chambersb AT juno DOT com (Benjamin D Chambers) Date: Tue, 04 Feb 1997 20:17:04 EST On Tue, 4 Feb 1997 13:10:19 +0100 (MEZ) Christian Tamasiu writes: >Hello! >I just hacked in a small program which uses the fixed math routines of >allegro. However, some strange things are going on (at least thats >what it >seems to be for me): >Why doesnt, for example, " x = y + 24 " (both x and y fixed) work??? >However, " x = y + itofix(24) " worked. But even more strange using >some >other values, it worked without itofix. It is also sometimes need >using >*,/,- and sometimes not. >Why??? >Chris. > > I'd have to see the code to know for sure, but here's the general gist: FIXED + FIXED = a+b FIXED - FIXED = a-b FIXED * FIXED = fmul(a,b) FIXED / FIXED = fdiv(a,b) FIXED + INTEGER = a+itofix(b) FIXED - INTEGER = a-itofix(b) FIXED * INTEGER = a*b FIXED / INTEGER = a/b ...Chambers