Skip to content

SQL: Signed zero #6536

@philrz

Description

@philrz

Postgres happens to support presentation of "signed zero" from the IEEE 754 standard for floating-point arithmetic, e.g.,

$ psql postgres -c "SELECT -0.0::REAL;"
 ?column? 
----------
       -0
(1 row)

Whereas SuperDB currently seems to offer just the one rendering of zero.

$ super -version
Version: 292f4415e

$ super -c "SELECT -0.0::REAL;"
{"-0.0::<float32>":0.::float32}

Details

Repro is with super 292f441. This effect was spotted in sqllogictest random/select/slt_good_50/q3699.

As the standard describes, these values like -0 and +0 are mathematically equivalent to 0, so this effectively seems like just a presentation issue. That said, in addition to causing such sqllogictests to "fail" (albeit in an innocent way that can easily be explained and/or worked around), our docs on Number types point out how SuperSQL supports other concepts from IEEE 754 like Inf, +Inf, -Inf, and NaN, so we might consider supporting -0 and +0 as well for completeness, or document that their absence is intentional.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions