Re: K.I.S.S. Factor (Re: Numerics)

Wolfgang Jansen <[email protected]>
Newsgroups gmane.comp.lang.eiffel.smalleiffel
Organization University of Potsdam, Institute of Informatics
Message-ID <[email protected]>
Dominique Colnet wrote:

> Greg C wrote:
>
>> What if I write "000000001"? That doesn't look like an eight-bit 
>> integer value
>
> You are right that in such a situation, the compiler should warn the 
> user that leading 0 are not significant and that 000000001 is still an 
> INTEGER_8. Anyway, the choice we made avoids information loss.

That's not true for floating point numbers. Consider the following:

  const: REAL_128 is 3.33333333333333333333333333
  var: REAL_128
  var := 3.33333333333333333333333333

In case of `var' the manifest number is understood as a REAL_64
and precision (i.e. the information in last digits) is lost. In contrast,
no information is lost for `const' because the compiler utilizes here
the context information, i.e. the declaration REAL_128.
Among other's, this means that the SE compiler is applies different 
strategies
when evaluating an expression's context: sometimes the context is ignored,
sometimes the context determines the type of the expression.

Wolfgang Jansen
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.