User:Chaser Zaks/IEEE-754
< User:Chaser Zaks
Jump to navigation
Jump to search
Revision as of 15:21, 8 November 2017 by Chaser Zaks (talk | contribs) (Created page with "Licensed under public domain ==Encoder== <syntaxhighlight lang="lsl2"> //Todo </syntaxhighlight> ==Decoder== <syntaxhighlight lang="lsl2"> float integerToFloat(integer input...")
Licensed under public domain
Encoder
//Todo
Decoder
float integerToFloat(integer input){
integer sign = 1;
if(input & 0x80000000) sign = -1;
integer pow = -1;
float val = 0.0;
integer i = 9;
for(; i < 32; i++)
val += (float)(((input >> 31 - i) & 1)) * (float)llPow(2.0, pow--);
return sign * (float)llPow( 2.0, ((input & 0x7f800000) >> 23) - 127) * (val + 1.0);
}