hackmin

Msgbox does not return value

5 posts in this topic

Msgbox returns no value when it comes to a large value

 

example:

Dim $primo = 999999999999999999999999999999999999

MsgBox(0,"",$primo)

 

msgbox returns:  9223372036854775807 

 

this value is not what I put in the variable

 

 

Share this post


Link to post
Share on other sites



As you can see: 9223372036854775807 is a number. Lower level languages (for example C) are using special stuffs for storing things. In such language you have to specify the SIZE of a number. AutoIt uses "LONG" type. Have a look at it:
http://www.cplusplus.com/reference/climits/

9223372036854775807  is the maximum of this LONG. Sadly AutoIt can't handle any bigger number.

 

BUT! If you doesn't want to calculate with it, then you can do the following:

Dim $primo = "999999999999999999999999999999999999"

MsgBox(0,"",$primo)

This will store the number as a STRING and not a NUMBER type. This way you can store any big number, but you can't calculate things with it. (like multiplying, divide etc).

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

2 hours ago, Unc3nZureD said:

Sadly AutoIt can't handle any bigger number.

 

@Unc3nZureD: Excuse me?:blink: Using doubles, the range for calculations is about 1.7E +/- 308 (15 digits), and if you want to do calculations with really big numbers, there's the BigNum UDF. For 64bit integers, there's czardas's operator64 UDF.

Edited by RTFC

Share this post


Link to post
Share on other sites

Oh, well, that's true, didn't think about BigINT :)

Well, in a default manner the maximum INTEGER is what I told.

 

You can actually write

Dim $primo = 999999999999999999999999999999999999.0

But that still won't print 999999999999999999999999999999999999 on the messagebox (which is obviously the intention of the OP).

Share this post


Link to post
Share on other sites

As MsgBox expects a string as 3rd parameter I would pass a string as suggested in post #2.
If you pass a number it is converted to a string by AutoIt.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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