Sunday, 29 September 2013

Adding Hexadecimals

Adding Hexadecimals

I am trying to add hexadecimals using scala. The problem is that the
hexadecimals are being converted into integers and then being added.
0x400000+0x00996494+0x140+0x22c+0x1e8
Doing something like this gives me.
14248424
Or if I call toHexString on it I get
d969e8
The result I am trying to get is.
13892358 -In a hex.
This "Tool" is telling me that
400000+00996494 = 13891be8
13891be8 + 140 = 02c6fba0
02c6fba0 + 22c = 138c3890
138c3890 + 1E8 = 13892358

No comments:

Post a Comment