Commodus Posted May 16, 2003 Share Posted May 16, 2003 Two things: if you're working on Tenebrae modesty doesn't help (so you ARE an expert programmer, don't deny it ) and two: does it make much of a difference? Both work, maybe your version is more efficient and the change is noticeable when you use the function a lot but even so JK2 probably has some sort of absolute value function in q_math.c already (I only wrote this because I couldn't use the function from one of the .h files). Link to comment Share on other sites More sharing options...
ASk Posted May 18, 2003 Share Posted May 18, 2003 in the original int power(int x, int y) function if (!y) { return 0; } this should be if (!y) { if(!x) return NULL; else return 1; } seeing as a^0 = 1, except a=0, where 0^0 is undefined Link to comment Share on other sites More sharing options...
razorace Posted May 18, 2003 Author Share Posted May 18, 2003 Uh, I'm pretty sure 0^0 = 1. Link to comment Share on other sites More sharing options...
Wudan Posted May 18, 2003 Share Posted May 18, 2003 Hmmm.... that's what my calculator is saying ... but why? 0 to the 0th power is 1, in fact, any number to the '0' power is 1, just as a number to the '1' power is itself. Not really useful math, generally, I know that *I* had to whip out the calculator, but then again, I *always* whip out the calculator. Link to comment Share on other sites More sharing options...
ASk Posted May 18, 2003 Share Posted May 18, 2003 because 0^0 is undefined, and no, there's no point to argue, because it is so, and I have math finals tomorrow so I know. and for ALL other numbers, x^0 = 1 Link to comment Share on other sites More sharing options...
razorace Posted May 19, 2003 Author Share Posted May 19, 2003 I'm still pretty sure 0^0 = 1. There's no reason why it would be undefined like x/0. Link to comment Share on other sites More sharing options...
Commodus Posted May 19, 2003 Share Posted May 19, 2003 Hmm... I'll check it with my maths teacher on Wednesday, but Windows Calculator gives me 1 and my normal calculator gives me an error. Hmmph. Link to comment Share on other sites More sharing options...
recombinant Posted May 19, 2003 Share Posted May 19, 2003 Interesting. I was leaning toward undefined, until I read this: http://mathforum.org/dr.math/faq/faq.0.to.0.power.html "Consensus has recently been built around setting the value of 0^0 = 1" ...which I'm still not real comfortable with, since as the article states, it's an "indeterminate form." Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.