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
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
Add comment