Re: floating point representation - Mailing list pgsql-hackers

From Robert Schrem
Subject Re: floating point representation
Date
Msg-id 01022110201801.17287@pc-robert
Whole thread Raw
In response to floating point representation  (Hiroshi Inoue <Inoue@tpf.co.jp>)
Responses Re: Re: floating point representation  (Philip Warner <pjw@rhyme.com.au>)
List pgsql-hackers
I think a formating mode where only the relevant digits are written
to the output would be great as an alternative to the discussed 
fixed formatting strings. In this context i think of 'relevant' 
as in the following:

'Output as few characters as possible but ensure that scanf is 
still able to rebuild the binary reprressentation of the floating 
point number exactly.'

To make this happen we would need to compute a seperate formatting
string for each floating point value:

E.g. if the binary value is exactly '1.00000E00' then we just
write '1' to the output, because the rest is just 'ASCII noise'
and not neccessary for rebuilding the identical binary value for
the given floating point value.

The advantage would be, that we only generate as much ASCII data
as absolutly neccessary to rebuild the original data exactly.
At least this is what I would expect from pg_dump.

robert schrem


pgsql-hackers by date:

Previous
From: Karel Zak
Date:
Subject: Encoding names
Next
From: Tatsuo Ishii
Date:
Subject: Re: Encoding names