Re: [HACKERS] Float output formatting options

2002-11-05 Thread Pedro M. Ferreira
Pedro M. Ferreira wrote: Tom Lane wrote: 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

Re: [HACKERS] Float output formatting options

2002-11-04 Thread Pedro M. Ferreira
Tom Lane wrote: "Pedro M. Ferreira" <[EMAIL PROTECTED]> 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), co

Re: [HACKERS] Float output formatting options

2002-11-04 Thread Pedro M. Ferreira
Tom Lane wrote: Yeah. In fact I'd be inclined to remove the static variable and make the code match float8out exactly (do "DBL_DIG + extra_float_digits"). P_MAXDIG is only used in the lines below: #define P_MAXDIG DBL_DIG #define P_MAXLEN (2*(P_MAXDIG+7)+1) static int digits8 = P_MAXDIG;

Re: [HACKERS] Float output formatting options

2002-11-04 Thread Pedro M. Ferreira
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 geomet

Re: [HACKERS] Float output formatting options

2002-11-04 Thread Pedro M. Ferreira
Tom Lane wrote: Looks good, will keep to apply after we branch for 7.4 development. 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. Only checked arrays. I will check

Re: [HACKERS] Float output formatting options

2002-11-04 Thread Pedro M. Ferreira
Tom Lane wrote: "Pedro M. Ferreira" <[EMAIL PROTECTED]> writes: >> If extra_float_digits==-13 and we are outputing a float4 this results in a negative value for FLT_DIG+extra_float_digits. You would want to clamp the values passed to %g to not less than 1. I'

Re: [HACKERS] Float output formatting options

2002-11-04 Thread Pedro M. Ferreira
Tom Lane wrote: "Pedro M. Ferreira" <[EMAIL PROTECTED]> 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, de

[HACKERS] Float output formatting options

2002-11-04 Thread Pedro M. Ferreira
sources from Debian source package, postgresql_7.2.1-2woody2. Diff's produced with diff -u are enclosed as attachments. Can you comment on this (particularly the min values) ? Also, if we concluded that there is a need of 2 more digits, should'nt this be the default ? Best regard

Re: [HACKERS] float output precision questions

2002-10-31 Thread Pedro M. Ferreira
I sent an email before receiving the one below. I am happier also with the extra_digits way (from the previous email I thought the options were DBL_DIG or DBL_DIG+2). I'm not happy with adding the hex-output option, since it's not very portable and doesn't seem necessary to solve the problem any

Re: [HACKERS] float output precision questions

2002-10-31 Thread Pedro M. Ferreira
there are any restrictions on who implements what respecting PostgreSQL. Tomorrow we have an holyday in Portugal and I shall leave for the whole week-end, but I can do it on monday. Best regards, Pedro M. Ferreira regards, tom lane ---(end of broadcast)---

Re: [HACKERS] float output precision questions

2002-10-31 Thread Pedro M. Ferreira
Tom Lane wrote: I was misremembering these papers to claim DBL_DIG+1 is enough, but actually they prove that DBL_DIG+2 is necessary and sufficient (and give code to do it correctly, too). Yeahh! If there's a proof its safe to implement. I also Googled a bit and found another paper saying that 1

Re: [HACKERS] float output precision questions

2002-10-31 Thread Pedro M. Ferreira
Zeugswetter Andreas SB SD wrote: Yes agree (or double_significant_digits or format_double_digits ?), but default to DBL_DIG and allow range between 1 and DBL_DIG + 3. format_* could be used for all future output format tweaks. Unfortunately %A is not portable :-( What do you mean ? It is C99,

Re: [HACKERS] float output precision questions

2002-10-31 Thread Pedro M. Ferreira
Just one more note, Maybe it makes sense that in the proposal below the parameter EXTRA_DIGITS could be SIGNIFICANT_DIGITS with a default value of 15 and maximum 18. Its more 'documentable' and maybe easy to understand in general. Pedro M. Ferreira wrote: Yes. I think there a

Re: [HACKERS] float output precision questions

2002-10-31 Thread Pedro M. Ferreira
sumptions about the number of significant digits in a double (default EXTRA_DIGITS=0), and it gives flexibility (EXTRA_DIGITS!=0) if needed. I think this is functional and reasonable. Regards, Pedro M. Ferreira regards, tom lane ---(end of broadcast)--

Re: [HACKERS] float output precision questions

2002-10-30 Thread Pedro M. Ferreira
Stephan Szabo wrote: On Wed, 30 Oct 2002, Pedro Miguel Frazao Fernandes Ferreira wrote: I understand that if people insert a value of 1.1 in a double, they want to get 1.1 without knowing that in fact the stored number is 1.10009. But do you understand that if some people insert, for