This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to determine that 2.0 == (float) 2 in a front-end.


And the point is that (X**2)**2 may be less accurate than x*x*x*x so that
means you cannot freely replace the latter by the former.

Obviously no one is claiming that (x**2)**2 always is less accurate than
x*x*x*x.

As I mentioned before, in Ada 83, x**4 was defined as having the same model
interval as x*x*x*x which means you can only replace it by something else
(e.g. x**2**2) if you can prove that it never has a larger model interval
(which you can't as we see).

This was not really intended. Consequently in Ada 95 there is a special rule
that x**n is x*x*x ... x*x*x with any possible assocation being allowed, so
for example, you can evaluate

x*x*x*x

as

(x*x)*(x*x)

which is of course the same
as

x**2**2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]