Re: Float output formatting options

Поиск
Список
Период
Сортировка
От Pedro M. Ferreira
Тема Re: Float output formatting options
Дата
Msg-id 3DC6B804.7010705@ualg.pt
обсуждение исходный текст
Ответ на Float output formatting options  ("Pedro M. Ferreira" <pfrazao@ualg.pt>)
Ответы Re: Float output formatting options  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane wrote:

> BTW, did you check to see if this affects the geometric types or not?
> I am not sure that they go through float8out; they may need similar
> adjustments in their output routines.

In fact they need adjustments.

The *_out routines (in src/backend/utils/adt/geo_ops.c) for the 
geometric types rely on two functions to output data:

static int      pair_encode(float8 x, float8 y, char *str);
static int      single_encode(float8 x, char *str);

These functions produce output with (for pair_encode):

sprintf(str, "%.*g,%.*g", digits8, x, digits8, y);

digits8 is defined as ,

#define P_MAXDIG DBL_DIG
static int      digits8 = P_MAXDIG;

I think it would be done the same way as for float4_out and float8_out:

extern int extra_float_digits;


int 
ndig = digits8 + extra_float_digits;

if (ndig < 1)ndig = 1;

sprintf(str, "%.*g,%.*g", ndig, x, ndig, y);

There a bunch of other places where output is produced. They are all 
within #ifdef GEODEBUG / #enfif blocks. Should these be corrected the 
same way ?

Regards,
Pedro



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Marc G. Fournier"
Дата:
Сообщение: v7.3Beta4 Tag'd and Packaged ...
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Float output formatting options