brcktd_c |

Table of contents## Procedurebrcktd_c ( Bracket a d.p. value within an interval ) SpiceDouble brcktd_c ( SpiceDouble number, SpiceDouble end1, SpiceDouble end2 ) ## AbstractBracket a double precision 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.) ## Required_ReadingNone. ## KeywordsINTERVALS NUMBERS UTILITY ## Brief_I/OVARIABLE 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. ## Detailed_Inputnumber 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. ## Detailed_OutputThe function returns the bracketed number. That is `number', if it was already in the interval provided. Otherwise the returned value is the nearest bound of the interval. ## ParametersNone. ## ExceptionsError free. ## FilesNone. ## ParticularsThis routine provides a shorthand notation for code fragments like the following: if ( end1 < end2 ) { if ( number < end1 ) { number = end1; } else if ( number > end2 ) { number = end2; } } else { if ( number < end2 ) { number = end2; } else if ( number > end1 ) { number = end1; } } which occur frequently during the processing of program inputs. ## ExamplesThe numerical results shown for these examples may differ across platforms. The results depend on the SPICE kernels used as input, the compiler and supporting libraries, and the machine specific arithmetic implementation. 1) The following code example illustrates the operation of ## RestrictionsNone. ## Literature_ReferencesNone. ## Author_and_InstitutionN.J. Bachman (JPL) J. Diaz del Rio (ODC Space) B.V. Semenov (JPL) W.L. Taber (JPL) I.M. Underwood (JPL) E.D. Wright (JPL) ## Version-CSPICE Version 1.1.0, 08-AUG-2021 (JDR) (BVS) BUG FIX: corrected to make the order of endpoints not important as stated in the description. Edited the header to comply with NAIF standard. Added complete code examples based on existing fragments. Updated code fragment in -Particulars to show that the order of endpoints is not important. -CSPICE Version 1.0.1, 11-NOV-2006 (EDW) Added "None." text to -Keywords section, required for API doc script (cspicehtml.pl) integrity checks. -CSPICE Version 1.0.0, 16-AUG-1999 (NJB) (WLT) (IMU) ## Index_Entriesbracket a d.p. value within an interval |

Fri Dec 31 18:41:02 2021