Skip to content

Order for Numerics, e.g. Order[1.0, 1] == -1 (but is 0) #1519

@rocky

Description

@rocky

Description

Mathics3 Order[] values for numerics do not take into account the type in numerics when values are the same.

How to Reproduce

In[1]= Order[1.0, 1]
Out[1]= -1  (* Correct value*)

Output Given

Out[1]= 0

Expected behavior

In Order, and Sort and element ordering when numeric values are equal, the element order is probably needed. We currently lump Numeric (PrecisionReal, MachineReal, Integer, Complex) together and I guess we shouldn't.

I tried adjusting this but I am seeing a problem where the test:

ColorNegate[Yellow] == Blue 

Fails because RGBColor[0, 0, 1.0] != RGBColor[0, 0, 1] and it should be ==. That possibly a separate bug, but it feels mixed in here, and I don't understand how to fix.

Priority Additional Context

I am wondering if this kind of thing is going to eventually factor into Boxing order. Is it?

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions