Rounding Floats To Specific Decimals
3440 Views
-
| | | | --- | --- | | | approximateFloat(Value : float , decimalplace : float): float = | | | factor := Pow(10.0,decimalplace) | | | if(Rounded := Int[Value*factor]*1.0/factor): | | | return Rounded | | | else: | | | return 0.0 |approximateFloat(Value : float , decimalplace : float): float = factor := Pow(10.0,decimalplace) if(Rounded := Int[Value*factor]*1.0/factor): return Rounded else: return 0.0
Copy full snippet(6 lines long)
Categories:
Purpose:
- Tool and Pipeline
Recent tutorials