Skip to content

the isone predicate throws instead of returning false #310

Description

@nsajko
julia> using FixedPointNumbers

julia> isone(0.0Q0f15)
ERROR: ArgumentError: Q0f15 is a 16-bit type representing 65536 values from -1.0 to 0.99997; cannot represent 1
Stacktrace:
 [1] throw_converterror(::Type{Q0f15}, x::Int64)
   @ FixedPointNumbers ~/.julia/packages/FixedPointNumbers/Dn4hv/src/FixedPointNumbers.jl:326
 [2] rawone(::Type{Q0f15})
   @ FixedPointNumbers ~/.julia/packages/FixedPointNumbers/Dn4hv/src/fixed.jl:41
 [3] oneunit(::Type{Q0f15})
   @ FixedPointNumbers ~/.julia/packages/FixedPointNumbers/Dn4hv/src/FixedPointNumbers.jl:108
 [4] one(::Type{Q0f15})
   @ FixedPointNumbers ~/.julia/packages/FixedPointNumbers/Dn4hv/src/FixedPointNumbers.jl:109
 [5] one(x::Q0f15)
   @ FixedPointNumbers ~/.julia/packages/FixedPointNumbers/Dn4hv/src/FixedPointNumbers.jl:222
 [6] isone(x::Q0f15)
   @ Base ./number.jl:62
 [7] top-level scope
   @ REPL[2]:1

julia> versioninfo()
Julia Version 1.11.3
Commit d63adeda50d (2025-01-21 19:42 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × AMD Ryzen 3 5300U with Radeon Graphics
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver2)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
Environment:
  JULIA_NUM_PRECOMPILE_TASKS = 4
  JULIA_PKG_PRECOMPILE_AUTO = 0

(@v1.11) pkg> st FixedPointNumbers
Status `~/.julia/environments/v1.11/Project.toml`
  [53c48c17] FixedPointNumbers v0.8.5

Activity

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