Search Issue Tracker
Fixed
Votes
10
Found in
4.6.4p2
Issue ID
700792
Regression
No
[IL2CPP] Mathf.RoundToInt method doesn't work correctly
To Reproduce:
1. Run the attached script with mono/il2ccpp
2. Observe that IL2CPP returns incorrect values for:
Mathf.RoundToInt(4.5f)
Mathf.RoundToInt(0.5f + float.Epsilon)
Mathf.RoundToInt(0.5f - float.Epsilon)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Search field in UI Builder's Library has no character limit
- Changing the value in UI Builder by dragging increases it by a few thousand points when reaching the borders of the screen
- ARM64 architecture DLL incorrectly copied instead of x64 when building for Windows x64
- Crash on TypeTreeIterator::GetNode when opening a specific folder
- Crash on WriteSerializedAssetsV2 when (re)entering the Play Mode in a specific project when IEnumerator Start() is used
hitorijanai
Jun 11, 2015 00:57
I also have this problem after upgrading Unity to 4.6.5.p3. It seems like a little bug for many, but is a big problem for networked games. I think the real bug is that when you cast a float to int. My temporary solution is to cast to double before casting it to integer (float -> double -> int). Hope this helps