as for your criteria: the follow perl script can do the 16 bit fix point fractional number representation:
"-1<=x<1, the first bit is the signed bit, the remaining 15 bit are fraction part"
open SRC, "data";
while (<SRC>) {
chomp($_);
$_=$_*(2**15);
printf DST "%b,", $_;
}
Result:
n = 0.5 0100000000000000
n = 0.25 0010000000000000
n = 0.125 0001000000000000
n = 0.1234 0000111111001011
n = -0.5 1111111111111111
n = -0.25 1111111111111111
n = -0.125 1111111111111111
n = -0.1234 1111111111111111