Skip to content

isinteger(::Normed) incorrect #120

Closed

Description

@cjdoris

The code currently assumes that the denominator is 2^f, which is not the case for Normed. e.g.

julia> isinteger(Normed{UInt8,7}(1))
false

I believe you need to change

isinteger(x::FixedPoint{T,f}) where {T,f} = (x.i&(1<<f-1)) == 0

to

isinteger(x::Fixed{T,f}) where {T,f} = (x.i&(1<<f-1)) == 0
isinteger(x::Normed{T,f}) where {T,f} = (x.i%(1<<f-1)) == 0

Activity

  1. changed the title [-]`isinteger(::Normed)` incorrect[/-] [+]isinteger(::Normed) incorrect[/+] on May 11, 2019
  2. johnnychen94 commented on May 14, 2019

    @johnnychen94
    Collaborator

    This looks good (though I don't quite understand the magic shifting operations here), could you open a PR on this?

    Thanks

  3. added 2 commits that reference this issue on May 15, 2019
    00bb122
    5cf20d5
  4. added a commit that references this issue on Dec 28, 2024
    930f19a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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