<config.h> should go first, then the include for the header corresponding to the file (i.e. "api_weight.h" in this case), as that helps to ensure that "api_weight.h" is including all the headers it needs.  If you put <cmath> first, "api_weight.h" could be relying on that, and we wouldn't know.  That's bad because it means future changes not involving "api_weight.h" could require changes to it.