K
kj
I want to write the function to_bits that takes a floating point
number as argument and returns an array of 32 ones or zeroes,
corresponding to the bits of the input argument.
I have been staring at the docs for pack and unpack for a while
now trying to figure out how to use them to do this and I am as
clueless about it as I was when I first started. Also, perlpacktut
was no help either [1].
If someone could please tell me how to generate an array of one's
and zeros corresponding to the bits in a floating point number I'd
be very grateful.
kj
[1] Lest I appear very lazy or very stupid, I should point out that
I generally have *no problem* understanding the documentation for
Perl built-in functions. pack is a very exceptional case. It is
the only Perl function that I consider mysterious in the least.
I wish I could convey my bewilderment upon reading the docs for
pack. From the very first sentences it is as if I were reading
some English-like code in which all words mean something different
from what I think they should mean. As I said, the tutorial is no
help, because ultimately the tutorial just gives cookbook recipes
which I can follow, but I have no idea what I'm doing. If what I
need to do is not described in one of the recipes, then *I have no
idea* of how to devise my own recipe.
number as argument and returns an array of 32 ones or zeroes,
corresponding to the bits of the input argument.
I have been staring at the docs for pack and unpack for a while
now trying to figure out how to use them to do this and I am as
clueless about it as I was when I first started. Also, perlpacktut
was no help either [1].
If someone could please tell me how to generate an array of one's
and zeros corresponding to the bits in a floating point number I'd
be very grateful.
kj
[1] Lest I appear very lazy or very stupid, I should point out that
I generally have *no problem* understanding the documentation for
Perl built-in functions. pack is a very exceptional case. It is
the only Perl function that I consider mysterious in the least.
I wish I could convey my bewilderment upon reading the docs for
pack. From the very first sentences it is as if I were reading
some English-like code in which all words mean something different
from what I think they should mean. As I said, the tutorial is no
help, because ultimately the tutorial just gives cookbook recipes
which I can follow, but I have no idea what I'm doing. If what I
need to do is not described in one of the recipes, then *I have no
idea* of how to devise my own recipe.