Martin Larsen on Sun, 04 Dec 2005 22:54:23 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Using hexadecimal with gp



On Fri, Dec 02, 2005 at 07:01:26PM +0100, Martin Larsen wrote:

hextodec(s)=
{local(v=Vecsmall(s),
sett=Set([0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f]));
sum(i=0,#v-1,(setsearch(sett,Strchr(bitor(v[#v-i],32)))-1)*16^i)}

Correction, I'm scrambling for an easy way to enter "sett"
sett=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"]);

Maybe sett=Vec("0123456789abcdef") ?

Yes, thank you (the only thing I didn't try - I think)

Martin