我想将浮点数舍入到给定的精度,例如:
0.051 i want to convert it to
0.1
0.049 i want to convert it to
0.0
0.56 i want to convert it to
0.6
0.54 i want to convert it to
0.5
我无法更好地解释它,但其原因是将点位置(如0.131f,0.432f)转换为网格中瓷砖的位置(如0.1f,0.4f).