absolute value of a integer

  • Thread starter Thread starter Brian Henry
  • Start date Start date
B

Brian Henry

Is there a way to get an absoulte value of a 32bit signed integer? I noticed
Math.abs is an 8-bit integer, but i need the absoulte value of a larger
number. thanks!
 
The math.abs function is overloaded. You can pass in any of the following
types and a number OF THAT TYPE is returned
long
short
single
double
sbyte
integer
decimal

Overloading allows the compiler to chose the correct function based upon the
type of the value passed in.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
 
Brian Henry said:
Is there a way to get an absoulte value of a 32bit signed integer? I
noticed Math.abs is an 8-bit integer, but i need the absoulte value of a
larger number.

'Math.Abs' is overloaded, and there is one overload that takes an 'Int32'
and returns an 'Int32'.
 
thanks didin't notice that... was relying on intellisense too much for what
it returned and forgot about overloading
 
Brian Henry said:
thanks didin't notice that... was relying on intellisense too much for
what it returned and forgot about overloading

If you are using VS.NET, there is a small arrow shown in the intellisense
tooltip if overloads exist. You can use the up and down keys to switch
between the overloaded versions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top