Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
General

General

How to round the value of an expression to a specified decimal value

    • FAQFAQ
      Participant

      The value of an expression can be rounded to a specified decimal value by using the mod() function. This is shown below where the arbitrary expression TestValue is rounded to four decimal places using the expression RoundTestValue. Note that the expression RoundTestValue will need to be modified when rounding an expression with units. LIBRARY: CEL: EXPRESSIONS: DecimalValue = 0.0001 RoundTestValue = TestValue +DecimalValue/2 – mod(TestValue+DecimalValue/2, DecimalValue) TestValue = 1.12445745 END END END