Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / large integers

User Offline
Joined: 15th Jun 2022
Posted: 17th Sep 2022 19:42 Edited at: 26th Sep 2022 12:58

n as tInt (defaults to 0)
create with n = Int_Init(integer)
n = Int_Init$(string)
n = Int_Init#(float)

compare with
Int_Equals( tInt, tInt )
Int_EqualsInt( tInt, integer )
Int_GT( tInt, tInt )
Int_GE( tInt, tInt )
Int_LT( tInt, tInt )
Int_LE( tInt, tInt )

modify with
Int_Negate( tInt )
Int_Add( tInt, tInt )
Int_AddInt( tInt, integer )
Int_Subtract( tInt, tInt )
Int_SubtractInt( tInt, integer )
Int_Multiply( tInt, tInt )
Int_MultiplyInt( tInt, integer )
Int_Divide( tInt, tInt )
Int_DivideInt( tInt, integer )
Int_Mod( tInt, tInt )
Int_ModInt( tInt, integer )
Int_Pow( tInt, integer )

Int_Log( tInt ) returns log( tInt )

Int_ToString10( tInt )
Int_ConvertBase( tInt, base as integer, precision as integer ) returns a structure with limited precision for efficient output
Int_ToStringRaw( tInt )
Int_ToStringRawB( tIntBase ) prints the structure returned by Int_ConvertBase()

Comments welcome.
DBPro Master
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 19th Sep 2022 15:26
So you store the number as an array of integers? Seems inefficient, as something like 2,147,483,647 fits into a 4-byte integer but now it'd take up 10 bytes (plus the overhead of the rest of the UDT variables).
You may want to look at memblocks and I think you'd have to initially pass your large integers as a string. Your init function takes an integer as input so you're not going to be able to start out with a large int, not until another function is used on the number.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda
Pixel-Perfect Collision

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds

User Offline
Joined: 15th Jun 2022
Posted: 19th Sep 2022 16:25
Quote: "pass your large integers as a string"

Good catch! Thanks for checking it out.

Login to post a reply

Server time is: 2023-05-29 20:17:36
Your offset time is: 2023-05-29 20:17:36