What is different in c++?! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is different in c++?!

what is different between <cmath> and <math> ???

15th Sep 2017, 9:45 AM
Ahmed Salah El-Kholy
Ahmed Salah El-Kholy - avatar
3 Answers
+ 24
[cmath] defines symbols in theĀ stdnamespace, and may also define symbols in the global namespace. [math.h] defines symbols in the global namespace, and may also define symbols in theĀ stdnamespace. if you include the former and use an unqualified symbol, it may compile with one compiler but not with another. therefore it's a good idea to use [math.h]. and in general, for such header pairs, to use the [.h] version. @StackOverflow
15th Sep 2017, 9:49 AM
Nithiwat
Nithiwat - avatar
+ 13
is there a <math> isn't it <math.h> one is a c header <math.h> one is a c++ header <cmath> other than that I think the core functionality is the same. Be interested to see if I am incorrect šŸ˜€
15th Sep 2017, 9:48 AM
jay
jay - avatar
15th Sep 2017, 10:08 AM
Hatsy Rei
Hatsy Rei - avatar