Available Numbers

The largest (and smallest) numbers that you can represent depend on the machine (chip set) that you are using, the compiler that you are using, and the data type (single precision, double precision, or integer). Follow these steps to discover the values most relevant to your needs:

  1. Select your target machine, target compiler (if several are available), and data type (single, double, integer).
  2. Log on to the target machine.
  3. Run any Web browser and supply the open or secure URL for LINMath, LC's online math software source.
    • On the LINMath home page, scroll down to the bottom, to the "GAMS Master Index" and select Category R (Service Routines).
    • On the page that arrives next, select R1 (Machine-dependent constants).
    • On the page that arrives next, select the MSSL3 library.
      Warning: LINMath will also offer you routines in the SLATEC library, but avoid those. The SLATEC largest/smallest reporting routines have internal flaws that make them obsolete and unreliable on current LC machines.
    • On the page that arrives next (MSSL3), select from these three routines those that meet your needs:
      R0MACH for single precision
      D0MACH for double precision
      I0MACH for integer values

    When commented source code (Fortran, with a C version imbedded in the comments) for each routine displays, save it to a file by using your browser's File menu.

  4. On your target machine and compiler, compile and run a test code invoking the MSSL3 routine that reports current local information on the data type of interest to you, where

    R = R0MACH(1) reports the smallest positive magnitude.
    R = R0MACH(2) reports the largest positive magnitude.
    R = R0MACH(3) reports the smallest relative spacing.
    R = R0MACH(4) reports the largest relative spacing.
    R = R0MACH(5) reports the log10 of the arithmetic base (usually 2).

    D = D0MACH(1) through D0MACH(5)
        reports same as R0MACH except double precision.

    I = I0MACH(9) reports the largest integer magnitude.
    I = I0MACH(12) reports the smallest exponent (single precision).
    I = I0MACH(13) reports the largest exponent (single precision).
    I = I0MACH(15) reports the smallest exponent (double precision).
    I = I0MACH(16) reports the largest exponent (double precision).
        (other integer values can also be reported)