Re: [HACKERS] Floating point error - Mailing list pgsql-general

From James Cloos
Subject Re: [HACKERS] Floating point error
Date
Msg-id m31ubtajmh.fsf@carbon.jhcloos.org
Whole thread Raw
In response to Re: [HACKERS] Floating point error  (Heikki Linnakangas <hlinnakangas@vmware.com>)
List pgsql-general
>>>>> "HL" == Heikki Linnakangas <hlinnakangas@vmware.com> writes:

HL> It would be nice to have a base-2 text format to represent floats.
HL> It wouldn't be as human-friendly as base-10, but it could be used
HL> when you don't want to lose precision. pg_dump in particular.

hexidecimal notation for floats exists.  The printf format flag is %a
for miniscule and %A for majuscule.

The result of 1./3. is 0xa.aaaaaaaaaaaaaabp-5.

This site has some info and a conversion demo:

http://gregstoll.dyndns.org/~gregstoll/floattohex/

-JimC
--
James Cloos <cloos@jhcloos.com>         OpenPGP: 1024D/ED7DAEA6

pgsql-general by date:

Previous
From: Jeff Janes
Date:
Subject: Re: Finding matching words in a word game
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Floating point error