How to store long numbers in an array? Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
DanielToward13
Posts: 71
Joined: 18 May 2017, 10:56

How to store long numbers in an array?

18 Jul 2018, 07:39

I want to store very large numbers (~100 digits long) in an array. How to do that and what is the Max limit?

Code: Select all

VarSetCapacity(MyArray, 10240000)
VarSetCapacity(MyVar, 10240000)
MyArray := []
MyVar := 10
MyArray[0] := MyVar + 33300000000000000000
MsgBox % MyArray[0]       ;;; returns -9223372036854775799
gregster
Posts: 4652
Joined: 30 Sep 2013, 06:48

Re: How to store long numbers in an array?  Topic is solved

18 Jul 2018, 07:48

https://autohotkey.com/docs/Variables.htm#cap :
Commands, functions, and expressions that accept numeric inputs generally support 15 digits of precision for floating point values. For integers, 64-bit signed values are supported, which range from -9223372036854775808 (-0x8000000000000000) to 9223372036854775807 (0x7FFFFFFFFFFFFFFF). Any integer constants outside this range are not supported and might yield inconsistent results. By contrast, arithmetic operations on integers wrap around upon overflow (e.g. 0x7FFFFFFFFFFFFFFF + 1 = -0x8000000000000000).
If you don't want to do maths with it, try storing them as strings (via quotation marks)...

There is also this maths library: https://autohotkey.com/board/topic/9351 ... s-library/
https://github.com/aviaryan/autohotkey- ... /Maths.ahk
I think it can evaluate bigger numbers if they are stored as strings...

Edited

Return to “Ask For Help”

Who is online

Users browsing this forum: A_AhkUser, boiler, Google [Bot], keedooh, majstang, neo256, Tomo2407 and 50 guests