It returns correctly but with 5 decimal places I believe. So I want that to always show as 2 decimal places. I am a javascript programmer and can’t figure out how to do it here in VASSAL
I.e., do your calculation, multiply by 100, round to nearest integer, and then divide by 100 again. If you want 3 decimals, multiply by 1000, calculate, round, and divide by 1000.
You would do something similar in Javascript.
The document on Expressions does mention some of the Math methods, but there are many more. Check the regular java.lang.Math documentation.
Another options is to use a string formatting like
{String.format("%.2f", new Object[]{1.23456})}
which in some cases may be better because the floating point representation of some numbers are not exact. The above method using Math.roundcan result in numbers with more than 2 decimals, while the formatting method will always give two decimals.