/****************************************************************************** * This program demonstrates floating point underflow. * * Copyright © 2020 Richard Lesh. All rights reserved. *****************************************************************************/ #undef NDEBUG #include #include #include #include std::locale utf8loc(std::locale(), new std::codecvt_utf8); using namespace std; int main(int argc, char **argv) { setlocale(LC_ALL, "en_US.UTF-8"); wcout.imbue(utf8loc); wcin.imbue(utf8loc); double small_float = 1e-308; wcout << L"Small float: " << small_float << endl; small_float /= 1e12; wcout << L"Smaller float: " << small_float << endl; small_float /= 1e12; wcout << L"Smallest float: " << small_float << endl; return 0; }