Wednesday 17 February 2016

Rounding Parameters, Part 2

If you have been struggling to use parameter functions like round, ceil, floor, isolate (which converts units for parameters) or similar then you will need to know this. I have been playing with this before and it was only recently that I have found some hidden help pages which explain why I had this problem and how to solve it.

round'n round

The more you live the mode you learn and I hope it stays this way for a long time; I know there is a regression curve but I don’t want to taste it. Avid for knowledge I am glad I learned something new so I had to write it down for you and me; I am in this way hoping it won’t perish in the back of my mind.

The solution I found last time was to increase precision by multiplying with10 or one if it’s powers, then use the function and then divide by that number again. Not elegant or good looking but it did the trick until I found the correct solution for this.

So it seems that units are evaluated before mean value of the parameter and in order to evaluate the numerical part you first need to get rid of the units.

How do we do that? We simply divide and multiply by the parameter units like this: "round(5.8 / 1 mm) * 1 mm"

Get rid of those units first.

The help page has a probably better example so shamelessly I will share it.

Units are evaluated before the arithmetic portion of an expression. Therefore, the power operator applies to a unit before it applies to an adjacent numeric value. For example:
2 m^2
does not evaluate to 4 square meters, but rather means 2 square meters. The correct syntax is:
(2 m)^2 = 4 m^2

There is a lot of info about syntax errors as well like when you mix units with unitless values without explicitly specifying this. That’s when you get that red text in the functions window so make sure you glimpse over the help pages here (2016) or here (2014), if the page is no more, search Google for “Formulas and equations for expressions reference” or “Expression Reference for Numeric Parameters”.



photo credit: snowing (license)

No comments:

Post a Comment