W
Webdiyer
Hi,
We all know that the return value of Math.Log(8,2) is 3,but how about
(int)Math.Log(8,2)? On my machine,the return value of (int)Math.Log(8,2) is
strange enough! it's not 3 but 2 ! I've tested other values such as
(int)Math.Log(16,2),(int)Math.Log(4,2),(int)Math.Log(32,2)...et, they all
return the same value as their counterpart Math.Log() methods,only
(int)Math.Log(8,2) is incorrect,is this a .net bug ? I've also tested
Math.Floor(Math.Log(8,2)),its return value is same as (int)Math.Log(8,2),but
Math.Ceiling(Math.Log(8,2)) and int.Parse(Math.Log(8,2).ToString()) returns
the correct value of 3! Dose anyone know what caused this strange behavior?
thanks in advance!
We all know that the return value of Math.Log(8,2) is 3,but how about
(int)Math.Log(8,2)? On my machine,the return value of (int)Math.Log(8,2) is
strange enough! it's not 3 but 2 ! I've tested other values such as
(int)Math.Log(16,2),(int)Math.Log(4,2),(int)Math.Log(32,2)...et, they all
return the same value as their counterpart Math.Log() methods,only
(int)Math.Log(8,2) is incorrect,is this a .net bug ? I've also tested
Math.Floor(Math.Log(8,2)),its return value is same as (int)Math.Log(8,2),but
Math.Ceiling(Math.Log(8,2)) and int.Parse(Math.Log(8,2).ToString()) returns
the correct value of 3! Dose anyone know what caused this strange behavior?
thanks in advance!