Pure Programmer
Blue Matrix


Cluster Map

Project: Floating Point Underflow

Write a program to print the positive floating point value closest to 0 that is possible to represent accurately with [[IEEE doubles]]. Also print a value slightly closer to show that it becomes 0. Does the language produce an error or simply a warning on underflow?

Output
$ g++ -std=c++17 FloatingPointUnderflow.cpp -o FloatingPointUnderflow -lfmt $ ./FloatingPointUnderflow Small float: 1e-308 Smaller float: 9.99989e-321 Smallest float: 0

Solution