Mail Archives: djgpp/1996/06/26/04:53:29
In article <31d026a2 DOT 3304948 AT news DOT mcs DOT net>, Peter Johnson
<locke AT mcs DOT net> 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
- Raw text -