Why I can't calculate $0*log(0)$ but can $log(0^0)$ I got this doubt after some difficult in programming. In a part of code, i had to calculate:
$$
x = 0 * \log(0) \\ x = 0*(-\infty)
$$
and got $x = NaN$ (in R and Matlab). So I changed my computations to $x = Log(0^0)$ and got $x=0$.
I found this question/asnwer about $0*\infty$ getting NaN. But, why the 'log way' does have a result?
 A: If you need to calculate $0 \log 0$, you're probably either:


*

*Doing something wrong

*Implementing an algorithm that explicitly states that $0 \log 0$ is a fib that doesn't mean "compute zero times the logarithm of zero", but instead something else (e.g. "zero")


If $\log 0^0$ worked in your programming language, it's probably because it used the "wrong" exponentiation convention, and returned $0^0 = 1$.
I say "wrong", because it seems very likely your particular setting is more interested in the continuous exponentiation operator (in which $0^0$ is undefined) than it is in the combinatorial/discrete version (in which $0^0 = 1$).
A: $x=\ln (0)$ does not equal $-\infty$.
The limit approaches $-\infty$ as $x \to  0$ in $\ln(x)$, but it does not equal $-\infty$. 
This is because $\ln$ is only defined $x > 0$. 
The reason why $\ln(0^0)$ is defined is because your calculator is evaluating $0^0$ first. 
Any real number raised to the $0$ is $1$, $0^0 = 1$, which is then plugs into $\ln$ and evaluated as $\ln(1)$, which is $0$.
The reason why $0*\ln(0)$ is undefined is that $\ln(0)$ is undefined.
A: remember that $0^0=1$ so $\log(0^0)=\log(1)=0$. On the other hand $\log(0) = $ undefined and thus so is $0 \log(0)$
