ID:1968454
 
(See the best response by Kats.)
#define Million 1000000

obj
Inventory
Gold
Amount = list("Millions"=0, "Leftover"=1)
value = 1
icon = 'Gold.dmi'
icon_state = ""
Title = "Gold"
description = "A very small sum of gold."

proc
lowerGold(var/amount)
var/millions = round(amount/Million)
var/leftover = amount - millions*Million

Amount["Millions"] = Amount["Millions"]-millions
Amount["Leftover"] = Amount["Leftover"]-leftover

if(Amount["Leftover"] < 0)
Amount["Million"] --
Amount["Leftover"] = Million + Amount["Leftover"]

if(Amount["Millions"] < 0)
Amount["Millions"] = 0
Amount["Leftover"] = 0

updateGold()

increaseGold(var/amount)
var/millions = round(amount/Million)
var/leftover = amount - millions*Million

Amount["Millions"] = Amount["Millions"]+millions
Amount["Leftover"] = Amount["Leftover"]+leftover

if(Amount["Leftover"] > Million)
Amount["Millions"] ++
Amount["Leftover"] -= Million

updateGold()

checkGold()

updateGold()
if(Amount["Millions"])
name = "[jru_Commafy(Amount["Millions"])] Million & [jru_Commafy(Amount["Leftover"])] Gold"
else
name = "[jru_Commafy(Amount["Leftover"])] Gold"

suffix = null

if(Amount["Millions"] >= 1000)
icon_state = "6"
description = "An immeasurable sum of gold."

else if(Amount["Millions"] >= 100)
icon_state = "5"
description = "An immense sum of gold."

else if(Amount["Millions"] >= 10)
icon_state = "4"
description = "An enormous sum of gold."

else if(Amount["Millions"] >= 1)
icon_state = "3"
description = "A considerable sum of gold."

else if(Amount["Leftover"] >= 100000)
icon_state = "2"
description = "A moderate sum of gold."

else if(Amount["Leftover"] >= 10000)
icon_state = "1"
description = "A small sum of gold."
else
icon_state = ""
description = "A very small sum of gold."




Now if I want to drop 25,000,001 gold how do I do that accurately? Is it possible to do it with 1 input prompt, or do I have to do multiple (one for millions, one for leftover, which I'm trying to avoid)?

Is it possible to put the number back together for display purposes?

This has been giving me a hard time, I thought of just moving everything back a few decimal places but I would still have problems displaying the number.
Best response
You only need to worry about the size of a number for presentation purposes. Typing 25,000,000,000 into the input prompt gives you the same number as 25e+9. It really just comes down to when you're actually displaying the number do you need to worry about breaking it down and chunking it up into smaller slices.

A little development tidbit, though: You really should rethink using big numbers like this. It's been stated dozens of times before and it'll be stated dozens of times from now, but no matter what you're doing, there's really never a necessity for using massive numbers like that, unless you're doing some exact economy simulation or something of the sort. It'll be far less of a headache for you.
I added a broker system into my game where players can trade pretty much any item, so I assume that players might have money over the 1bil mark from getting money over time.

When a player drops 25,000,001 gold without the system I used above to divvy up the money they'll always just drop 25,000,000. If they drop 1 gold 25,000,000 times they will still have 25,000,000 gold in their inventory and now on the ground.

Before I had it just ask the player how much gold they want to drop and it was as simple as just dropping how much they put in (after doing a few checks). Now, I have to ask them twice; one time to ask how much millions they want to drop and another time asking how much leftover they want to drop so I can set those values to the dropped money. I really don't want to ask twice, which is why I was wondering if there was a way to do it in just one prompt.
The problem you're seeing is that BYOND uses floating point numbers, which for integers are only accurate from -2**24 to 2**24 (about ±16.8 million).

If you need to handle exact amounts that can go beyond the usual limits, you'll need to plan something that can deal with that: like maybe a datum.