Results for: "partition"

Returns true if any bit that is set (=1) in mask is also set in self; returns false otherwise.

Example values:

0b10000010  self
0b11111111  mask
0b10000010  self & mask
      true  self.anybits?(mask)

0b00000000  self
0b11111111  mask
0b00000000  self & mask
     false  self.anybits?(mask)

Related: Integer#allbits?, Integer#nobits?.

Returns true if no bit that is set (=1) in mask is also set in self; returns false otherwise.

Example values:

0b11110000  self
0b00001111  mask
0b00000000  self & mask
      true  self.nobits?(mask)

0b00000001  self
0b11111111  mask
0b00000001  self & mask
     false  self.nobits?(mask)

Related: Integer#allbits?, Integer#anybits?.

Returns an array of integers representing the base-radix digits of self; the first element of the array represents the least significant digit:

12345.digits      # => [5, 4, 3, 2, 1]
12345.digits(7)   # => [4, 6, 6, 0, 5]
12345.digits(100) # => [45, 23, 1]

Raises an exception if self is negative or base is less than 2.

No documentation available

Returns a complex object which denotes the given rectangular form.

Complex.rectangular(1, 2)  #=> (1+2i)

Returns a complex object which denotes the given polar form.

Complex.polar(3, 0)            #=> (3.0+0.0i)
Complex.polar(3, Math::PI/2)   #=> (1.836909530733566e-16+3.0i)
Complex.polar(3, Math::PI)     #=> (-3.0+3.673819061467132e-16i)
Complex.polar(3, -Math::PI/2)  #=> (1.836909530733566e-16-3.0i)

Returns the imaginary part.

Complex(7).imaginary      #=> 0
Complex(9, -4).imaginary  #=> -4

Returns the absolute part of its polar form.

Complex(-1).abs         #=> 1
Complex(3.0, -4.0).abs  #=> 5.0

Returns the angle part of its polar form.

Complex.polar(3, Math::PI/2).arg  #=> 1.5707963267948966

Returns an array; [cmp.real, cmp.imag].

Complex(1, 2).rectangular  #=> [1, 2]

Returns an array; [cmp.abs, cmp.arg].

Complex(1, 2).polar  #=> [2.23606797749979, 1.1071487177940904]

Returns the complex conjugate.

Complex(1, 2).conjugate  #=> (1-2i)

Returns the complex conjugate.

Complex(1, 2).conjugate  #=> (1-2i)

Returns true if cmp‘s real and imaginary parts are both finite numbers, otherwise returns false.

Returns 1 if cmp‘s real or imaginary part is an infinite number, otherwise returns nil.

For example:

   (1+1i).infinite?                   #=> nil
   (Float::INFINITY + 1i).infinite?   #=> 1

Returns zero.

Returns 0 if the value is positive, pi otherwise.

Returns an array; [num, 0].

Returns an array; [num.abs, num.arg].

Returns self.

Returns self.

Returns self.

Raises an exception if the value for freeze is neither true nor nil.

Related: Numeric#dup.

Returns the absolute value of self.

12.abs        #=> 12
(-34.56).abs  #=> 34.56
-34.56.abs    #=> 34.56

Numeric#magnitude is an alias for Numeric#abs.

Returns self if self is not a zero value, nil otherwise; uses method zero? for the evaluation.

The returned self allows the method to be chained:

a = %w[z Bb bB bb BB a aA Aa AA A]
a.sort {|a, b| (a.downcase <=> b.downcase).nonzero? || a <=> b }
# => ["A", "a", "AA", "Aa", "aA", "BB", "Bb", "bB", "bb", "z"]

Of the Core and Standard Library classes, Integer, Float, Rational, and Complex use this implementation.

Returns true if num is a finite number, otherwise returns false.

Search took: 3ms  ·  Total Results: 2583