<math> and <cmath>

This is a discussion on <math> and <cmath> within the C++ Programming forums, part of the General Programming Boards category; Is there a difference between <math> and <cmath>? Thanks...

  1. #1
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485

    <math> and <cmath>

    Is there a difference between <math> and <cmath>?

    Thanks

  2. #2
    Registered User
    Join Date
    Oct 2004
    Posts
    151
    Yes.

    The latter is a C++ header file for accessing the functions in the mathematics library.

    The former does not exist.
    System: Debian Sid and FreeBSD 7.0. Both with GCC 4.3.

    Useful resources:
    comp.lang.c FAQ | C++ FQA Lite

  3. #3
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Nicely put.

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    835
    Assuming the OP meant to compare <math.h> and <cmath>, the thread below talks about the difference between <xxxx.h> and <cxxxx>. Basically, in C++ you should use the latter version and qualify the appropriate symbols with std::.

    std namespace and headers

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21