online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <cmath> #include <iostream> #include <limits> #include <string_view> template <typename T> constexpr uint32_t bitsInExponent() { static_assert(std::numeric_limits<T>::is_iec559); return std::ceil(std::log2(std::numeric_limits<T>::max_exponent-std::numeric_limits<T>::min_exponent+1)); } // outputs 15 for long double on my machine/compiler template <typename T> constexpr uint32_t bitsInMantissa() { static_assert(std::numeric_limits<T>::is_iec559); return std::numeric_limits<T>::digits-1; } // outputs 63 for long double on my machine/compiler template <typename T> constexpr uint32_t bitsInSign() { return 1; } template <typename T> void printFpInfo(const std::string_view& name) { std::cout << name << " => mant: " << bitsInMantissa<T>() << " exp: " << bitsInExponent<T>() << " footprint: " << sizeof(T)*8 << std::endl; } int main() { printFpInfo<float>("float"); printFpInfo<double>("double"); printFpInfo<long double>("long double"); return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue