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

Definition at line 695 of file lwout_geojson.c.

References OUT_MAX_DOUBLE, and OUT_MAX_DOUBLE_PRECISION.

Referenced by pointArray_to_geojson().

696 {
697  double ad = fabs(d);
698  int ndd = ad < 1 ? 0 : floor(log10(ad))+1; /* non-decimal digits */
699  if (fabs(d) < OUT_MAX_DOUBLE)
700  {
701  if ( maxdd > (OUT_MAX_DOUBLE_PRECISION - ndd) ) maxdd -= ndd;
702  return snprintf(buf, bufsize, "%.*f", maxdd, d);
703  }
704  else
705  {
706  return snprintf(buf, bufsize, "%g", d);
707  }
708 }
#define OUT_MAX_DOUBLE_PRECISION
#define OUT_MAX_DOUBLE

Here is the caller graph for this function: