#!/bin/bash
# Show binary representation of a number
if [ $# -ne 1 ]; then
echo "usage: `basename $0` NUMBER" 1>&2
exit 1
fi
echo "obase=2; $1" | bc -l
If it won't be simple, it simply won't be. [Hire me, source code] by Miki Tebeka, CEO, 353Solutions
Subscribe to:
Post Comments (Atom)
1 comment:
This is a handy trick to get an idea of what small, unsigned whole-number decimals might look like as binary. Nice!
Actual binary representation, however, is best left to hardware implementers. :)
Post a Comment