Round Down

Hello,

I am trying to round-down a list of numbers. Any suggestions how to?
Math.Round doesn’t work for me, as it rounds-up or down. I always want to round down to 0 decimal places.

Thanks.
P.

Like this?

image

3 Likes

Have a look for a node called “Math.Ceiling” and “Math.floor” as these round up or down to whole number

3 Likes

There’s a clockwork node that lets you specify precision as well…
image

You could take the list of the rounded numbers and see which are greater than the original value.

For those which result in true you could then minus 1 off of the rounded answer. I have tried to illustrate this below.

is b larger than a?
a —> b
0.7—> 1 true, then minus 1
1.2 —> 1 false, keep result
1.6 —>2 true, then minus 1
1.7—>2 true, then minus 1

Then it is a case of using a bool mask to get the result you want.

This may be an overly convoluted way though.
Edit: Looks like it definitely was…haha

Jack

1 Like