Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Divide by units or use parentheses...
CAD_SSP
Member Posts: 45 ✭✭
To convert a measurement to a number in a formula you divide by the units, i.e. 22mm/mm = 22
If you want to do something like 220mm/22mm you get an error so you have to do 220mm/22/mm = 10
Also possible (and much more readable in my opinion) is 220mm/(22mm) = 10.
I would like to know if there is any reason to use the former over the latter, either performance or gotcha's.
If you want to do something like 220mm/22mm you get an error so you have to do 220mm/22/mm = 10
Also possible (and much more readable in my opinion) is 220mm/(22mm) = 10.
I would like to know if there is any reason to use the former over the latter, either performance or gotcha's.
Tagged:
0
Comments
There are no performance gotchas here -- it's the same (negligible compared to other calculations Onshape is doing, unless you're in a tight loop in FeatureScript, in which case that's a separate discussion). The only thing is that the floating point roundoff may be different between the two expressions; that roundoff error is thousands of times smaller than the size of an atom, but if you do a non-tolerant check, like (220mm/22/mm == 220mm/(22mm)), it may evaluate to false (and in this case it does).