[闲聊] 关于四舍五入

楼主: lopp54321010 (嘻嘻010)   2019-05-14 18:52:27
https://i.imgur.com/NgxEqfM.png
上面JS 下面Unity内建的数学函式库 两边分开做类似FrameSync的同步计算
https://i.imgur.com/PWdeIbS.png
得到了不同结果 操他妈RoundToInt一定有加料 不是普通的四舍五入
结果去查Documents
If the number ends in .5 so it is halfway between two integers,
one of which is even and the other odd, the even number is returned.
为什么要这么做 谁看函式名称能想到会优先回传偶数啦干
作者: ILoveElsa (S级18位 梓喵酱油瓶)   2019-05-14 18:53:00
求偶吧
作者: LabMumi (实验室姆咪)   2019-05-14 18:56:00
可能是偶向厨吧
楼主: lopp54321010 (嘻嘻010)   2019-05-14 18:56:00
原来C#原生的也是这样 干
作者: siscon (laisan)   2019-05-14 19:09:00
四舍六入五成双
楼主: lopp54321010 (嘻嘻010)   2019-05-14 19:10:00
MidpointRounding.AwayFromZeroMidpointRounding.ToEven

Links booklink

Contact Us: admin [ a t ] ucptt.com