Skip to content

Add Data.Float to base, add inf + nan #394

@brandonchinn178

Description

@brandonchinn178

This proposal contains two parts, where the second part is the actual ask, and the first part is to create an appropriate location to implement it.

  1. Add Data.Float to base (Export castWord32ToFloat, castFloatToWord32, castWord64ToDouble, castDoubleToWord64 from non-GHC.* module #378)
  2. Add the following definitions to the new Data.Float module:
-- inf or -inf
inf :: RealFloat a => a
inf = 1/0

nan :: RealFloat a => a
nan = 0/0

There are certain cases where you want inf/nan as actual values in a Double field, and the two mechanisms to do so (inf = 1/0 or inf = read "Infinity") aren't very obvious.

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