Overflows and underflows can be an issue in some calculations (such as calculating the probability of phylogenetic data). There are arbitrary precision libraries (notably GMP), but sometimes the use of them may be overkill. I made a "Superdouble" class consisting of a single header file. An object of that class is basically a number in scientific notation (i.e., 5.2 x 10^28), where the mantissa (5.2 in the example) is a long double and the exponent (28) is an integer. This allows the number to have the same precision as a long double but have an exponent that can take values much greater in magnitude than for a normal long double, dramatically reducing the chance of overflow or underflow. Basic operators (<<, , +, -, /, +=, =, -=, /=, ++, --) and natural log have all been written to work without requiring conversion back to double. There are also functions to convert from and to double.
I'm a biologist not trained in computer science, so the code is naively-written though useful. If you have suggestions to improve it, please contact me (firstname.lastname@example.org) and perhaps sign up as a developer.
These details are provided for information only. No information here is legal advice and should not be used as such.