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
- Missing script error when clicking “script” link in Cave scene’s Water Sample Description
- [VFX Graph] Set Position Shape Gizmo isn't refreshed after shaper switch
- NullReferenceException is thrown when trying to access volumeStack from the HDCamera class
- Visual artifacts appear when using an Orthographic camera with a Reflection Probe
- Not all animation properties are accessible when a prefab with an avatar model contains a nested copy of itself with a renamed GameObject
Add comment