Re: BUG #14046: Bad mathematical rules for 0 cast - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #14046: Bad mathematical rules for 0 cast
Date
Msg-id 17107.1458913174@sss.pgh.pa.us
Whole thread Raw
In response to BUG #14046: Bad mathematical rules for 0 cast  (jaroslaw.stoklosa@nomino.pl)
List pgsql-bugs
jaroslaw.stoklosa@nomino.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

pgsql-bugs by date:

Previous
From: John McKown
Date:
Subject: Re: BUG #14046: Bad mathematical rules for 0 cast
Next
From: "David G. Johnston"
Date:
Subject: Re: BUG #14045: ** BUILD FAILED **