Working in hex

Very true.

Thank you Guillaume.



-----Original Message-----
From: Guillaume Marcais []
Sent: Thursday, May 06, 2004 11:49 AM
Subject: Re: Working in hex

What about:

irb(main):001:0> val = 0xe8b8 + (4 * 110)
=> 60016
irb(main):002:0> val.to_s(16)
=> “ea70”

I think you are confused between the internal representation of a number and
its text representation.


On Thu, 2004-05-06 at 11:31, Mark Probert wrote:

Hello, rubyists.

I need to do the following:

val = 0xe8b8 + (4 * 110).hex
= 0xe8b8 + 1b8
= 0xea70

Is there an easy way in Ruby of doing this?
I need to have the result in hex.