Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Negative Number

Status
Not open for further replies.

cabobound

Programmer
Jul 11, 2007
80
US
How do I convert the sign of a number?
 
If you want to change the sign of a number, you can multiply by -1.

MyVariable = -1 * MyVariable

If you want your value to always be positive...

MyVariable = Abs(MyVariable)

If you want your value to always be negative...

MyVariable = -1 * Abs(MyVariable)

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
HA! I have been doing so much formulated math I forgot the simplest thing! Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top