#ifndef frb_proc_H #define frb_proc_H /* Useful miscellaneous functions. */ /* Last edited on 2005-01-16 14:43:51 by stolfi */ /* Copyright © 2005 Universidade Estadual de Campinas. See note at end of file. */ int frb_imax ( int A, int B ); int frb_imin ( int A, int B ); /* Maximum and minimum for {int}s. */ double frb_dmax ( double A, double B ); double frb_dmin ( double A, double B ); /* Maximum and minimum for {double}s. */ int frb_imod ( int A, int B ); /* Mathematical remainder of {A} by {B}. Requires {B>0} and returns result in {[0..B-1]} even when {A} is negative. */ int frb_round ( double x ); void frb_reduce_to_period ( double *t, /* IO */ double tLo, double tHi, int *k /* OUT */ ); /* Reduces {*t} to the range {[tLo _ tHi)} by adding to it some integer multiple {kk} of {tHi - tLo}. Returns {kk} in {*k}. */ double frb_adjust_unit ( double givenUnit, double dev, double big ); /* Adjusts the {givenUnit} for quantization of a variable whose standard deviation is {dev} and whose values range in {[-big..+big]}. Will increase {givenUnit} if needed to avoid overflow, or decrease it to ensure quantization errors less than dev*10^-6. In any case, if {givenUnit} is changed, or no good unit was found, also prints a warning to {stderr}. */ #endif /* COPYRIGHT AND AUTHORSHIP NOTICE Copyright © 2005 Universidade Estadual de Campinas (UNICAMP). Created by Helena C. G. Leitão and Jorge Stolfi in 1995--2005. This source file can be freely distributed, used, and modified, provided that this copyright and authorship notice is preserved in all copies, and that any modified versions of this file are clearly marked as such. This software has NO WARRANTY of correctness or applicability for any purpose. Neither the authors nor their employers shall be held responsible for any losses or damages that may result from its use. END OF NOTICE */