Advanced math in precompiling?

Hi, is there a possibility to use advanced math functions during the pre-compiling? For example, I have defined D_TYPE, currently to unsigned int, D_BITS to (sizeof(D_TYPE)*8), then I want to have a macro named BASE, which is the largest potens of 10, below 2^(D_BITS -1) - 1 (where ^ is the power function), or (the maximum value D_TYPE can accept)/2. So, using mathematical functions it would be something like 10^(floor(log(D_TYPE_MAX/2))). And the floor(log(D_TYPE_MAX/2)) part of the macro definition could be another macro called B_DIGITS, so that BASE is defined as 10^B_DIGITS (^ is not xor this time either).