Xref: news2.mv.net comp.os.msdos.djgpp:5389 From: Paul Shirley Newsgroups: comp.os.msdos.djgpp Subject: Re: Fixed point math Date: Tue, 25 Jun 1996 22:19:03 +0100 Organization: DrinkSoft Lines: 22 Distribution: world Message-ID: References: <31d026a2 DOT 3304948 AT news DOT mcs DOT net> NNTP-Posting-Host: chocolat.foobar.co.uk Mime-Version: 1.0 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <31d026a2 DOT 3304948 AT news DOT mcs DOT net>, Peter Johnson writes >>I am curious. Is there any reason long long ints are not used for fixed >>point math? It would provide 64 bits of precision.. Making a 32.32 >>possible... >> >Because when you multiply, you would need a long long long int or >something 128 bits long.. 16.16 uses long long ints for multiplication >and division. AFAIK C will truncate a result it can't easily widen. Widening a long long is not trivial so don't expect it to happen. The results of integer arithmetic are defined to be the same width as the widest source operand. In general C compilers will widen to the size of an int (which is usually the most convenient size to use) unless you force it to do otherwise. The annoying thing is even though I know a P5 can generate 64 bit intermediates for *,/ convincing a C compiler it can is hard. -- Paul Shirley