Rounding Nodes - Is there a way to "Get" digits from multi-digit numbers?

Hi all,


I'm interested in building node(s) for various rounding functions. This is currently a "round" node - it rounds any decimal places to become whole numbers using the most common method of rounding up if the decimal is .5 or higher and rounding down if the decimal is less than .5. I'd like to add these additional options: "round up" "round down", and a variable round function (ie. round to nearest 10 or 100 or 1000 etc.).


My problem is that I don't know how to "Get" individual digits from multi-digit numbers. Anybody know how the out-of-the-box Round function did this?


nc



Thanks.


In the meantime I found out that the formula node does have a round function (and ceil and floor, too), so this node could be made a bit more concise. Instead of the three nodes (formula - round - formula) you could just use one formula node with (Round(a/b,0))*b


Be aware that the formula node's round function requires two arguments: the number to be rounded and the number of decimal places (the ceil and floor functions only take one argument each). Documentation for all the functions and syntax available in the formula node can be found here:


http://ncalc.codeplex.com

Very nicely done! It is especially great that the round value doesn’t have to be a factor of 10. Thanks!

Here's how. This would be even easier if the formula node had a round function...


Hi Nick,


You can use "Ceiling" to round up and "Floor" to round down. Being able to round to specific digits would be helpful though.