Re: 11.01 in binary

2019-09-03 Thread ToddAndMargo via perl6-users
On 9/3/19 10:24 PM, yary wrote: b vs B changes the order to show the bits within each byte h vs H changes the order to show the nybbles within each byte I'm not so good at explaining, and I remember you saying you're not so good with docs such as https://en.wikipedia.org/wiki/Endianness - so I

Re: 11.01 in binary

2019-09-03 Thread yary
b vs B changes the order to show the bits within each byte h vs H changes the order to show the nybbles within each byte I'm not so good at explaining, and I remember you saying you're not so good with docs such as https://en.wikipedia.org/wiki/Endianness - so I'll give you some more pack/unpack e

Re: 11.01 in binary

2019-09-03 Thread ToddAndMargo via perl6-users
On 9/3/19 5:52 PM, yary wrote: 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

Re: 11.01 in binary

2019-09-03 Thread yary
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 c

Re: 11.01 in binary

2019-09-03 Thread ToddAndMargo via perl6-users
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 t

Re: 11.01 in binary

2019-09-03 Thread Fernando Santagata
I guess you're reading data from a file, since Perl 6 numbers (such as 11.01) might have a Rat representation. If so I guess you have that data in a Blob, then read the four bytes using read-uint8 (https://docs.perl6.org/routine/read-uint8) and apply .base(2) to each of them. On Tue, Sep 3, 2019 a

Re: 11.01 in binary

2019-09-03 Thread ToddAndMargo via perl6-users
On 9/3/19 5:21 AM, ToddAndMargo via perl6-users wrote: On Tue, Sep 3, 2019 at 1:15 PM ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote:     Hi All,     How would I print out what a 32 real value of     11.01 (base 10) looks like in its raw     binary form (ones and zeros)?    

Re: 11.01 in binary

2019-09-03 Thread ToddAndMargo via perl6-users
On Tue, Sep 3, 2019 at 1:15 PM ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: Hi All, How would I print out what a 32 real value of 11.01 (base 10) looks like in its raw binary form (ones and zeros)? Many thanks, -T On 9/3/19 5:09 AM, Fernando Santa

Re: 11.01 in binary

2019-09-03 Thread Fernando Santagata
Is this what you need? > (11.01).base(2) 1011.0011 On Tue, Sep 3, 2019 at 1:15 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > Hi All, > > How would I print out what a 32 real value of > 11.01 (base 10) looks like in its raw > binary form (ones and zeros)? > > Many thanks, >

11.01 in binary

2019-09-03 Thread ToddAndMargo via perl6-users
Hi All, How would I print out what a 32 real value of 11.01 (base 10) looks like in its raw binary form (ones and zeros)? Many thanks, -T