Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Whis idoes 0 to the power of 0 =1 ?

807603Nov 19 2007 — edited Nov 19 2007
double x = Math.pow(0,0);

x now equals positive 1, however this is mathematically incorrect. Really, zero to the power of zero is undefined. Originally I thought that the pow(0,0) returns 1 so that a double data type (ie not a string) is returned. Than I realized that in certain situations the pow method will return NaN, so my previous thoughts as to why 1 is returned cannot be true.

Can anyone tell me why pow(0,0) equals 1 and not undefined, or at least NaN? It's like this in all other programing languages I know. Is there some sort of mathematical reasoning of which I am unaware of; were zero the power of zero equals one?

Thanks guys
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 17 2007
Added on Nov 19 2007
3 comments
321 views