By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,130 Members | 1,365 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,130 IT Pros & Developers. It's quick & easy.

About head files for abs?

P: n/a
Hi,

I notice that there are a lot of abs definitions in old C hearder or
C++ headers or STL, overloading version or template version. I'm very
confusing. I'm wondering which header file is the most appropriate
version I should use, if I want to use abs for int, double, complex,
etc.? Thanks!

Best wishes,
Peng

Aug 3 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Pe*******@gmail.com wrote:
I notice that there are a lot of abs definitions in old C hearder or
C++ headers or STL, overloading version or template version. I'm very
confusing. I'm wondering which header file is the most appropriate
version I should use, if I want to use abs for int, double, complex,
etc.? Thanks!


You should use <cstdlib> for 'int' and 'long' versions of 'abs' and
<cmath> for all FP versions of 'abs', and <complex> for complex 'abs'.

Also, use 'std::abs' or add 'using std::abs;' to your files.

V
Aug 3 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.