7 Replies Latest reply on Jun 11, 2013 11:12 AM by Peter Kahrel

    Which of 2 numbers are closest to 0

    myDavey Level 1


      Although this might be a general question, I would like to seek some help from the forum.


      I am running a script and I have a function which receives 2 numbers (variables)

      I would like to know which of the 2 is closest to 0

      I.e., if the numbers are 5, -2 = -2 is closer etc.


      Is there someone who can offer some method or function that can help me with this.

      (I made 2 loops that counts how many times it took the number to get to 0

      but I believe there is a better way.)