Last active
December 12, 2016 15:11
-
-
Save thluiz/452ae30bdd9a47627ba238bfa4b07c33 to your computer and use it in GitHub Desktop.
Convert a UInt32 (Unsigned Integer) to Binary in F#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rec to_binary(value: UInt32)= | |
if value < 2u then | |
value.ToString() | |
else | |
let divisor = value/2u | |
let remainder = (value % 2u).ToString() | |
to_binary(divisor) + remainder |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment