Skip to content

[minor] regression: Foo[0.0] is Foo[-0.0] is now false #13730

@timotheecour

Description

@timotheecour

regression introduced in bcccb74#comments and 28a755d (2 places in code)

Example

block:
  proc fun(a: static float) =
    static: echo a
  fun(0.0)
  fun(-0.0)
  type Foo[T: static[float]] = object
  doAssert Foo[0.0] is Foo[-0.0]

Current Output

0.0
-0.0
`Foo[0.0] is Foo[-0.0]`  [AssertionError]

Expected Output

0.0

Possible Solution

  • cast[uint64](a.floatVal) == cast[uint64](b.floatVal) needs to be more careful to take care of FP denormalization (only 0.0 and -0.0 are special)

Additional Information

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationRelated to documentation content (not generation).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions