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
- Texture is stored upside down when using Blit
- [VFX] Missing Expand Toggle with Output Slot
- [OpenGLES][XR] Zooming in on the camera's URP opaque texture causes "double vision" on Quest in OpenGLES3
- “[Worker0] Could not generate preview image“ error when opening macOS native plugin in the Inspector with Architecture to build for set to ARM 64-bit
- [iOS] Application.absoluteURL is empty on Awake/Start when opening via deep link with Splash Screen disabled
Add comment