I need a way to round down a float up to a specific number of decimal places. Math.Round
will round up if the number after the cut is larger than 6, and Math.Floor
does not work with decimal places.
Basically if I have 2.566321
, I want the code to return 2.56
. The only way I know that this can be done is to convert the float to a string and use string.format
but I would rather not do that if possible.
Thanks.