# hex

## Recommended Posts

ok so maybe im having a dumb day, but why when i execute this script it returns 03A5FF18 instead of 3A60000, why?

```\$div = 0x3A60000 / 0xDF8
\$a1 = "0x" & Hex(\$div)
\$a2 = \$a1 * 0xDF8
MsgBox(0,"",Hex(\$a2))```

##### Share on other sites

What I do with something like this is just walk thrhough the code.

\$div = 0x3A60000 / 0xDF8

You're dividing hex. try this on a calculator, and see if it's what you expect.

\$a1 = "0x" & Hex(\$div)

don't think you need the 0x there.

\$a2 = \$a1 * 0xDF8

You multiply it by what you divided.

MsgBox(0,"",Hex(\$a2))

\$a2 is already hex. your converting what you have, to hex again

~~TheCreator~~Visit http://tysdomain.com for personal software and website solutions.

##### Share on other sites

autoit returns hex equations in decimal format, and yes i do need the "0x"

Edited by UPSman2

##### Share on other sites

sorry for double post, but i think its just hex doesnt carry decimals and just rounds... thus my equation is wrong *cry*... o well

##### Share on other sites

Hexadecimal is used for integers most commonly. I don't know how you'd represent a floating point number in hex.

## Create an account

Register a new account

×

• Wiki

• Back

• Git