Re: Formatting query output

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pedro Miguel Frazao Fernandes Ferreira <pfrazao(at)ualg(dot)pt>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: Formatting query output
Date: 2002-10-29 22:41:36
Message-ID: 24314.1035931296@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Pedro Miguel Frazao Fernandes Ferreira <pfrazao(at)ualg(dot)pt> writes:
> When I store a float8
> number in a database, I am supposed to fetch the number as inserted.

I fear you have a fundamental misconception about the nature of
floating-point representation. There is no such thing as "fetching the
number as inserted". You get only as much accuracy as float8 format
will store, which is about half a digit less than you are asking for in
this case.

The fact that you might be able to store this particular 16-digit value
exactly is no guarantee that you'll be able to store other 16-digit
values exactly, so I recommend choosing another representation if
that's your requirement. Blaming the output formatting is the wrong
way to look at it.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert Treat 2002-10-29 22:50:30 Re: PHP and PostgreSQL
Previous Message am 2002-10-29 22:31:09 Re: substitute variable in sql?