Rounding problem

Could anyone tell me how to deal with rounding in Dynamo? The number should be 30.29 and I tried OOTB node and clockwork one as well - no luck.

I think you’re wrong as 30.2848 is definitely closer to 30.28 than 30.29.

Wouldn’t it be 30,2848 -> 30,285 -> 30,29 ?

That is not how you round numbers…

1 Like

No, this is not how rounding works. Rouding is not done sequentially.

The function knows that 30.2848 is between 30.28 and 30.29. It will return the closest one.

You can test your results with :

1 Like

Thank you for explanation. My ignorance of math knows no depths…

FYI: If you want to force it to round up or down for all cases you can use Math.Ceiling or Math.Floor nodes.

1 Like