I'm in the progress of converting some Go code to C# and am wondering if the following piece of code:
_, x := math.Modf(frac)
if x >= 0.5 {
frac = math.Ceil(frac)
} else {
frac = math.Floor(frac)
}
would be any different to this:
frac = math.Round(frac)
I know rounding can sometimes be tricky so I wonder if the first snippit acts as a workaround for something.