Index of Functions: A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 
Index Page
cspice_intmax

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   CSPICE_INTMAX returns the value of the value of the largest
   (positive) number representable in a SpiceInt variable.

I/O


   The call:

      intmax = cspice_intmax( )

   returns:

      intmax   the value of the largest (positive) number that can be
               represented in an SpiceInt variable.

               help, intmax
                  LONG = Scalar

               The returned value will be greater than or equal
               to 2147483647.

Parameters


   None.

Examples


   Any numerical results shown for this example may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.

   1) Obtain the integer part of a double precision number. If the
      integer component of the number is out of range, avoid
      overflow by making it as large or small as possible.


      Example code begins here.


      PRO intmax_ex1

         ;;
         ;; Define a set of three numbers, two of them having an
         ;; integer component that is out of range.
         ;;
         number = [ 2.d40, -1.5d35, 1.6d0 ]

         for i=0L, 2L do begin

            print, 'Double precision number: ', number[i]

            ;;
            ;; If the integer component is out of range, avoid
            ;; overflow by making it as large as possible.
            ;;
            if ( number[i] gt DOUBLE( cspice_intmax() ) ) then begin

               print, '   Overflow! Greater than cspice_intmax.'
               ivalue = cspice_intmax()

            endif                                                            $
            else if ( number[i] lt DOUBLE( cspice_intmin() ) ) then begin

               print, '   Overflow! Smaller than cspice_intmin.'
               ivalue = cspice_intmin()

            endif else begin

               ivalue = LONG( number[i] )

            endelse

            print, '   Integer part        : ', ivalue
            print

         endfor

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      Double precision number:    2.0000000e+40
         Overflow! Greater than cspice_intmax.
         Integer part        :   2147483647

      Double precision number:   -1.5000000e+35
         Overflow! Smaller than cspice_intmin.
         Integer part        :  -2147483648

      Double precision number:        1.6000000
         Integer part        :            1


Particulars


   None.

Exceptions


   Error free.

Files


   None.

Restrictions


   None.

Required_Reading


   ICY.REQ

Literature_References


   [1]  "Programming in VAX FORTRAN", Digital Equipment Corporation,
        September 1984, Appendix C, FORTRAN Data Representation,
        page C-2.

   [2]  "Microsoft FORTRAN Reference", Microsoft Corporation
        1989, Section 1.3.1, page 10.

   [3]  "Sun FORTRAN Programmer's Guide, Sun Microsystems,
        Revision A of 6 May 1988, Appendix F, Manual Pages for
        FORTRAN, page 306 (RANGE).

   [4]  "Language Systems FORTRAN Reference Manual", Language
        Systems Corporation, version 1.2.1, page 3-2.

   [5]  "Lahey F77L EM/32 Programmers Reference Manual",
        version 4.0, page 95.

   [6]  "FORTRAN/9000 Reference HP 9000 Series 700 Computers",
        First Edition, June 1991, Hewlett Packard Company, page 4-4.

   [7]  "SGI Fortran 77 Programmer's Guide", Document number
        007-0711-030, page 2-2.

   [8]  "Language Reference Manual", Absoft Fortran V3.2, 1993,
        page 3-14, section 3.6.1.5. (for the NeXT)

   [9]  "Unix/VMS Compatibility Libraries", Absoft Fortran V3.2,
        1993; Chapter 3, Support Libraries, page 3-14, inmax.
        (for the NeXT)

Author_and_Institution


   J. Diaz del Rio     (ODC Space)
   E.D. Wright         (JPL)

Version


   -Icy Version 1.0.2, 10-AUG-2021 (JDR)

       Edited the header to comply with NAIF standard. Added complete
       code example from existing code fragment.

       Added -Parameters, -Exceptions, -Files, -Restrictions,
       -Literature_References and -Author_and_Institution sections.

       Removed reference to the routine's corresponding CSPICE header from
       -Abstract section.

       Added argument's type and size information in the -I/O section.

   -Icy Version 1.0.1, 09-DEC-2005 (EDW)

       Added -Examples section.

   -Icy Version 1.0.0, 16-JUN-2003 (EDW)

Index_Entries


   largest integer number



Fri Dec 31 18:43:05 2021