I'm puzzled what you really want, what the end goal is.

For looking at different representations of the same item, "pack" and
"unpack" are useful. I've only used the perl5 versions of those, for p6 it
is "experimental". Different machines will represent the same real
differently, and if I recall correctly not even IEEE standards exactly
specify representation of float and it can vary by compiler too.

Perl 6's native experimental pack/unpack don't support real, nor does the
P5pack module, so reverting to perl5... big/little b/h is binary or hex in
big/little-endian order. With quoting that should work in either Win or Unix

$ perl -E "say unpack 'b*',pack 'f', 12.34"
00100101000011101010001010000010
$ perl -E "say unpack 'B*',pack 'f', 12.34"
10100100011100000100010101000001
$ perl -E "say unpack 'h*',pack 'f', 12.34"
4a075414
$ perl -E "say unpack 'H*',pack 'f', 12.34"
a4704541





-y


On Tue, Sep 3, 2019 at 2:46 PM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:

> Hi Fernando,
>
> Not sure how to do the blob thing, but it sound like what
> I am after
>
> What I want to do is to assign a value to a 32 bit real variable,
> then see what ones and zeros are in the variable.
>
> Is it possible to represent a real number as both a 32 bit
> integer and a 32 bit real number and then see what the integer
> side has in it?
>
> -T
>

Reply via email to