__builtin_cpow((0,0),(0,0))
Ronny Peine
RonnyPeine@gmx.de
Wed Mar 16 17:57:00 GMT 2005
Hi,
Kai Henningsen wrote:
> dewar@adacore.com (Robert Dewar) wrote on 07.03.05 in <422CFBA7.8080001@adacore.com>:
>
>
>>Ronny Peine wrote:
>>
>>
>>>Sorry for this, maybe i should sleep :) (It's 2 o'clock here)
>>>But as i know of 0^0 is defined as 1 in every lecture i had so far.
>>
>>Were these math classes, or CS classes.
>
>
> Let's just say that this didn't happen in any of the German math classes I
> ever took, school or uni. This is in fact a classic example of this type
> of behaviour.
>
>
>>Generally when you have a situation like this, where the value of
>>the function is different depending on how you approach the limit,
>>you prefer to simply say that the function is undefined at that
>>point.
>
>
> And that's how it was always taught to me.
Well yes, in the general case this is the right way. But for some
special cases a definition is used to simplify mathematical sentences as
it is done for 0^0 = 1 or gcd(0,0,...,0) = 0. See for example:
http://mathworld.wolfram.com/ExponentLaws.html
Even though, gcc returns 1 for pow(0.0,0.0) in version 3.4.3 like many
other c-compiler do. The same behaviour would be expected from cpow.
>
>
> This is, of course, a different question from what a library should
> implement ... though I must say if I were interested in NaNs at all for a
> given problem, I'd be disappointed by any such library that didn't return
> a NaN for 0^0, and of any language standard saying so - I'd certainly
> consider a result of 1 wrong in the general case.
>
> MfG Kai
>
>
cu, Ronny
More information about the Gcc
mailing list