fork download
  1. function toBits(num)
  2. local t={}
  3. while num>0 do
  4. rest=num%2
  5. table.insert(t,1,rest)
  6. num=(num-rest)/2
  7. end return table.concat(t)
  8. end
  9.  
  10. print(~3)
  11. print(toBits(2), toBits(~3), toBits(2~3))
  12. print(2~3)
  13. print(2.~3)
Success #stdin #stdout 0.01s 5292KB
stdin
Standard input is empty
stdout
-4
1.00		1
1
1