Is it possible to create a double which holds the value of 1*10^x where x is based on a integer template parameter. So something like:
template < int exp >
struct DoubleValue
{
static constexpr double value = ????;
}
double d = DoubleValue<20>::value; // = 1e20
double d = DoubleValue<-20>::value; // = 1e-20
As it can be created with litterals, it seems that something like this should be possible.
I would like the value to be evaluated at compile time (so std::pow will not work as far as I know). Also, if possible, I would like to be able to avoid actual iterative computations ((maybe unfounded) fear for precision problems). I would also like to be able to use larger values as exponent, like for example 200, which makes it impossible to store the value in a standerd integer type.