Hi.

I was fiddling about with a small example of how nice radix adverbials are
for conversion:

my $x = 6*9;
say :13($x);

rakudo: 69

($x = 54 in base 10, but 54 in base 13 is 69 in base 10.)

Strangely enough, I cannot find a way — in the spec — of both treating a
number as something in base 13 as well as displaying it in base 13.

sprintf() has formats for binary, octal and hexadecimal, but there appears
no way to use an arbitrary base.

As a clarification, see this example form bc(1):

obase=13
print "What do you get when you multiply six by nine? "; 6*9
What do you get when you multiply six by nine? 42
obase=10


Am I missing something?


It is also somewhat confusing that while $x stores the result of the
multiplication of 6*9, the adverbial radix conversion treats the variable as
a literal and no longer a value.
-- 
Jan

Reply via email to