Search Issue Tracker
Postponed means that the issue was either a feature request or something that requires major refactoring on our side. Since that makes the issue not actionable in the close future we choose to close it as Postponed and add it on our internal roadmaps and technical debt pages instead.
Postponed
Votes
1
Found in
2017.1.1f1
Issue ID
993313
Regression
No
C# compiler constant folding issue with float operations
To reproduce:
1. Open the project, attached by the tester (ApproximatelyBug.zip)
2. Open the "scene" scene
3. Enter Play mode
4. Observe the console
Expected: Mathf.Approximately ((1.7f - 0.2f) % 1.5f, 0f) returns TRUE as does Mathf.Approximately (1.5f % 1.5f, 0f)
Actual: Mathf.Approximately ((1.7f - 0.2f) % 1.5f, 0f) returns TRUE (should be true), but Mathf.Approximately (1.5f % 1.5f, 0f) returns FALSE
Reproduced in 5.6.5f1, 2017.1.1f1, 2017.2.1p3, 2017.3.0p4, 2018.1.0b5
==========
Resolution:
This is actually a bug in the Mono C# compiler as it evaluates (1.7f - 0.2f) % 1.5f not to the constant value 0 but a very small floating point number. I have filed a bug upstream.
In addition, we plan on migrating to the Roslyn compiler in the future. This bug is not present there. I am resolving this bug for now, either to be fixed by Mono project or by migration to Roslyn.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Asset Database warning is being logged continuously when creating a script in an embedded package
- Build process only shows Initializing when building for Android
- TileMap Palette preview flickers when scaled
- Shader Graph Blackboard "plus" sign is not centered within the button
- [URP] When Rendering Layers are enabled, the DepthNormalPrepass is enabled even if not used
Add comment