📜  舍入以浮动统一 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:56.159000             🧑  作者: Mango

代码示例1
float f = 3.16856f;
f = Mathf.Round(f * 10.0f) * 0.1f;
//Which will give 3.2f


//If you want 2 decimal points then,


float f = 3.16856f;
f = Mathf.Round(f * 100.0f) * 0.01f;
//Which results in 3.17f, and so on.