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: __builtin_cpow((0,0),(0,0))


On 2005-03-12 02:59:46 +0100, Gabriel Dos Reis wrote:
> You probably noticed that in the polynomial expansion, you are using
> an integer power -- which everybody agrees on yield 1 at the limit.
> 
> I'm tlaking about 0^0, when you look at the limit of function x^y
> -- which is closer to cpow() tgan powi().  Did you miss that?

When one uses the power notation in mathematics, one (almost) never
says when the context is a function R x R -> R or R x Z -> R or
whatever. The problem is the same in ISO C99 (and probably other
languages), without using extensions: when calling cpow(), the
compiler doesn't necessarily know if the user was refering to a
function R x R -> R or to a function R x Z -> R. That's why returning
1 for cpow((0,0),(0,0)) would be better IMHO, even though this would
mean that some errors wouldn't be detected in the case R x R -> R;
but anyway, getting a result that is not NaN doesn't mean that it is
correct. BTW, couldn't this be controlled by pragmas?

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA


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