Search Issue Tracker
By Design
Votes
1
Found in
2019.4
2020.3
2020.3.22f1
2021.2
2022.1
Issue ID
1381896
Regression
No
Float to Int conversion returns unexpected/differential results when adding a second conversion to float in the equation
How to reproduce:
1. Open the attached project "Floatinconsistent.zip"
2. Open "SampleScene" Scene
3. Enter Play mode
Expected result: the results displayed in the Console window are 70, 70, 70
Actual result: the results displayed in the Console window are 70, 69, 70
Reproducible with: 2019.4.33f1, 2020.3.23f1, 2021.2.4f1, 2022.1.0a16
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Crash on ShaderLab::ShaderState::ApplyShaderState when entering Play Mode and calling ShaderWarmup.WarmupShaderFromCollection with a shader that has dynamic_branch
- Crash on operator delete[] when a serializable structure in the System namespace is serialized by a MonoBehaviour
- [macOS] forward and backward mouse buttons are recognized as middle mouse button
- NavMeshModifier.OnEnable/OnDisable gets progressively slower when called repeatedly
- "System.Net.CookieContainer" throws an "ArgumentException" error when using a non-UTF-8 machine locale and hostname
Resolution Note (2022.2.X):
The difference in output values is an implementation details in floating point operations within the VM. Note that .NET Core and .NET Framework also yield different results. If a "rounding" behavior is expected, please use Math[f].Round as the behavior of casting to floating point to integer is truncation.