News for hackers. Stuff that matters.
Re:Can your programming language do this? by profquail on Wednesday July 08, 2009 @08:00PM (#694931)
Or you could just do this:

double entropy = -1.0d * mydata.Select(x => x * Math.Log10(x)).Sum();

Where 'mydata' is of type IEnumerable<double>.

Re:Can your programming language do this? by trezor on Thursday July 09, 2009 @02:07AM (#695329)
I knew there was a simple and concise syntax I was missing. Writing code after midnight is definitely a nono :)