Is there any way to add the double data type so we can use decimals in our calculations?
By the way, when a decimal value is left over in a calculation in AGS, does it round up or down?
Thanks.
There is a plugin for floating point numbers and calculations.
I think there aren't many cases in which you need decimals. You can store fractions in 2 integers: a multiplier integer and a divisor integer.
"By the way, when a decimal value is left over in a calculation in AGS, does it round up or down?"
I think it rounds down.
I really don't want a plugin; I'd like a data type. It'd just be a lot easier to use decimals in my calculations instead of working around it.
Especially when working with leap years.
Why not multiplying all the numeric values by 1000 for exemple ? When the calculation is finished, just divise the result by 1000...
Wouldn't it round off the decimal before the calculation, though?
Adding floating point numbers would mean quite a hefty amount of rework to the script compiler, and I'm not really sure that it's worth it considering how rarely they are needed.
As Dorcan suggests, you can emulate 3 decimal points of precision by multiplying all the parameters by 1000, and then dividing the result by 1000 afterwards.
Great, ok. Thanks.