Forum Discussion
rlong98
Contributor
Thanks Rupert
I did find this:
(<math equation>).toDouble().round(3)
Still a rookie in the scripting work - not understanding the "Double" term.
Thanks again...
Rob
rupert_anderson
10 years agoValued Contributor
Hi Rob,
No problem, happy to help :-)
In terms of the need for casting to Double, the reason I did that is because when you do:
def result=2.5064267352
This stores result as a BigDecimal by default. The cast to Double provides that class's round method.
Now BigDecimals can be rounded, but not using that simple 'round' method, which I thought you'd prefer, as its easier to get used to.
Hope that helps,
Cheers,
Rupert
Related Content
- 10 years ago
Recent Discussions
- 15 years ago