# Mathematically round with node

## Recommended Posts

Hello everyone

I'm looking for an example of how to easily round in Marionette.
I would like to determine whether to round up or down.
a round of five would also be cool.

who can help?

Thanks and have a nice day

I is the number of decimal points to round to.  Since you want nothing after the decimal, set I to zero or just don't connect the input.  0.5 will round up. 0.499999 will round down.

I don't know of an easy way to round to 0.5

Hello Pat Stanford

22 hours ago, Pat Stanford said:

round

I want to be able to determine how to round.
For example, in the image above, I want to round down to a whole number.

In my opinion, the "round" knot is not suitable for all applications.

I miss:

1.8=1.0
1.3=2

Especially when I split a route, I need whole numbers to continue working. The problem is that the individual sections must have a minimum or maximum size (smaller than and larger than).

I still don't find my solution really good.

Are there better variants?

Would either the 'ceiling' or 'floor' marionette nodes work for you? One rounds up to the next whole integer, the other rounds down to the next whole integer

ceil = 'Return the ceiling of x, the smallest integer greater than or equal to x'

floor = 'Return the floor of x, the largest integer less than or equal to x'

round to 0.5:        round(x*2)/2

round to 0.05:      round(x*20)/20

round to 0.1:         round(x*10)/10

round up:              round(x+0.49999999999)

round down:         round(x-0.499999999)

round up to 0.05: round(x*20+0.4999999999)/20

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×

• KBASE
• #### MARIONETTE

×
• Create New...