Issue with Round (Floor) in Grasshopper from a Dimension Value

I am getting this issue in both the Round component and the Expression component using floor(x).

When I try to do math on the dimension value I get from a Deconstruct Box component that returns an integer, the floor function rounds down to the integer below. I have included a screenshot. This happens with both the Round component and the Expression component using floor(x)

Any clue what the issue or workaround is?

If the real number of the output of Deconstruct Box is say for instance 1.9999, then 1.9999/0.2 = 9.9995.
So, the “floor” results of Roundand Expression would be 9…

The panel you used should round your output value and you can check the real number value by using Expression with Format("{0:R}",x).

1 Like

The shape I am pulling from is exactly 2mm in height, but I’m guessing some floating point errors are happening somewhere.

I saved and quit and have reopened my file since I first posted this, and now the value is correctly showing as 10. Unfortunately it looks like this is due to the error being on the other side of the number.

Now that I know, I can at least work around this by flooring the initial Y value to the first decimal place since I’ll never have numbers smaller than a 10th of a millimeter.