1 /* 2 * This software is copyrighted as noted below. It may be freely copied, 3 * modified, and redistributed, provided that the copyright notice is 4 * preserved on all copies. 5 * 6 * There is no warranty or other guarantee of fitness for this software, 7 * it is provided solely "as is". Bug reports or fixes may be sent 8 * to the author, who may or may not act on them as he desires. 9 * 10 * You may not include this software in a program or other software product 11 * without supplying the source, or without informing the end-user that the 12 * source is available for no extra charge. 13 * 14 * If you modify this software, you should include a notice giving the 15 * name of the person performing the modification, the date of modification, 16 * and the reason for such modification. 17 */ 18 /* round.h, 7/2/85, T. McCollough, UU */ 19 20 /* need <math.h> */ 21 22 #define round(x) (int) floor((x)+0.5) 23 24 /* use round_positive() only if argument is positive */ 25 26 #ifdef vax 27 /* if we are on a vax, then 28 make use of the fact that 29 vaxen truncate when they 30 convert from float (double) 31 to int */ 32 33 #define round_positive(x) (int) ((x)+0.5) 34 #else 35 /* we're not on a vax, so make 36 no such assumption */ 37 38 #define round_positive(x) round(x) 39 #endif 40