Ruby/Справочник/Fixnum: различия между версиями
Содержимое удалено Содержимое добавлено
Нет описания правки |
Нет описания правки |
||
Строка 21:
===Fixnum::induced_from===
----
<source
----
Convert <tt>obj</tt> to a Fixnum. Works with numeric parameters. Also works with Symbols, but this is deprecated.
===Fixnum#%===
----
<source
----
Returns <tt>fix</tt> modulo <tt>other</tt>. See <tt>Numeric.divmod</tt> for more information.
===Fixnum#&===
----
<source
----
Bitwise AND.
===Fixnum#*===
----
<source
----
Performs multiplication: the class of the resulting object depends on the class of <tt>numeric</tt> and on the magnitude of the result.
===Fixnum#**===
----
<source
----
Alias for #rpower
===Fixnum#+===
----
<source
----
Performs addition: the class of the resulting object depends on the class of <tt>numeric</tt> and on the magnitude of the result.
===Fixnum#-===
----
----
Performs subtraction: the class of the resulting object depends on the class of <tt>numeric</tt> and on the magnitude of the result.
===Fixnum#-@===
----
----
Negates <tt>fix</tt> (which might return a Bignum).
===Fixnum#/===
----
<source
----
Performs division: the class of the resulting object depends on the class of <tt>numeric</tt> and on the magnitude of the result.
===Fixnum#<===
----
----
Returns <tt>true</tt> if the value of <tt>fix</tt> is less than that of <tt>other</tt>.
===Fixnum#<<===
----
----
Shifts <i>fix</i> left <i>count</i> positions (right if <i>count</i> is negative).
===Fixnum#<====
----
----
Returns <tt>true</tt> if the value of <tt>fix</tt> is less thanor equal to that of <tt>other</tt>.
===Fixnum#<=>===
----
----
Comparison---Returns -1, 0, or +1 depending on whether <i>fix</i> is less than, equal to, or greater than <i>numeric</i>. This is the basis for the tests in <tt>Comparable</tt>.
===Fixnum#=====
----
----
Return <tt>true</tt> if <tt>fix</tt> equals <tt>other</tt> numerically.
<source
===Fixnum#>===
----
----
Returns <tt>true</tt> if the value of <tt>fix</tt> is greater than that of <tt>other</tt>.
===Fixnum#>====
----
----
Returns <tt>true</tt> if the value of <tt>fix</tt> is greater than or equal to that of <tt>other</tt>.
===Fixnum#>>===
----
----
Shifts <i>fix</i> right <i>count</i> positions (left if <i>count</i> is negative).
===Fixnum#[]===
----
<source
----
Bit Reference---Returns the <i>n</i>th bit in the binary representation of <i>fix</i>, where <i>fix</i>[0] is the least significant bit.
<source
''результат'':
===Fixnum#^===
----
<source
----
Bitwise EXCLUSIVE OR.
===Fixnum#abs===
----
----
Returns the absolute value of <i>fix</i>.
===Fixnum#div===
----
<source
----
Performs division: the class of the resulting object depends on the class of <tt>numeric</tt> and on the magnitude of the result.
===Fixnum#divmod===
----
<source
----
See <tt>Numeric#divmod</tt>.
===Fixnum#id2name===
----
----
Returns the name of the object whose symbol id is <i>fix</i>. If there is no symbol in the symbol table with this value, returns <tt>nil</tt>. <tt>id2name</tt> has nothing to do with the <tt>Object.id</tt> method. See also <tt>Fixnum#to_sym</tt>, <tt>String#intern</tt>, and class <tt>Symbol</tt>.
<source
===Fixnum#modulo===
----
<source
----
Returns <tt>fix</tt> modulo <tt>other</tt>. See <tt>Numeric.divmod</tt> for more information.
===Fixnum#power!===
----
<source
----
Alias for #**
===Fixnum#quo===
----
<source
----
Returns the floating point result of dividing <i>fix</i> by <i>numeric</i>.
<source
(еще известен как /, rdiv)
===Fixnum#rdiv===
----
<source
----
Alias for #quo
===Fixnum#rpower===
----
<source
----
Returns a Rational number if the result is in fact rational (i.e. <tt>other</tt> < 0).
Строка 182:
===Fixnum#size===
----
----
Returns the number of <i>bytes</i> in the machine representation of a <tt>Fixnum</tt>.
<source
===Fixnum#to_f===
----
<source
----
Converts <i>fix</i> to a <tt>Float</tt>.
===Fixnum#to_s===
----
----
Returns a string containing the representation of <i>fix</i> radix <i>base</i> (between 2 and 36).
<source
===Fixnum#to_sym===
----
<source
----
Returns the symbol whose integer value is <i>fix</i>. See also <tt>Fixnum#id2name</tt>.
<code>fred = :fred.to_i
fred.id2name #
fred.to_sym #
===Fixnum#xchr===
----
<source
----
XML escaped version of chr
===Fixnum#zero?===
----
<source
----
Returns <tt>true</tt> if <i>fix</i> is zero.
===Fixnum#|===
----
<source
----
Bitwise OR.
===Fixnum#~===
----
<source
----
One's complement: returns a number where each bit is flipped.
|