Message-Id: <199903140158.UAA32186@delorie.com> Comments: Authenticated sender is From: "George Foot" To: Ishpeck Date: Sun, 14 Mar 1999 01:56:36 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: Help: Allegro Fixed Variable Math. . . . CC: djgpp AT delorie DOT com X-mailer: Pegasus Mail for Win32 (v2.42a) Reply-To: djgpp AT delorie DOT com On 13 Mar 99 at 10:55, Ishpeck wrote: > I keep getting weird numbers whenever I use Fixed Variables.... they > read something like .0076812 when I try to add 1. I've tried many > converting an integer using itofix and fadd. . . but, it just won't > cooperate. Is there something special about Fixed vars that I'm > supposed to know? Please read the Allegro documentation about them, it's quite clear. To add an integer to a fixed point number you must pass the integer through `itofix' first. my_fixed += itofix(1); You said that you had already tried this; what went wrong when you did? Please post a complete but short (no more than fifteen lines) program that doesn't do what you think it should, and tell us what you think it should do and what it actually did. Here's my program, which prints what I expect it to (i.e. `1.000000'): #include int main (void) { fixed my_fixed = itofix(0); my_fixed += itofix(1); printf ("%f\n", fixtof(my_fixed)); return 0; } -- George