Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- binario :: Int -> String
- binario n = f n (b n)
- where
- b a = reverse . map (2^) $ [0 .. truncate $ log (read $ show a :: Float) / log 2.0]
- f a (x:xs) = (if a >= x then '1' else '0') : (if xs == [] then [] else f (if a >= x then a-x else a) xs)
Advertisement
Add Comment
Please, Sign In to add comment