Monday, March 26, 2012

VS 2003 Formula Problem surpressing a negative number.

I have created an expression which is simple math. The problem is i am a rookie and trying to surpress any results that are a negative number? Any suggestion

Depends on what you want to do. If you want to force a negative result to 0, use

int someval = origval < 0 ? 0 : origval;

If you want the absolute value, then the Math.Abs() function will do that, however if your input value is an int it will be converted to a double.

0 comments:

Post a Comment