Perl Monk, Perl Meditation | |
PerlMonks |
Re^2: Math::Base - arithmetics with baseX integersby shmem (Chancellor) |
on Aug 22, 2017 at 16:02 UTC ( [id://1197814]=note: print w/replies, xml ) | Need Help?? |
This is one of the reasons why I wrote Far from complete (besides missing pod, tests, you name it.) The perl builtins suffer from negative integer flaws also. The format %x of sprintf expects
on a 64bit system. The object could get a sign flag set by the constructor which is honored by arithmetic operations, but the string representation would be ambiguous anyways if the string has a leading dash. I'm not sure what to do about that. Perhaps limiting to unsigned integers is the way to go, and encode should croak if the number is negative; don't know yet. update: unsigned, yes, that's the point; common typo. It is coerced into an unsigned. Thanks Anonymous Monk fo pointing out the glitch.
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
In Section
Cool Uses for Perl
|
|