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
- Texture2D hash changes inside of an AssetBundle when rebuilding a SpriteAtlas bundle with an empty AssetPostprocessor Script enabled
- Aniso Level still applies when Generate MipMap is disabled in Texture Import Settings
- Mipmap Limit Groups long names are not truncated when creating a new Mipmap Limit Group with a long name
- “ArgumentException: Invalid double parameter.” error is thrown when Infinity is typed into the Fixed Timestep field
- GameObject becomes gray when using HDRP and STP together on macOS
Add comment