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] |
On Sat, 13 Mar 2004, Richard Guenther wrote:
Really interesting issue...
Anyway, from a practical point of view I'm not really worried, since:
1- Glibc uses internally the very same algorithm, at least on x86 (just checked).
2- Which requires O(log n) multiplications and is discussed by Knuth in Sec. 4.6.3 of the second volume. You can find it almost *everywhere*, for instance also in SGI's power.
So there is no point in not optimizing ::pow(x, 4) without -ffast-math?
There is a potential accuracy problem, which is why GCC doesn't inline ::pow(x,4) without -ffast-math.
Whether libstdc++-v3 can be more pragmatic than GCC about system library accuracy, and even whether -ffast-math is a reasonable default for the compiler (as its is with several commercial compilers), are larger arguments. I doubt anyone would practically use a method more accurate than two multiplications to implement pow(x,4). So I agree with Paolo's disclaimer "from a practical point of view I'm not really worried.." :>
I hope this helps,
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |