On Fri, Jul 23, 2010 at 05:17, Jan Ingvoldstad <frett...@gmail.com> wrote: > 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 > perhaps a Rat should be displayed, with the base as denominator? say :13(6 * 9); # 42/13
~jerry