Calculates the bit of an integer.
0.bit(4) #=> 16
10.bit(-4) #=> 2
0b0100.bit(-3) #=> 0
Returns if it is a bit set.
8.bit?(3) #=> true
8.bit?(2) #=> false
Clears a bit.
4.bit_clear(2) #=> 0
Calculates a bitmask of an integer.
1.bitmask(6) #=> 7
7.bitmask(~2) #=> 5
Returns if it is a bitmask set.
8.bitmask?(3) #=> true
8.bitmask?(2) #=> false
Calculates the combinatorial of an integer to another integer.
50.combinatorial(49) #=> 50
50.combinatorial(50) #=> 1
8.combinatorial(4) #=> 70
Calculates the factorial of an integer.
0.factorial #=> 0
1.factorial #=> 1
4.factorial #=> 24
Calculates all the factors of an integer.
24.factors #=> [1, 24, 2, 12, 3, 8, 4, 6]
Like times
but returns a collection of the yield results.
3.of { |i| i + 1 } #=> ['1', '2', '3']
Converts an integer to a roman_numeral numeral.
0.roman_numeral #=> ''
49.roman_numeral #=> 'XLIX'
-49.roman_numeral #=> '-XLIX'
Returns a Time object for the given Integer.
3.to_time #=> '1969-12-31 19:00:03.000000000 -0500'