Jump to content

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
Link to comment
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
Link to comment
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! :)

Link to comment
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! :mellow:

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. :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...