# Is This A Bug? Dec Function.

## Recommended Posts

The first call and display are correct. The second is not. Is this a bug do you think?

```\$dec = Dec("0000000A")
msgbox(0,"","@error=" & @error & " \$dec=" & \$dec)
\$dec = Dec("00000000A")
msgbox(0,"","@error=" & @error & " \$dec=" & \$dec)```

Edit: I'm sure it is on account of the +ve @error in the second.

Edited by Peter Hamilton-Scott

##### Share on other sites

The first call and display are correct. The second is not. Is this a bug do you think?

```\$dec = Dec("0000000A")
msgbox(0,"","@error=" & @error & " \$dec=" & \$dec)
\$dec = Dec("00000000A")
msgbox(0,"","@error=" & @error & " \$dec=" & \$dec)```

Edit: I'm sure it is on account of the +ve @error in the second.

The second cannot be represented in a 32-bit so you get the @error set

##### Share on other sites

The second cannot be represented in a 32-bit so you get the @error set

I'm happy with the explanation but a little disappointed that hex A cannot be interpreted in the second. I agree the maximum length Dec can handle is 7FFFFFFF (8 digits maximum) but 000A is 00000000A is 0000000000000000000000000A using my calculator!

##### Share on other sites

I'm happy with the explanation but a little disappointed that hex A cannot be interpreted in the second. I agree the maximum length Dec can handle is 7FFFFFFF (8 digits maximum) but 000A is 00000000A is 0000000000000000000000000A using my calculator!

when you say in a string that you want 9 hexdigits it is normal to answer we can't as the 9 digits cannot be stored whatever the first zero can be ignored.

That's just what is doing AutoIt conversion by Dec() function.

BTW FFFFFFFF can be stored so the full 32-bit can be set.

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...