How to round a float in F#?
For reference, there are also built-in F# functions for floor
, ceiling
, truncate
, and round
; however, the built-in round function doesn't allow you to specify the precision like System.Math.Round(...)
does.
Reference: https://fsharp.github.io/fsharp-core-docs/reference/fsharp-core-operators.html
System.Math.Round (3.21156,3);;
val it : float = 3.212