This isn't really an api, but I wanted to make it to test my skills.

These functions only support numbers of x : 0 <= x < 65536
2 Bytes for WholeNumber and 2 Bytes for Decimal Number

…so without further ado!

Pastebin: http://pastebin.com/K8ifc4aR
Spoiler


function encryptNumber(number)
  number = (number < 65536 and number >= 0 and number) or false;
  if(not number)then return false; end
  local whole = math.floor(number);
  local decimal = number - whole;
  local wholeBin = {};
  for i = 1,16 do
    decimal = decimal * 2;
    wholeBin[16+i] = decimal-decimal%1;
    decimal = decimal%1;
  end
  for i = 1,16 do
    wholeBin[17-i] = whole%2;
    whole = math.floor(whole/2);
  end
 return wholeBin;
end

function decryptNumber(twholeBin)
  local decimal,whole = 0,0;
  for i = 32,17,-1 do
    decimal = decimal + twholeBin[i]*2^(32-i);
  end
  for i = 16,1,-1 do
    whole = whole + twholeBin[i]*2^(16-i);
  end
  return whole+decimal/65536;
end

function binToString(twholeBin)
  return table.concat(twholeBin,nil,1,16).."."..table.concat(twholeBin,nil,17):gsub("^0+",""):gsub("0+$","");
end