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-09 17:37:59 +0100, Gabriel Dos Reis wrote:
> Vincent Lefevre <vincent+gcc@vinc17.org> writes:
> | Well, mathematically, you can distinguish these two functions:
> | 
> |   powrr: RxR -> R (not defined on (0,0) in particular)
> | 
> | and
> | 
> |   powrz: RxZ -> R (where powint(0,0) = 1)
> | 
> | and even other two functions, where R is replaced by C (the complex
> | numbers). Unfortunately, the C language doesn't distinguish them.
> 
> That is no reason for the compiler not to distinguish them.  There are
> plenty of stuff the C language does not distinguish but the compiler
> has to.

Do you mean that the compiler should detect if the second argument
comes from an integer type?

> | Yes, and to compute complex^integer, you need to use cpow(), AFAIK.
> 
> No, you don't need cpow().

>From this point of view, the math library is useless as one can
reimplement it entirely. :)
 
> | I think this is the reason why cpow((0,0),(0,0)) should return 1,
> | just like pow(0,0).
> 
> That is a bogus reason.

No more than any other reason.

-- 
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]