Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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.

round( ) function

tim_ashbytim_ashby Member Posts: 3 ✭✭
Is it possible to specify the number of decimal places that the round( ) function rounds to? The standard Excel format of round(number, dp) doesn't seem to work. Alternatively, is there a workaround?. Thanks!

Best Answer

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,310
    edited June 2016 Answer ✓
    round(value * 100) / 100 should do the trick (to 2 dp)
    Senior Director, Technical Services, EMEAI

Answers

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,310
    edited June 2016 Answer ✓
    round(value * 100) / 100 should do the trick (to 2 dp)
    Senior Director, Technical Services, EMEAI
  • patrick_farleypatrick_farley Member Posts: 37 ✭✭
    round() as now a value and a multiple.
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    @patrick_farley

    round(value, .01) is probably what you are looking for rather than round(value, 2):
    https://cad.onshape.com/FsDoc/library.html#round--
    Jake Rosenfeld - Modeling Team
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    You'll notice also in that documentation that value and multiple can also both be valueWithUnits, and the result will come out as a plain number (whose "unit" corresponds to the "multiple")
    Jake Rosenfeld - Modeling Team
Sign In or Register to comment.