Thread: <math> and <cmath>

  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,210
    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::.

    http://cboard.cprogramming.com/showthread.php?t=86711

Popular pages Recent additions subscribe to a feed