convert(12345, binary);
convert(11000000111001, decimal, binary);
Or, if you're at a command line and/or don't have maple installed:decimal to binary:echo "2 o 12345 p" | dcbinary to decimal:echo "2 i 11000000111001 p" | dcAlso usable for hexadecimal etc.:echo "16 o 123456 p" | dc... or even converting from, say, base-7 to base-13:echo "7 i 13 o 123456 p" | dc
Thanks, vocho amarillo, that's pretty useful!
Post a Comment
2 comments:
Or, if you're at a command line and/or don't have maple installed:
decimal to binary:
echo "2 o 12345 p" | dc
binary to decimal:
echo "2 i 11000000111001 p" | dc
Also usable for hexadecimal etc.:
echo "16 o 123456 p" | dc
... or even converting from, say, base-7 to base-13:
echo "7 i 13 o 123456 p" | dc
Thanks, vocho amarillo, that's pretty useful!
Post a Comment