Link to home
Start Free TrialLog in
Avatar of rigidigital
rigidigital

asked on

how do i disregard the sign of an integer when comparing ?

how do i disregard the sign of an integer when comparing ?  C#.
ASKER CERTIFIED SOLUTION
Avatar of hongjun
hongjun
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Use the Math.Abs function.
This function will do a absolute and return you positive number.

hongjun
Depending on your data and what you  are doing, the standard mathematical way of doing this may be better ... compare the squares of the numbers.
http:#19587945 is good enough.