| Manolo on Wed, 25 Jul 2012 17:09:38 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Reading numbers in other formats. |
I have a stupid problem with last version of PARI-GP, when reading
hexadecimal numbers in compiled way.
For example, the famous code:
------
hextodec(s) =
{ local(v=Vec(s), a=10,b=11,c=12,d=13,e=14,f=15,
A=10,B=11,C=12,D=13,E=14,F=15, h);
for(i=1,#v,h = (h<<4) + eval(v[i])); h
}
---------
works ok when captured as a gp function (say: read("hextodec.gp")):
? hextodec("1af9")
%1 = 6905
But when I run
$ gp2c-run -g hextodec.gp
I obtain:
? hextodec("1af9")
%1 = 256*a + (16*f + 4105)
Any clue?
--
Manuel Pancorbo Castro
http://bitakoro.tk/