TODO has:

       o Add SET REAL_FORMAT and SET DOUBLE_PRECISION_FORMAT
         using printf args

so we have not implemented it yet.

---------------------------------------------------------------------------

Pedro Miguel Frazao Fernandes Ferreira wrote:
> Hi All,
> 
> I wrote a Matlab interface to PostgreSQL based on libpq. It is working 
> fine, supports multiple connections, supports all data types and arrays. 
> It is a C program to do the interface and some Matlab wrapper functions 
> around it to do the job at application level.
> 
> Matlab has an ODBC toolbox but we dont want to buy it since the 
> interface does the job and we have been using PostgreSQL for long time.
> We want to use PostgreSQl to store numeric data from simulation, 
> computation and data acquisition sources. Basically a big bunch of float 
> numbers.
> 
> There is still one problem, regarding float output formatting in querys 
> and dumps, which essential for this type of application.
> 
> If I have a float8 field (named real8 below) in a table and insert the 
> following,
> 
> insert into test(real8) values (4503599627370496);
> INSERT 21192 1
> 
> A select produces,
> 
> select real8 from test;
>          real8
> ---------------------
>   4.5035996273705e+15
> (1 row)
> 
> This is the string I would get from libpq's PQgetvalue(). PQftype() 
> correctly returns float8. pg_dump produces the same result. If I convert 
> PQgetvalue() to a C double I wont get the same number I inserted. If I 
> do a restore from a dump I also wont have the same number. I can see 
> that the original number is correctly stored because,
> 
> select to_char(real8,'9999999999999999999.99999') from test;
>         to_char
> ----------------------
>       4503599627370496
> (1 row)
> 
> This way PQftype wont tell this is a float8.
> 
> Is there a way to set query output precision to maximum precision ?
> For the type of application I mentioned this is crucial. People want to 
> get the 'same' numbers, from querys or dumps, as they inserted them.
> 
> Matlab has a toolbox fucntion, claiming maximum precision, to convert 
> from its double type (PostgreSQL float8) to string which does a 
> sprintf('%25.18g',number).
> 
> Would it be possible to have a a parameter which could be changed by a 
> SET command, in order to control output precision ? I searched the docs 
> but could not find this.
> 
> -- 
> ----------------------------------------------------------------------
> 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
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  [EMAIL PROTECTED]               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to