instance methods
|
Arithmetic operations |
|
|
Performs various arithmetic operations on fix.
fix |
+ |
aNumeric |
Addition |
fix |
-- |
aNumeric |
Subtraction |
fix |
* |
aNumeric |
Multiplication |
fix |
/ |
aNumeric |
Division |
fix |
% |
aNumeric |
Modulo |
fix |
** |
aNumeric |
Exponentiation |
| Bit operations |
|
|
Performs various operations on the binary representations of the
Fixnum .
~ fix |
Invert bits |
fix |
| |
aNumeric |
Bitwise OR |
fix |
& |
aNumeric |
Bitwise AND |
fix |
^ |
aNumeric |
Bitwise EXCLUSIVE OR |
fix |
<< |
aNumeric |
Left-shift aNumeric bits |
fix |
>> |
aNumeric |
Right-shift aNumeric
bits (with sign extension) |
| <=> |
fix <=> aNumeric
-> -1, 0, +1
|
|
Comparison---Returns -1, 0, or +1 depending on whether fix is less
than, equal to, or greater than aNumeric. This is the
basis for the tests in Comparable .
| [ ] |
fix[ n ] -> 0, 1
|
|
Bit Reference---Returns the nth bit in the binary
representation of fix, where fix[0] is the least significant
bit.
a = 0b11001100101010
30.downto(0) do |n| print a[n] end
|
produces:
0000000000000000011001100101010
|
| id2name |
fix.id2name -> aString or nil
|
|
Returns the name of the object whose symbol
id is the value of fix. If there is no symbol in the symbol
table with this value, returns nil .
id2name has nothing to do with the Object.id
method. See also String#intern
on page 376 and class Symbol on page 388.
symbol = :@inst_var |
» |
:@inst_var |
id = symbol.to_i |
» |
8978 |
id.id2name |
» |
"@inst_var" |
| size |
fix.size -> aFixnum
|
|
Returns the number of bytes in the machine representation
of a Fixnum .
| to_f |
fix.to_f -> aFloat
|
|
Converts fix to a Float .
| to_i |
fix.to_i -> fix
|
|
Returns fix.
| to_s |
fix.to_s -> aString
|
|
Returns a string containing the decimal representation of self.
|