Skip to content
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

findfirst() returns nonzero values upon failure #8025

Closed
epipping opened this issue Aug 16, 2014 · 3 comments
Closed

findfirst() returns nonzero values upon failure #8025

epipping opened this issue Aug 16, 2014 · 3 comments
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@epipping
Copy link

The documentation does not specify what findfirst() should return when its argument consists only of false entries. According to #925, it should be 0.

The reality looks a bit different, though.

julia> findfirst(!,trues(10))
11

julia> findfirst(falses(10))
0

So what does findfirst() return upon failure then? 0 or length+1? Something else?

@epipping
Copy link
Author

Version info:

Julia Version 0.3.0-rc4
Commit e844f0c* (2014-08-15 04:01 UTC)
Platform Info:
  System: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E31245 @ 3.30GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

@carlobaldassi
Copy link
Member

Looks like a bug in the implementation of findfirst on BitArrays, I'll fix it.

@carlobaldassi
Copy link
Member

Fixed and cherry-picked on the 0.3 release branch. Thanks for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants