Re: Float output formatting options - Mailing list pgsql-hackers

From Pedro M. Ferreira
Subject Re: Float output formatting options
Date
Msg-id 3DC691CE.6070408@ualg.pt
Whole thread Raw
In response to Float output formatting options  ("Pedro M. Ferreira" <pfrazao@ualg.pt>)
Responses Re: Float output formatting options  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> "Pedro M. Ferreira" <pfrazao@ualg.pt> writes:
> 
>>int extra_float4_digits, default 0, min -4, max 2
>>int extra_float8_digits, defualt 0, min -13, max 2
> 
> 
> I think a single setting extra_float_digits would be sufficient.

Ok. Assuming,

int extra_float_digits, default 0, min -13, max 2

If extra_float_digits==-13 and we are outputing a float4 this results in 
a negative value for FLT_DIG+extra_float_digits. I dont know if 
sprintf's behaviour is the same across different libraries for this 
situation.

Should I include the following to handle this case ?

if(extra_float_digits<-4)  sprintf(ascii, "%.*g", FLT_DIG-4, num);
else  sprintf(ascii, "%.*g", FLT_DIG+extra_float_digits, num);

> 
> 
>>Also, if we concluded that there is a need of 2 more digits, should'nt 
>>this be the default ?
> 
> 
> No.  pg_dump would want to bump it up on-the-fly.
> 
>             regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 
> 


-- 
----------------------------------------------------------------------
Pedro Miguel Frazao Fernandes Ferreira
Universidade do Algarve
Faculdade de Ciencias e Tecnologia
Campus de Gambelas
8000-117 Faro
Portugal
Tel./Fax:  (+351) 289 800950 / 289 819403
http://w3.ualg.pt/~pfrazao



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Float output formatting options
Next
From: Tom Lane
Date:
Subject: Re: Float output formatting options