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.
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Reading numbers in other formats.
- From: Manolo <mpancorbo@gmail.com>
- Date: Wed, 25 Jul 2012 17:09:31 +0200
- Delivery-date: Wed, 25 Jul 2012 17:09:38 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=hPfA8tUQV0QJhzhI+ainy8oQPyxksD592r6DjWYwdnw=; b=brD/KhcZdJ5YS7/h8osGOhymC/I0ytpi+Jf42ndcWg98IsGc/XMPgw/PL+9adONOr+ izkCXM1pcaXmte5Zuld0RThKK+CRqOkO1p4kKNFr1cjh4btm6AfAXtyiJlqqxhQ9POEh 01zqXECbIhHMcFREYfH7mxCMDk+v4GjpcFMIuPcbRmE3SB/hEWpFijwQ5Ty9BkdbvQ5i qqsBL5Ph/KQivVmDG+wdQeP617PjVRIhPAZ5ZdV8+mqaskj9oJHB+KCOm53LuiBOh40g JK+e9zsKb+Do8KYV2VO3GrLhYHwy0s2oXiyq7cX3kZtbisy6oJBdSXrK4kGZ75Lo5sye 1OPQ==
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/