Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Im learning how to use binary and I learned that binary is in powers of 2, so to find out minecraft's floating point errors, I made this.
- number = 16383 -- This is the number you want to change to convert to binary
- did = 10000 -- don chang or ban
- --cached numbers
- bin = ""
- kek = did
- for i=1,did do
- if number % 2^(did-i) ~= number then
- number = number - 2^(did-i)
- bin = bin.."1"
- else
- bin = bin.."0"
- end
- end
- for i=1,#bin do -- get rid of those pesky gross zeros
- if string.sub(bin,i,i) == "1" then
- bin = string.sub(bin,i)
- break
- end
- end
- print(bin.." | "..number)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement