Jump to content

Talk:C mathematical functions

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 74.194.24.44 (talk) at 09:27, 20 September 2009. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
WikiProject iconC/C++ Unassessed
WikiProject iconThis article is within the scope of WikiProject C/C++, a collaborative effort to improve the coverage of C and C++ topics on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
???This article has not yet received a rating on Wikipedia's content assessment scale.
???This article has not yet received a rating on the importance scale.

C99 functions.

Should the C99 math.h functions be included here as well? E.g. fabsf, fabsl, etc. These functions all deal with floats and long doubles -- cmath is not required for that. --204.69.182.1 17:42, 28 July 2006 (UTC)[reply]

Done. Alksentrs (talk) 23:50, 28 September 2008 (UTC)[reply]

C++?

C++'s cmath is different from math.h. In particular, cmath puts the functions in the std namespace and uses overloading so that abs(-1.0) does the Right Thing rather than requiring the user to call fabs(-1.0) for doubles and abs(-1) for integers. The page should reflect that. —Ben FrantzDale (talk) 17:46, 23 November 2008 (UTC)[reply]

You are correct. The C++ cmath does not define all of the functions from C99, plus it has abs, div, labs, and ldiv functions. In addition C++ overloads the math functions so they are type generic. In effect the libraries are similar on the surface but are actually completely different. This may not have obvious consequences to your everyday programmer but I think the article needs to reflect this. Unfortunately I cannot point to a source that gives a good rundown of the differences. 74.194.24.44 (talk) 09:27, 20 September 2009 (UTC)[reply]