how would i go about rounding and displaying numbers, such as:
1,239,120
to 1.239 Million
Thanks
how would i go about rounding and displaying numbers, such as:
1,239,120
to 1.239 Million
Thanks
SuperMatCat24 Convert the number to float, divide by million and use string formatting to display it with desired number of decimal places.
xyz Thank you
this works ...
func make_pretty_numbers( num:float, precission:int=2 ) -> String:
var unit:String
if num > 1000000000:
num /= 1000000000
unit = "giga"
elif num > 1000000:
num /= 1000000
unit = "mega"
elif num > 1000:
num /= 1000
unit = "kilo"
else:
unit = "base"
return str("%."+str(precission)+"f "+unit) % [num]
klaas Woah thxx