Index Page intmin_c
A B C D E F G H I J K L M N O P Q R S T U V W X
Procedure Abstract Required_Reading Keywords Brief_I/O Detailed_Input | Detailed_Output Parameters Exceptions Files Particulars Examples | Restrictions Literature_References Author_and_Institution Version Index_Entries
#### Procedure
       SpiceInt intmin_c ()
#### Abstract
       Return the value of the smallest (negative) number representable
       in a SpiceInt variable.
#### Required_Reading
       None.
#### Keywords
       CONSTANTS
#### Brief_I/O
       The function returns the value of the smallest (negative) number
       that can be represented in a SpiceInt variable.
#### Detailed_Input
       None.
#### Detailed_Output
       The function returns the value of the smallest (negative) number
       that can be represented in an SpiceInt variable, where SpiceInt
       is a typedef defined in SpiceZdf.h.

       The returned value will be less than or equal to -2147483647.
       See the Particulars section for details.
#### Parameters
       None.
#### Exceptions
       Error free.
#### Files
       None.
#### Particulars
       The typedef SpiceInt is used throughout the CSPICE API to refer to
       integers; the precise type of integer is platform-dependent.  A
       SpiceInt always maps to the same type as does the f2c typedef
       integer.

       When translating Fortran code, f2c maps Fortran variables of type
       INTEGER to C variables of type "integer," where integer is a typedef
       defined in the f2c header file f2c.h.  On all supported platforms,
       Fortran INTEGERS occupy at least 32 bits.  On most platforms, this
       means that the typedef integer translates to type long.  There are
       some exceptional platforms on which an integer translates to type
       int.  The mapping must provide compatibility with the f2c typedef
       doublereal:  integers must occupy half the storage of doublereals in
       order for these types to correctly represent the Fortran types
       INTEGER and DOUBLE PRECISION.

       On systems where the typedef integer maps to type long, the return
       value is defined by the macro LONG_MIN from the ANSI standard header
       file limits.h. According to the ANSI standard, LONG_MIN must be no
       greater than

          -2147483647

       This is

               31
          - ( 2   - 1 )

       On systems where the typedef integer maps to type int, the value is
       defined by the macro INT_MIN from the ANSI standard header file
       limits.h. According to the ANSI standard, INT_MIN must be no greater
       than

          -32767

       This is

              15
          -( 2   - 1 )

       In practice however, the typedef integer will map to type int only
       if ints occupy at least four bytes, so the value of INT_MIN will
       actually be no greater than -2147483647.
#### Examples
       The following code fragment illustrates the use of intmin_c.

          /.
          Separate a double into integer and fractional components.
          If the integer component is out of range, avoid overflow
          by making it as large as possible.
          ./
          #include <math.h>
                   .
                   .
                   .
          fract = modf ( dvalue, &integralDP );

          if (  integralDP  >  (double)intmax_c()  )
          {
             ivalue = intmax_c();
          }
          else if (  integralDP  <  (double)intmin_c()  )
          {
             ivalue = intmin_c();
          }
          else
          {
             ivalue = (long)( integralDP );
          }
#### Restrictions
       None.
#### Literature_References
       None.
#### Author_and_Institution
       N.J. Bachman    (JPL)
       W.L. Taber      (JPL)
       I.M. Underwood  (JPL)
#### Version
       -CSPICE Version 1.0.0, 29-JAN-1999 (NJB)
#### Index_Entries
       smallest integer number
#### Link to routine intmin_c source file intmin_c.c

    Wed Jun  9 13:05:25 2010