I think I got it.

I just checked if the value was less than zero then if it was set it to negative value so example:

diff = -diff

that seemed to work.

173

I think I got it.

I just checked if the value was less than zero then if it was set it to negative value so example:

diff = -diff

that seemed to work.

6

OK I need to know the difference between two numbers. This is easy when I need to know the difference by subtracting the smaller number from the larger number however there are many cases where I need to know the difference of the numbers when I need to subtract the smaller number from the larger number. What would be the simplest way to convert a number that ends up being negative to a positive number. Example: the difference is -26 so I want it to be converted to 26.

I will have to run an if statement to check if its negative and run the operation, I assume, unless there is an easier way.

Hi Sir

Did you try **uint ??**

The unsigned integer type is uint. It takes 4 bytes of memory and allows expressing integers from 0 to 4 294 967 295.

or write a little method, something like :

int MathUnsignedInt(int value) { if(value<0) { return value * -1; } return value; }

2143

OK I need to know the difference between two numbers. This is easy when I need to know the difference by subtracting the smaller number from the larger number however there are many cases where I need to know the difference of the numbers when I need to subtract the smaller number from the larger number. What would be the simplest way to convert a number that ends up being negative to a positive number. Example: the difference is -26 so I want it to be converted to 26.

I will have to run an if statement to check if its negative and run the operation, I assume, unless there is an easier way.

173

MathAbs()

I saw the MathAbs() function but wasn't sure what it actually did. The description seemed a bit cryptic to me. This will make a negative number a positive number?

OK I need to know the difference between two numbers. This is easy when I need to know the difference by subtracting the smaller number from the larger number however there are many cases where I need to know the difference of the numbers when I need to subtract the smaller number from the larger number. What would be the simplest way to convert a number that ends up being negative to a positive number. Example: the difference is -26 so I want it to be converted to 26.

I will have to run an if statement to check if its negative and run the operation, I assume, unless there is an easier way.