Skip to content
Back to formatted view

Raw Message

Message-ID: <c9ce82b00905061226m55d1a402v6744ef0207e8738c@mail.gmail.com>
Date: 2009-05-06T19:26:16Z
From: Sundar Dorai-Raj
Subject: convert large integers to hex

Hi,

I'm wondering if someone has solved the problem of converting very
large integers to hex. I know about format.hexmode and as.hexmode, but
these rely on integers. The numbers I'm working with are overflowing
and losing precision. Here's an example:

x <- "6595137340052185552" # stored as character
as.integer(x) # warning about inaccurate conversion
format.hexmode(as.numeric(x)) # warnings about loss of precision
as.hexmode(x) # more warnings and does not do what I expected

I'm planning on writing a function that will do this, but would like
to know if anybody already has a solution. Basically, I would like the
functionality of format.hexmode on arbitrarily large integers.

Thanks,

--sundar