From: Nebiru Date: 2006-12-03T04:00:05+09:00 Subject: convert binary array to floating point decimal new to ruby here, looking for a little help I'm trying to convert some C# code to ruby, however I'm not getting the desired results The code is supposed to convert a binary string to a floating point number public float binaryStringToFloat(int length) { float result = 0; int num = 0; // form the integer number from the binary string for (int i = 0; i < length; i++) { num = num << 1; num = num + binaryArray[(length - i) - 1]; } // scale to the floating point value result = (float)num; result = result / (1 << binaryArray.length/2); return result; } any help will be appreciated