fork download
  1. #include <cmath>
  2. #include <iostream>
  3. #include <iomanip>
  4. #include <limits>
  5.  
  6. using namespace std;
  7.  
  8. template <typename T>
  9. constexpr auto integral_digits10 = static_cast<int>(log10(numeric_limits<T>::max())) + 1;
  10.  
  11. int main() {
  12. cout << integral_digits10<double> << endl << numeric_limits<double>::digits10 << endl;
  13. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
309
15