Re: BUG #14046: Bad mathematical rules for 0 cast

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jaroslaw(dot)stoklosa(at)nomino(dot)pl
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14046: Bad mathematical rules for 0 cast
Date: 2016-03-25 13:39:34
Message-ID: 17107.1458913174@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

jaroslaw(dot)stoklosa(at)nomino(dot)pl writes:
> +0 and -0 should be casted to +0 or 0.

On what grounds? The behavior seems sensible to me:

regression=# select cast('-0' as FLOAT);
float8
--------
-0
(1 row)

regression=# select cast('-0' as FLOAT)::text;
text
------
-0
(1 row)

If we do what you suggest, casting to text would be different from the
type's I/O conversion, which seems strange, and definitely isn't what
most other casts to text do.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2016-03-25 15:14:40 Re: BUG #14045: ** BUILD FAILED **
Previous Message John McKown 2016-03-25 13:32:19 Re: BUG #14046: Bad mathematical rules for 0 cast