- Home /
30f + 0.5f = 30f What??????
The basic operation of adding seems to be broken on the Mono that comes with the latest version of Unity3D. This bug doesn't show up in the .NET that comes with Visual Studio 2010 SP1 and doesn't seem to happen on the Mono that comes with MonoDevelop 3.0.5 (at least so I am told by Stack Overflow: http://stackoverflow.com/questions/13385878/floating-point-inconsistency-in-mono). Is there a workaround to this bug?
Can't reproduce this error.
Debug.Log (30f + 0.5f);
Prints 30.5 as expected. How did you encounter that error in Unity?
Here's a screenshot illustrating the problem:
($$anonymous$$onoDevelop on the left and Visual Studio on the right)
Answer by Eric5h5 · Nov 15, 2012 at 10:48 PM
Not the case; there are no errors or bugs with operations like this. If anything like this ever happened, virtually no code would ever be able to run and it would never make it into a release. My guess is that you're adding 0.5f to 30 as an integer.
Your answer
![](https://koobas.hobune.stream/wayback/20220613083925im_/https://answers.unity.com/themes/thub/images/avi.jpg)