Table of contents
CSPICE_INTMIN returns the value of the smallest
(negative) number representable in a SpiceInt variable.
The call:
intmin = cspice_intmin( )
returns:
intmin the value of the smallest (negative) number that can be
represented in an SpiceInt variable.
help, intmin
LONG = Scalar
The returned value will be less than or equal to
-2147483647.
None.
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 intmin_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
None.
Error free.
None.
None.
ICY.REQ
[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)
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.3, 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.2, 23-SEP-2008 (EDW)
Eliminated error in English.
-Icy Version 1.0.1, 09-DEC-2005 (EDW)
Added -Examples section.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
smallest integer number
|