I am writing a program that works on a big matrix. Due to the lack of memory, I defined the matrix as byte[]
. The problem of lack of memory was resolved, but now when I want to assign values to the elements of the matrix, it tells me that float values can not be converted to byte(the values of elements are float). So, using Convert.ToByte
I converted float values to byte. The problem is that it rounds the float values and I don't want it. Is there any function that I can use and it does not round the float number?
a portion of code is as follow:
static byte[,,] Score = new byte[1501,1501,501];
Score[i, j, att] = Convert.ToByte(2.0 *(Math.Log(calNum())));
where calnum
is a function that calculates a float number