I want to output to calculate the following:
0 - (3/6)logbase2(3/6) = 1/2
I have this in my program:
Code :double ratio = 3/6; x = x - (ratio * (logbase2(ratio)));
which should equal .5 but I keep getting 0.326634259978281
what am I doing wrong?
Edit: I figure it out. I should be using:
(ratio * Math.log(ratio)/Math.log(2))
