You should first have <config.h> (as you do), then the header corresponding to the source file (so "api_weight.h" as this is "api_weight.cc").  Any other headers required should come **after** these two.  HACKING gives a full preferred order for header includes, though the full order is not currently used consistently everywhere in the code, as we haven't yet updated all the code which predates coming up with the order.

The main benefit of putting the header corresponding to the .cc file first in that file is that it means every such header is included first (ignoring config.h, which is a special case) somewhere in the source tree, and because of that we'll definitely notice if api_weight.h grows a dependency on <cmath> (or any other header), as the code won't compile until we include the required header from api_weight.h.