Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要将浮点数舍入到最接近的 0.5,例如:
1.1 = 1 1.5 = 1.5 1.6 = 1.5 1.8 = 2
等等。我真的不知道该怎么做。任何帮助将不胜感激。
对于正数乘以 2,加 0.5,截断,除以 2。