On Wed, Jun 12, 2019 at 6:45 PM Richard Hipp <d...@sqlite.org> wrote:

> On 6/12/19, James K. Lowden <jklow...@schemamania.org> wrote:
> > 1.  Prior art.  I can't think of a single programming language that
> > displays -0.0 without jumping through hoops.
>
> Prints -0.0 as "-0.0" or just "-0":  glibc, Tcl, Python, Javascript
>
> Prints -0.0 as "0.0" or "0": PostgreSQL, MySQL, Oracle, SqlServer
>

Since I didn't know if Richard knew about NUMBER vs BINARY_DOUBLE in Oracle,
the latter being supposed to store IEEE doubles, I tried, and I can't see
to input a -0.0
in either using SQL*PLUS. I guess I would have to write a small test with
OCI to know
if at least like SQLite either is able to preserve the sign.

But in terms of to-text rendering, I'm not getting a -0.0 back for sure,
like Richard.
And the SIGN() function does not show the numbers as negative, although
there is
some weirdness is that it returns a different result for NUMBER and
BINARY_DOUBLE
which I didn't investigate.

FWIW :). --DD

Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application
Testing options

SQL> create table testfp (fpnum number, fpieee binary_double);

Table created.

SQL> insert into testfp values (0.0, 0.0);

1 row created.

SQL> insert into testfp values (-0.0, -0.0);

1 row created.

SQL> select * from testfp;

     FPNUM     FPIEEE
---------- ----------
         0          0
         0          0

SQL> insert into testfp values (-0.0, cast(-0.0 as binary_double));

1 row created.

SQL> select * from testfp;

     FPNUM     FPIEEE
---------- ----------
         0          0
         0          0
         0          0

SQL> select sign(fpnum), sign(fpieee) from testfp;

SIGN(FPNUM) SIGN(FPIEEE)
----------- ------------
          0            1
          0            1
          0            1

SQL> insert into testfp values (-1.0, -1.0);

1 row created.

SQL> select sign(fpnum), sign(fpieee) from testfp;

SIGN(FPNUM) SIGN(FPIEEE)
----------- ------------
          0            1
          0            1
          0            1
         -1           -1

SQL> insert into testfp values (-1.0*0, -1.0*0);

1 row created.

SQL> select sign(fpnum), sign(fpieee) from testfp;

SIGN(FPNUM) SIGN(FPIEEE)
----------- ------------
          0            1
          0            1
          0            1
         -1           -1
          0            1

SQL> select * from testfp
  2  ;

     FPNUM     FPIEEE
---------- ----------
         0          0
         0          0
         0          0
        -1  -1.0E+000
         0          0

SQL>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to