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.
我想四舍五入到小数点后半。
因此,如果我有 1.45,它会四舍五入为 1。如果我有 1.55,它会四舍五入为 1.5。那有意义吗?
Math.floor(x*2)/2
这应该做。