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
- Blank, Light-Themed "Create Node" window becomes visible on the next project open
- UI Elements/Layout inconsistencies in the Particle System component
- The Game view and Scene view fail to render when launching the Editor with a maximized Render Graph Viewer window
- "List is empty" is poorly visible in the "Create Node" window
- [Android] GameObject with a custom shader becomes invisible when deployed with the Vulkan Graphics API
Add comment