[ Date Index ][
Thread Index ]
[ <= Previous by date /
thread ]
[ Next by date /
thread => ]
Do I have a bit code that has taken me ages to get right. In perl...
$binstr = '10011000111111001011100'; $dblnum=2**5;
for ($i =1; $i <= length($binstr); $i++) { $a = substr($binstr, $i-1, 1); $num = 2**(5-$i); if ($a == 1) { $dblnum=$dblnum+$num; } } print "\$dblnum=$dblnum\n";
-- 'ooroo
Mike...(:)-) --------------------------------------------------- Email: mike@xxxxxxxxxxxxx o You need only two tools. o ///// A hammer and duct tape. If it /@ `\ /) ~ doesn't move and it should use > (O) X< ~ Fish!! the hammer. If it moves and `\___/' \) ~ shouldn't, use the tape. \\\ ---------------------------------------------------
-- The Mailing List for the Devon & Cornwall LUG Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the message body to unsubscribe.