#!/usr/bin/perl
# This program displays a number in floating point format...found in the computer
showbits(0);
for ($x=1; $x < 16384; $x*=2) {
showbits($x);
}
showbits("5.75");
showbits("-.1");

sub showbits {
$x=shift;
$string=pack("f",$x);
print "$x\t";
$y=uc(unpack("H*",$string));
print "$y\t";
for ($z=0;$z<8;$z+=2) {
$hx[$z]=sprintf("%.8b ",hex(substr($y,$z,2)));
}
print substr($hx[0],0,1), " ";
print substr($hx[0],1,7);
print substr($hx[2],0,1), " ";
print substr($hx[2],1,7);
print substr($hx[4],0,8);
print substr($hx[6],0,8);

print "\n";
}