Check the disassembly, and you'll likely find that the compiler is optimizing the call to log()
out entirely in the first case (so there's nothing to link), but not in the second. In this particular case, glibc defines:
# define M_LN10 2.30258509299404568402
in math.h
, for instance, and any standard library function can be implemented as a macro, so it can calculate some of these things without a function call.