Integer : 3322000011111010203100311011211322020110122010113111301101000200
String an integer in bits would required log2 of Integer that is 211.xxxx rounded 212 bits
Some programme on scriptlance says taking square root of this value will result in small, but he requires big deal of money that dont have. sqrt is 57636793900346419278364744407607.475108338
Now log2 (sqrt Integer) = 105.5 bits
But I am worried if we do not store sqrt perfectly we cannot recover back original value,
Question : Can we store this squareroot in 105.5 bits (round it like 13 bytes + 2 bits etc) and later read and square value to get original value back?
Please guide me.
Question : Can we store this squareroot in 105.5 bits (round it like 13 bytes + 2 bits etc) and later read and square value to get original value back?
No. You need to take log_2 of an integer (not a floating point) to see how many bits it needs. Ex: Log_2(256) = 8 bits. That number can be stored as 0x10000000. However, Log_2(256.123456789) ~= 8 bits as well. There is obviously more information in that second number, however.
To get around this, you could multiply your value by a power of 2 or 10 and store that as a integer (this is essentially fixed point: http://en.wikipedia.org/wiki/Fixed-point_arithmetic). So in your example, multiply 57636793900346419278364744407607.475108338 by 10^9 to get the integer: 57636793900346419278364744407607475108338, which is what you would store. Log_2 of that is 135.4, so you need at least 136 bits of information to store that number exactly.