Typecast

Greg Olsen golsen at larix.unl.edu
Fri May 13 11:47:40 EDT 1994


 
Jurg,

I am not sure exactly what you need.  But if all you need is to 
round a float off to the nearest integer, then there is

#include <math.h>

int nint(x);
double x;

nint returns an integer from a double or float rounding up at 0.5
otherwise truncating.

Happy trails,
-----------------------------------------------------------
Greg Olsen
Department of Forestry, Fisheries and Wildlife
University of Nebraska
Lincoln, NE 68583-0814
Phone: 402-472-9869
e-mail: golsen at unlinfo2.unl.edu
-----------------------------------------------------------




More information about the grass-dev mailing list