Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.stsci.edu/~sontag/spicedocs/cspice/brckti_c.html
Дата изменения: Sat Dec 17 06:08:31 2005 Дата индексирования: Sun Apr 10 23:57:30 2016 Кодировка: Поисковые слова: http astrokuban.info astrokuban |
Bracket a number. That is, given a number and an acceptable interval, make sure that the number is contained in the interval. (If the number is already in the interval, leave it alone. If not, set it to the nearest endpoint of the interval.)
None.
VARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- number I Number to be bracketed. end1 I One of the bracketing endpoints for number. end2 I The other bracketing endpoint for number. The function returns the bracketed number.
number is the number to be bracketed. That is, the value of number is constrained to lie in the interval bounded by end1 and end2. end1, end2 are the lower and upper bounds for number. The order is not important.
The function returnes the input number, if it was already in the interval provided. Otherwise the returned value is the nearest bound of the interval.
None.
This routine provides a shorthand notation for code fragments like the following #include "SpiceUsr.h" . . . if ( number < end 1 ) { number = end1; } else if ( number > end2 ) { number = end2; } which occur frequently during the processing of program inputs.
The following illustrates the operation of brckti_c. brckti_c ( -1, 1, 10 ) = 1.0; brckti_c ( 29, 1, 10 ) = 10.0; brckti_c ( 3, -10, 10 ) = 3.0; brckti_c ( 3, -10, -1 ) = -1.0; The following code fragment illustrates a typical use for brckti_c. #include "SpiceUsr.h" . . . /. Number of time steps must be in the range 1-10. ./ prompt_c ( "Enter number of time steps > ", 80, nStr ); prsint_c ( nStr, &n ); nstep = brckti_c ( n, 1, 10 );
None.
Error free.
None.
N.J. Bachman (JPL) W.L. Taber (JPL) I.M. Underwood (JPL)
None.
-CSPICE Version 1.0.0, 16-AUG-1999 (NJB) (WLT) (IMU)
bracket an integer value within an interval