Skip to content

Questionable Eq and Ord instances for CReal #17

@expipiplus1

Description

@expipiplus1

I think functions to compare equality should be exposed (with a digits-to-compare parameter), but exposing CReal as an instance of Eq and Ord is a little fishy, as this can break a whole bunch of the informal laws surrounding Haskell's Eq and Ord classes.

Although other types such as Float and Double break the laws of Eq, I think it would be appropriate to hold "exact" real arithmetic to a higher standard.

Data.Number.CReal> 2e-42 == (1e-42 :: CReal)
True
 Data.Number.CReal> 2e-42 > (1e-42 :: CReal)
False

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions