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.


Obviously, because X**Y, with Y real, is implemented by computing
EXP(Y*LOG*(X)) one doesn't want to change 2.0 to 2 lightly (i.e.,
without the assurance of -funsafe-math_optimizations).

Gosh I hope not! computing x**y that way is horribly inaccurate even with
perfect log and exp functions. I would not have imagined that any Fortran
compiler would still make that elementary mistake. The only time you can
compute x**y this way is if you have a significantly longer precision for
the intermediate result (e.g. the 80-bit extnded form on x86 is just right
for accurately computing x**y using log/exp).


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