Re: Float output formatting options

From: "Pedro M(dot) Ferreira" <pfrazao(at)ualg(dot)pt>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Float output formatting options
Date: 2002-11-04 18:51:42
Message-ID: 3DC6C1BE.4060707@ualg.pt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> "Pedro M. Ferreira" <pfrazao(at)ualg(dot)pt> writes:
>
>>Is it ok to remove #define P_MAXDIG DBL_DIG,
>>change P_MAXLEN to 2*(DBL_DIG+7)+1) and
>>remove the line 'static int digits8 = P_MAXDIG;' ?
>
> Perhaps P_MAXLEN now needs to be (2*(DBL_DIG+2+7)+1), considering
> that we'll allow extra_float_digits to be up to 2. What's it used for?

Yes. I guess so, because it is used in what I think is a memory
allocation function. P_MAXLEN is only used twice:

* 1st use in path_encode() (allmost all the geo *_out functions use
path_encode):

int size = npts * (P_MAXLEN + 3) + 2;

/* Check for integer overflow */
if ((size - 2) / npts != (P_MAXLEN + 3))
elog(ERROR, "Too many points requested");

* 2nd use in circle_out(PG_FUNCTION_ARGS):

result = palloc(3 * (P_MAXLEN + 1) + 3);

I will do the changes tomorrow and send in the appropriate diff's.

Regards,
Pedro

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2002-11-04 19:25:00 Re: ipc-daemon
Previous Message Tom Lane 2002-11-04 18:38:54 Re: Float output formatting options