Here's a function that rounds to the specified number of decimal places and returns the result as a string:
<function name="RoundToPlaces" parameters="value, places" type="string">
scale = pow(10,places)
return (ToString(round(value*scale)/scale))
</function>
If you want it as a double still, just remove the ToString (and change the function type).