Hi there, is it possible to round a decimal number to the nearest whole number.
So if i inputted 60.9 and 70.2, it would always output 70.
[+ 0.5] >> [int]
Sure – slap an integer number box on the float output, which truncates. If that doesn’t float your boat and you want to round "like humans do," then add. .5 and then slap an integer number box on the float output.
or just use [round]
The [round ] object is more convenient.
Thanks everyone, feel a bit silly now :P
[expr (int($f1-0.5))*($f1<0) + (int($f1+0.5))*($f1>=0)]
a more concise one int($f1 + ($f1 > 0) - 0.5).
int($f1 + ($f1 > 0) - 0.5)
nice one, danke ej
Log in to reply
C74 IN YOUR INBOX
C74 RSS Feed | © Copyright Cycling '74 | Terms & Conditions
Let us tell you about notable Max projects, obscure facts, and creative media artists of all kinds.