Re: float output precision questions - Mailing list pgsql-hackers

From Pedro Miguel Frazao Fernandes Ferreira
Subject Re: float output precision questions
Date
Msg-id 3DBFB2C9.3090906@ualg.pt
Whole thread Raw
In response to Re: float output precision questions  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers

Peter Eisentraut wrote:
> 
>>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).
> 
> 
> Do we have some mathematical guarantee that this is sufficient and
> necessary?  If so, then it might do.

It is necessary if you want to do this type of (huge amount of number 
storage) application:
 [Some client] (insert)  [PostgreSQL]  (query)  [Some client]
(double number a)-------->(float8 number)------->(double number b)

In order for a=b this is necessary. With current float8 output this is 
not allways true.

Here is the help for that particular Matlab function:
 NUM2MSTR Convert number to string in maximum precision.    S = NUM2MSTR(N) converts real numbers of input    matrix N
tostring output vector S, in    maximum precision.
 
    See also NUM2STR.

If you want I can try to contact the guys who coded this function to know
if this is sufficient.

Thanks,
Pedro M. Ferreira
-- 
----------------------------------------------------------------------
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: Philip Rhoades
Date:
Subject: PG, Crystal Reports, Stored Procedures and User Defined Functions
Next
From: Pedro Miguel Frazao Fernandes Ferreira
Date:
Subject: Re: float output precision questions