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
- [Linux] Screen.SetResolution immediately applies windowed resolution when switching from Fullscreen to Windowed mode
- Lighting window allows non-cube map texture for Environment Reflections, throwing invalid texture type (2D) error
- Console warning “MismatchingRepositoryProjectMessage” when creating a new Unity Version Control workspace
- [Ubuntu] VFX Graph Enum Value menu stretches across screen when entered long Enum Value
- Unclear warning message in Rendering Debugger about the Play mode Debugger Overlay
Add comment