Comments on the suggestion to use infinite precision math for wide int.

Robert Dewar dewar@adacore.com
Mon Apr 8 14:41:00 GMT 2013


On 4/8/2013 9:23 AM, Kenneth Zadeck wrote:
> On 04/08/2013 09:19 AM, Robert Dewar wrote:
>> On 4/8/2013 9:15 AM, Kenneth Zadeck wrote:
>>
>>>> I think this applies to Ada constant arithmetic as well.
>>
>> Ada constant arithmetic (at compile time) is always infinite
>> precision (for float as well as for integer).
>>
> What do you mean when you say "constant arithmetic"?    Do you mean
> places where there is an explicit 8 * 6 in the source or do you mean any
> arithmetic that a compiler, using the full power of interprocedural
> constant propagation can discover?

Somewhere between the two. Ada has a very well defined notion of
what is and what is not a "static expression", it definitely does not
include everything the compiler can discover, but it goes beyond just
explicit literal arithmetic, e.g. declared constants

    X : Integer := 75;

are considered static. It is static expressions that must be computed
with full precision at compile time. For expressions the compiler can
tell are constant even though not officially static, it is fine to
compute at compile time for integer, but NOT for float, since you want
to use target precision for all non-static float-operations.
>



More information about the Gcc-patches mailing list