Search Issue Tracker
Won't Fix
Votes
0
Found in
5.3.5f1
Issue ID
810199
Regression
No
[Float]Precision loss when using the remainder of floating point
Steps to reproduce:
1. Open attached project.
2. Open scene named "main".
3. Select "Main Camera" and notice that its component "Test(Script)" has a field named "ID".
4. Select that field and enter value "61.2".
5. Enter the play mode.
6. Notice that the "console" window outputs these lines:
Debug.Log("X " + ID) : X 61.2
Debug.Log("XX " + (ID * 10)): XX 612
Debug.Log("XXX " + ((ID * 10) % 10)) : XXX 2.000008
Debug.Log("Y " + 61.2F) : Y 61.2
Debug.Log("YY " + (61.2F * 10)) : YY 612
Debug.Log("YYY " + ((61.2F * 10) % 10)) : YYY 2
Actual result:
"Debug.Log("XXX " + ((ID * 10) % 10));" outputs "XXX 2.000008". It means, that there is a precision loss when using the remainder of floating point number.
Expected result:
"Debug.Log("XXX " + ((ID * 10) % 10));" should output "XXX 2", so the precision would not be lost.
Reproduced with:
5.1.0f3, 5.2.4f1, 5.3.5f1, 5.3.5p6, 5.4.0b24, 5.5.0a2.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [WebGL][Android] Corrupt header when connecting via IP
- Editor and Android Player hangs/freezes when repeatedly Loading/Unloading AssetBundle in Vulkan
- Selecting a Material for HDRP Decal Projector in the Inspector window spams errors in the Console
- Expanded Asset Preview Box moves/hides when creating new Asset in Project window
- Player crashes on Meta Quest with "/apex/com.android/runtime/lib64/bionic/libc.so" when using OpenXR Plugin in a specific project
Add comment