Skip to content

the isone predicate throws instead of returning false #310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nsajko opened this issue Feb 28, 2025 · 0 comments
Open

the isone predicate throws instead of returning false #310

nsajko opened this issue Feb 28, 2025 · 0 comments

Comments

@nsajko
Copy link

nsajko commented Feb 28, 2025

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant