This is the mail archive of the gcc-patches@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: Patch gcc-4.0 should not apply mathematical associative rules for addition or multiplication


    I think that converting (x * C1) * C2 into x * (C1 * C2) is "unsafe"
    in IEEE arithmetic even if C1 and C2 are powers of two, and C1*C2 is
    perfectly representable (as returned by real.c's do_multiply).
    Consider C1 = 2.0, C2 = 0.5 and x = FLT_MAX.

Is it really *required* to overflow if an intermediate result overflows but
the result of the entire operation is representable?  Certainly Ada allows
producing the "correct" result in that case and so the optimization is
valid.  Do the other language standards forbid it?


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