PostGIS  2.1.10dev-r@@SVN_REVISION@@
static int lwprint_double ( double  d,
int  maxdd,
char *  buf,
size_t  bufsize 
)
static

Definition at line 682 of file lwout_geojson.c.

References OUT_MAX_DOUBLE, and OUT_MAX_DOUBLE_PRECISION.

Referenced by pointArray_to_geojson().

683 {
684  double ad = fabs(d);
685  int ndd = ad < 1 ? 0 : floor(log10(ad))+1; /* non-decimal digits */
686  if (fabs(d) < OUT_MAX_DOUBLE)
687  {
688  if ( maxdd > (OUT_MAX_DOUBLE_PRECISION - ndd) ) maxdd -= ndd;
689  return snprintf(buf, bufsize, "%.*f", maxdd, d);
690  }
691  else
692  {
693  return snprintf(buf, bufsize, "%g", d);
694  }
695 }
#define OUT_MAX_DOUBLE_PRECISION
#define OUT_MAX_DOUBLE

Here is the caller graph for this function: