Dan writes:
> >The "some multiple" being the next largest power of 256 that contains the
> >value, or the width that the value happens to be stored in at that time?
> >(Based on previous values assigned to that PMC which may have widened it)
> 
> Good question. The size of the bignum, if it's been declared to have 
> a maximum size, or the maximum size that it's been, though that 
> doesn't feel particularly right.

$bignum1 = 2^3283 + 1;

$bignum2 = $bignum1 - 2^3283;

# Q1 what's sizeof(bignum2) and how did it get that way?

print $bignum1 << 1; # shift

# Q2 expected output?

print $bignum1 <<< 1; # rotate

# Q3 expected output?


Q1  Given my current understanding, bignum2 should be either int or
a bignum with a 1-byte data field (the principle of 'snapping to
least size' espoused by Dan et al. in the math discussion).

Q2  the decimal representation of the binary number 1{3283 zeroes}10,
though my hazy understanding of bignum is that the in-memory
representation is not necessarily binary, so that would be a
pretty annoying piece of code.  Internally a bignum.

Q3  the decimal representation of the binary number 11.  Internally
carries the 2^3283 size of $bignum1 in case the owner intends on
rotating it back.  Violates the principle of snapping to least
size but follows the principle of least surprise.

F.

Reply via email to