10 Replies Latest reply on Sep 25, 2009 6:38 PM by Jerry Steiger

    Round Specifics of Equations, workaround needed

    Andrew Warren

      This discussion centers around the results of a divide operation and rounding numbers that are x.50 exactly.

       

       

      I was able to find out by trial-and-error that the Round() function in the Solidworks Equation dialog uses the common statistical rounding rules : If the number is even (4.50, 6.50, etc), it will round down whereas if it is an odd integer, it will round up (15.5 -> 16).

       

      I am writing an equation and I need it to always have it round up if it is x.50.  Is there another function that will do this?  I have tried just regular dividing, which will always round down to the nearest INT and I have tried INT() which doesn't seem to work either.

       

      Here are some real examples from my equations, their actual results, and what they calculate to with the different functions I have tried so far.

       

      Ex1 (Odd-numbered Example)

      ( 1.5 * 15 + 1 - 0.25 ) / 1.5 = ??

      Actual Result : 15.5

      INT(( 1.5 * 15 + 1 - 0.25 ) / 1.5) = 15

      Round(( 1.5 * 15 + 1 - 0.25 ) / 1.5) =16

       

      Ex2 (Even-numbered Example)

      ( 1 * 12 + 1 - 0.25 ) / 1.5 = ??

      Actual Result : 8.5

      INT(( 1 * 12 + 1 - 0.25 ) / 1.5) = 8

      Round(( 1 * 12 + 1 - 0.25 ) / 1.5) = 8

       

       

       

      SW2009SP4.1, but I imagine this is the same across versions