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.

Author
Message
zxretrosoft
AGK Developer
9
Years of Service
User Offline
Joined: 10th Dec 2014
Location: Prague, Czech Republic
Posted: 19th Feb 2021 10:20
Hello friends!
Please answer a simple question.

AGK has 2 numeric variables available.

Integer
Float

Highest integer number is: 2147483647. But I need to count on numbers higher than 2147483647.
The only option is to use Float. But there is a problem again that when I convert such a number to a string, decimal zeros remain there => "12.0000000". Has anyone solved it yet?

Maybe it would be great if AppGameKit had a DOUBLE variable.

Thank you!
I am sorry for poor English
Heavens
8
Years of Service
User Offline
Joined: 10th May 2015
Location:
Posted: 19th Feb 2021 11:24
str(FloatNumber#, 0)

Will strip all the zeros out.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 19th Feb 2021 11:28 Edited at: 19th Feb 2021 11:33
does this help? https://forum.thegamecreators.com/thread/224667

otherwise:


?

Quote: "str(FloatNumber#, 0)

Will strip all the zeros out."

will remove all decimal places while you might want to keep non-zeros, instead?
[My Itch.io Home] [Now Playing]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=agk] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[Google Forum Search]
zxretrosoft
AGK Developer
9
Years of Service
User Offline
Joined: 10th Dec 2014
Location: Prague, Czech Republic
Posted: 19th Feb 2021 11:32
Thank you so much friends!!! Perfect job!!

[SOLVED]
I am sorry for poor English
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 19th Feb 2021 13:39
I'd be curious as to WHY do you need such large numbers?
n00bstar
20
Years of Service
User Offline
Joined: 9th Feb 2004
Location: Montreal, Canada.
Posted: 20th Feb 2021 19:36
Also wondering why Trunc() doesn't solve your problem?
-----------------------------------------------------------------------------
We all got a chicken duck woman thing waiting for us
zxretrosoft
AGK Developer
9
Years of Service
User Offline
Joined: 10th Dec 2014
Location: Prague, Czech Republic
Posted: 20th Feb 2021 21:42
n00bstar: Trunc() leaves decimal numbers. The conversion to String then contains them.
Raven: I try to work with open data, such as the budgets of countries where there are usually billions.
I am sorry for poor English
n00bstar
20
Years of Service
User Offline
Joined: 9th Feb 2004
Location: Montreal, Canada.
Posted: 21st Feb 2021 10:19 Edited at: 21st Feb 2021 10:20
Trunc() doesn't leave any decimal, that's its only function. It returns the integer part of a float.
-----------------------------------------------------------------------------
We all got a chicken duck woman thing waiting for us
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 21st Feb 2021 11:12
Quote: "Raven: I try to work with open data, such as the budgets of countries where there are usually billions."


Generally when you reach Larger Denominations, the precision is less important on the Thousands / Hundreds / Pennies.
With this said., it's ALWAYS a good practise to work to Scales.

i.e.



Essentially whenever you'd add a comma ( , ) or decimal ( . ) you take that as a "New Scale"
As you would handle the mathematics on each Scale Segment; this means aside from needing to handle Carry (>999) or Remainder (Negative) Values to be included in the next Scale; this isn't too difficult.
zxretrosoft
AGK Developer
9
Years of Service
User Offline
Joined: 10th Dec 2014
Location: Prague, Czech Republic
Posted: 22nd Feb 2021 12:56
Thank you so much friends! Your advice will all suit me! Thank you!
I am sorry for poor English

Login to post a reply

Server time is: 2024-04-25 16:06:31
Your offset time is: 2024-04-25 16:06:31