machar, a Python code which dynamically computes constants that characterize the floating point arithmetic system on a computer, by William Cody.
The constants include the value of the "machine epsilon", the smallest number that can be added to 1 and make a difference. However, it includes many other quantities of interest, including the arithmetic base, the largest and smallest magnitudes, and so on.
Many compilers now do certain kinds of optimization that may cause MACHAR to fail. The most noticeable symptom is that MACHAR may fall into an infinite loop. If you notice this, recompile MACHAR with compiler optimization turned off, or set to the lowest level. (This should not be a problem when using Python.)
The information on this web page is distributed under the MIT license.
machar is available in a C version and a C++ version and a Fortran77 version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.
machine, a Python code which stores the appropriate values of machine constants for a given machine.
Original Fortran77 version by William Cody. This version by John Burkardt.