At least one important difference is that <cmath> evolves as the C++ language evolves, while <math.h> is relatively stagnant and would only be updated when the C++ language is updated to reference a more up-to-date C standard library.
By this I mean, the following probably won't compile:
1 2 3 4 5 6 7
|
// Example program
#include <math.h>
int main()
{
std::round(4.2);
}
|
6:3: error: 'round' is not a member of 'std' |
This, however, will compile:
1 2 3 4 5 6 7
|
// Example program
#include <cmath>
int main()
{
std::round(4.2);
}
|
std::round is a C++11 feature, and is properly part of the std namespace in <cmath>, but is not part of the std namespace in <math.h>. C has its own, non-namespaced (obviously) version of round:
https://en.cppreference.com/w/c/numeric/math/round (the functionality I assume is the same)
Theoretically, the .h files could eventually be deprecated, but realistically, they will stick around for backwards compatibility. There's no reason to use them in new code, however.