lua-users home
lua-l archive

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


I agree that bc.number does that for decimals. 
But, my hex values can't probably fit 32 bits.
Those hex values represent urls as returned by :

function url2hex(url) 
h,s =  string.gsub(url, "(.)", function(c) return string.format("%02x", string.byte(c)) end) 
return h
end 

I can't find any other workaround than looking into Luiz's bc library sources to see how it works and if it's easy to extend it.
Or how to transate a BigInt value into a bc's compatible big integer. Suggestions ? 

On Tue, Mar 16, 2010 at 1:02 PM, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
 > bigint_hextonum, but what
> I probably need is a way to translate a string  to a bc's big-integer.

bc.number does that for decimal numbers:
x=bc.number"31415926535897932384626433832795028841971693993751058209749445"