garrison (Garrison Jensen)
- Login: garrison
- Registered on: 01/02/2024
- Last sign in: 08/29/2025
Issues
| open | closed | Total | |
|---|---|---|---|
| Assigned issues | 0 | 0 | 0 |
| Reported issues | 1 | 0 | 1 |
Activity
08/29/2025
-
10:40 PM Ruby Feature #20163: Introduce #bit_count method on Integer
- tenderlovemaking (Aaron Patterson) wrote in #note-16:
> When would you use a negative number unless it's a mistake in your code?
I don't have a strong argument. Raising an exception sounds good to me.
-
07:00 PM Ruby Feature #20163: Introduce #bit_count method on Integer
- [Python ignores the sign](https://docs.python.org/3/library/stdtypes.html#int.bit_count). It seems friendlier to match that behavior than throw an exception.
``` ruby
(-x).popcount == x.popcount
```
01/10/2024
-
01:17 AM Ruby Feature #20163: Introduce #bit_count method on Integer
- I like `popcount` but I also like `count_ones` because it sounds friendlier, however I have no strong preferences for the chosen name.
Also, I want to share my performance tests in case they are helpful for the discussion. As you can s...
01/08/2024
-
08:50 PM Ruby Feature #20163 (Open): Introduce #bit_count method on Integer
- This feature request is to implement a method called #bit_count on Integer that returns the number of ones in the binary representation of the absolute value of the integer.
```
n = 19
n.bit_count #=> 3
(-n).bit_count #=> 3
```
Thi...