::pow(T, n) vs std::pow(T, n) for non-constant n
Richard Guenther
rguenth@tat.physik.uni-tuebingen.de
Sun Mar 14 20:58:00 GMT 2004
Gabriel Dos Reis wrote:
> Richard Guenther <rguenth@tat.physik.uni-tuebingen.de> writes:
>
> | exponent. This is why I suggest for __builtin_pow not to dispatch to
> | the library for non-const arguments, but to an internal routine
> | modeled after the v3 binary algorithm.
>
> There definitely should be a __builtin_powi() and the like. But I
> don't like that std::pow(, 4) and std::pow(, n) (with n == 4) should
> give different results.
With -ffast-math this would be acceptable. But I don't like std::pow(x,
n) and ::pow(x, n) to differ either. One could improve the binary v3
algorithm with a table dispatch to optimal code for exponents < 256 like
the builtin function does.
Richard.
More information about the Libstdc++
mailing list