Re: Numerics

Dominique Colnet <[email protected]>
Newsgroups gmane.comp.lang.eiffel.smalleiffel
Message-ID <[email protected]>
josé bollo wrote:

> here is a common expression (where n is 9 and m is INTEGER):
> 
>   m := 10000*2^n
> 
> so i apply SE rules: {INTEGER_16}*{INTEGER_8}^{INTEGER_8}
> 
> and nothing does fit! : 2^9 is an INTEGER_16 and the 5120000 is 
> obviously not an INTEGER_16.
> 
> And me the programmer have to be aware of such a thing even when i know 
> that the result is an INTEGER so INTEGER_32 that fit.
You are right here. The compiler should infer that 10000*2^9 = 5120000
and thus fit on INTEGER_32.
Exactly as the compiler is currently able to see that 127+1 = 128
So you are right and I consider it as a bug in the compiler.
I have registered your example in our private test suite (no need for 
you to fill a SmartZilla record).
Thanks
And as usual best regards to all,
-- 
--------------------------------------------------------------
[email protected] -- IUT (Nancy 2) -- INRIA Lorraine
http://SmartEiffel.loria.fr  --  The GNU Eiffel Compiler
POST: Loria, B.P. 239,54506 Vandoeuvre les Nancy Cedex, FRANCE
Voice:+33 0383913140 Mobile: +33 0665362381 Fax:+33 0383581701
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.