Обсуждение: Displaying more than six digits from a real number

Поиск
Список
Период
Сортировка

Displaying more than six digits from a real number

От
Clodoaldo Pinto
Дата:
The 7.4.2 manual says the precision of a real number is 6 decimal digits.

Is it possible to force the display of more than six decimal digits of a real
number whithout using to_char() or casting?

Using 7.4.2, FC2.

create table test (f4 float4) without oids;
insert into test values (4877852);
select f4, to_char(f4, 'FM9999999'), cast(f4 as int)
from test;
     f4      | to_char |   f4
-------------+---------+---------
 4.87785e+06 | 4877852 | 4877852

Clodoaldo Pinto






_______________________________________________________
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! http://br.acesso.yahoo.com/

Re: Displaying more than six digits from a real number

От
Bruno Wolff III
Дата:
On Wed, Dec 01, 2004 at 20:25:28 -0300,
  Clodoaldo Pinto <clodoaldo_pinto@yahoo.com.br> wrote:
> The 7.4.2 manual says the precision of a real number is 6 decimal digits.
>
> Is it possible to force the display of more than six decimal digits of a real
> number whithout using to_char() or casting?

I think you can use the extra_float_digits GUC variable to do what you want.

Re: Displaying more than six digits from a real number

От
Tom Lane
Дата:
Clodoaldo Pinto <clodoaldo_pinto@yahoo.com.br> writes:
> The 7.4.2 manual says the precision of a real number is 6 decimal digits.
> Is it possible to force the display of more than six decimal digits of a real
> number

Perhaps the extra_float_digits runtime parameter is what you want?
(You are of course aware that there aren't really more than six
useful digits there... or if you're not, maybe you should stay away
from float and use numeric.)

            regards, tom lane

Re: Displaying more than six digits from a real number

От
Clodoaldo Pinto
Дата:
 --- Tom Lane <tgl@sss.pgh.pa.us> escreveu:
>  Clodoaldo Pinto <clodoaldo_pinto@yahoo.com.br> writes:
> > The 7.4.2 manual says the precision of a real number is 6 decimal digits.
> > Is it possible to force the display of more than six decimal digits of a
> > real number
>
> Perhaps the extra_float_digits runtime parameter is what you want?
> (You are of course aware that there aren't really more than six
> useful digits there... or if you're not, maybe you should stay away
> from float and use numeric.)
>
That is exactly what I wanted. Yes, I'm aware. But I wonder how is the 7th
digit right? At least with the few tests I did it was never wrong.

I will have to change that column to float8 but for now it is good enough.

Thanks

 --- Bruno Wolff III <bruno@wolff.to> escreveu:
>
> I think you can use the extra_float_digits GUC variable to do what you want.
>

Regards,
Clodoaldo Pinto





_______________________________________________________
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! http://br.acesso.yahoo.com/