Converting raw byte data to float[]
I have this code for converting a byte[] to float[] . public float[] ConvertByteToFloat(byte[] array) { float[] floatArr = new float[array.Length / sizeof(float)]; int index = 0; for (int i = 0; i < floatArr.Length; i++) { floatArr[i] = BitConverter.ToSingle(array, index); index += sizeof(float); } return floatArr; } Problem is, I usually get a NaN result! Why should this be? I checked if there is data in the byte[] and the data seems to be fine. If it helps, an example of the values are: new byte[] { 231, 255, 235, 255, } But this returns NaN (Not a Number) after conversion to float. What