Search Issue Tracker
Won't Fix
Votes
0
Found in [Package]
1.8.4
Issue ID
BUR-2399
Regression
No
Floating Point Precision degrades when Burst Compilation is enabled
How to reproduce:
1. Open the attached Project "burstTest" and load Scene "SampleScene"
2. In the Hierarchy, select the "Bug Test" GameObject
3. In the Inspector, change the value of "F" under "Bug Testing MB" to between 0.9999 and 0.999999
4. Observe the Console
Expected result: Values in the Console are less than or equal to 1
Actual result: Values are greater than 1
Reproducible with: 1.6.6 (2021.3.26f1), 1.8.4 (2022.3.0f1, 2023.1.0b18, 2023.2.0a16)
Notes:
- With Burst compilation disabled, all F values <=1 return values that are <=1
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
- Shader transparency, discard, and clip are not working when using the Player
- Error is thrown when clicking on warning in the console
- Long IL2CPP build time when project has a .ufbx library wrapper
- Cursor doesn't change to the resizing when using the Rect Tool and the Sprite is too close to the bottom of the Scene View
- InvalidOperationException exception is thrown when Editor Default Text Rendering Mode is set to "Bitmap" and Editor Font is set to "System Font" and an array is expanded in the Inspector Window
Resolution Note:
This is actually mono being weird. The mono runtime will treat all floating point calculations as doubles and convert the result back to a float at the end.
Burst does the "right thing" here and treats all the intermediate calculations as single precision operations, not double.
Burst will generate the same results as the equivalent C code. And if you run that C# code with .NET Core instead of mono you'll also get the same results.