Re: [BUGS] BUG #4660: float functions return -0

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [BUGS] BUG #4660: float functions return -0
Date: 2009-02-17 15:57:58
Message-ID: 3354.1234886278@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>> I'm of the opinion that minus zero was put into the IEEE floating point
>> standard by people who know a great deal more about the topic than
>> anyone on this list does, and that we do not have the expertise to be
>> second-guessing how it should work. Not long ago we took out code that
>> was interfering with spec-compliant treatment of IEEE infinity; I think
>> we should take out this code too.

> If the original complaint was that it looked ugly in query results then the
> right way to fix it would surely in float4out and float8out. Interfering with
> IEEE floating points may be a bad idea but surely it's up to us how we want to
> represent those values in text.

> But without a convenient and widely used binary format that kind of restricts
> our options. If we squash -0 on float[48]out then dumps will lose information.

The point I'm trying to make is that we should deliver IEEE-compliant
results if we are on a platform that complies with the spec. Right down
to the minus sign. If that surprises people who are unfamiliar with the
spec, well, there are a lot of things about floating point arithmetic
that surprise people who aren't familiar with it.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Brendan Jurd 2009-02-17 19:24:28 Re: [BUGS] BUG #4660: float functions return -0
Previous Message Alvaro Herrera 2009-02-17 15:55:25 Re: BUG #4658: copy problem

Browse pgsql-hackers by date

  From Date Subject
Next Message decibel 2009-02-17 16:14:56 Re: The science of optimization in practical terms?
Previous Message Bruce Momjian 2009-02-17 15:41:51 Re: pg_migrator and handling dropped columns