core/numeric.rbs in rbs-3.0.0.dev.2 vs core/numeric.rbs in rbs-3.0.0.dev.3

- old
+ new

@@ -72,167 +72,95 @@ # # ## What's Here # # First, what's elsewhere. Class Numeric: # -# * Inherits from [class -# Object](Object.html#class-Object-label-What-27s+Here). -# * Includes [module -# Comparable](Comparable.html#module-Comparable-label-What-27s+Here). +# * Inherits from [class Object](rdoc-ref:Object@What-27s+Here). +# * Includes [module Comparable](rdoc-ref:Comparable@What-27s+Here). # # # Here, class Numeric provides methods for: # -# * [Querying](#class-Numeric-label-Querying) -# * [Comparing](#class-Numeric-label-Comparing) -# * [Converting](#class-Numeric-label-Converting) -# * [Other](#class-Numeric-label-Other) +# * [Querying](rdoc-ref:Numeric@Querying) +# * [Comparing](rdoc-ref:Numeric@Comparing) +# * [Converting](rdoc-ref:Numeric@Converting) +# * [Other](rdoc-ref:Numeric@Other) # # # ### Querying # -# #finite? -# : Returns true unless `self` is infinite or not a number. +# * #finite?: Returns true unless `self` is infinite or not a number. +# * #infinite?: Returns -1, `nil` or +1, depending on whether `self` is +# `-Infinity<tt>, finite, or <tt>+Infinity`. +# * #integer?: Returns whether `self` is an integer. +# * #negative?: Returns whether `self` is negative. +# * #nonzero?: Returns whether `self` is not zero. +# * #positive?: Returns whether `self` is positive. +# * #real?: Returns whether `self` is a real value. +# * #zero?: Returns whether `self` is zero. # -# #infinite? -# : Returns -1, `nil` or +1, depending on whether `self` is -# `-Infinity<tt>, finite, or <tt>+Infinity`. # -# #integer? -# : Returns whether `self` is an integer. -# -# #negative? -# : Returns whether `self` is negative. -# -# #nonzero? -# : Returns whether `self` is not zero. -# -# #positive? -# : Returns whether `self` is positive. -# -# #real? -# : Returns whether `self` is a real value. -# -# #zero? -# : Returns whether `self` is zero. -# -# -# # ### Comparing # -# [<=>](#method-i-3C-3D-3E) -# : Returns: +# * #<=>: Returns: # # * -1 if `self` is less than the given value. # * 0 if `self` is equal to the given value. # * 1 if `self` is greater than the given value. # * `nil` if `self` and the given value are not comparable. # -# #eql? -# : Returns whether `self` and the given value have the same value and -# type. # +# * #eql?: Returns whether `self` and the given value have the same value and +# type. # # # ### Converting # -# #% (aliased as #modulo) -# : Returns the remainder of `self` divided by the given value. +# * #% (aliased as #modulo): Returns the remainder of `self` divided by the +# given value. +# * #-@: Returns the value of `self`, negated. +# * #abs (aliased as #magnitude): Returns the absolute value of `self`. +# * #abs2: Returns the square of `self`. +# * #angle (aliased as #arg and #phase): Returns 0 if `self` is positive, +# Math::PI otherwise. +# * #ceil: Returns the smallest number greater than or equal to `self`, to a +# given precision. +# * #coerce: Returns array `[coerced_self, coerced_other]` for the given other +# value. +# * #conj (aliased as #conjugate): Returns the complex conjugate of `self`. +# * #denominator: Returns the denominator (always positive) of the Rational +# representation of `self`. +# * #div: Returns the value of `self` divided by the given value and converted +# to an integer. +# * #divmod: Returns array `[quotient, modulus]` resulting from dividing +# `self` the given divisor. +# * #fdiv: Returns the Float result of dividing `self` by the given divisor. +# * #floor: Returns the largest number less than or equal to `self`, to a +# given precision. +# * #i: Returns the Complex object `Complex(0, self)`. the given value. +# * #imaginary (aliased as #imag): Returns the imaginary part of the `self`. +# * #numerator: Returns the numerator of the Rational representation of +# `self`; has the same sign as `self`. +# * #polar: Returns the array `[self.abs, self.arg]`. +# * #quo: Returns the value of `self` divided by the given value. +# * #real: Returns the real part of `self`. +# * #rect (aliased as #rectangular): Returns the array `[self, 0]`. +# * #remainder: Returns `self-arg*(self/arg).truncate` for the given `arg`. +# * #round: Returns the value of `self` rounded to the nearest value for the +# given a precision. +# * #to_c: Returns the Complex representation of `self`. +# * #to_int: Returns the Integer representation of `self`, truncating if +# necessary. +# * #truncate: Returns `self` truncated (toward zero) to a given precision. # -# #-@ -# : Returns the value of `self`, negated. # -# #abs (aliased as #magnitude) -# : Returns the absolute value of `self`. -# -# #abs2 -# : Returns the square of `self`. -# -# #angle (aliased as #arg and #phase) -# : Returns 0 if `self` is positive, Math::PI otherwise. -# -# #ceil -# : Returns the smallest number greater than or equal to `self`, to a -# given precision. -# -# #coerce -# : Returns array `[coerced_self, coerced_other]` for the given other -# value. -# -# #conj (aliased as #conjugate) -# : Returns the complex conjugate of `self`. -# -# #denominator -# : Returns the denominator (always positive) of the Rational -# representation of `self`. -# -# #div -# : Returns the value of `self` divided by the given value and converted -# to an integer. -# -# #divmod -# : Returns array `[quotient, modulus]` resulting from dividing `self` the -# given divisor. -# -# #fdiv -# : Returns the Float result of dividing `self` by the given divisor. -# -# #floor -# : Returns the largest number less than or equal to `self`, to a given -# precision. -# -# #i -# : Returns the Complex object `Complex(0, self)`. the given value. -# -# #imaginary (aliased as #imag) -# : Returns the imaginary part of the `self`. -# -# #numerator -# : Returns the numerator of the Rational representation of `self`; has -# the same sign as `self`. -# -# #polar -# : Returns the array `[self.abs, self.arg]`. -# -# #quo -# : Returns the value of `self` divided by the given value. -# -# #real -# : Returns the real part of `self`. -# -# #rect (aliased as #rectangular) -# : Returns the array `[self, 0]`. -# -# #remainder -# : Returns `self-arg*(self/arg).truncate` for the given `arg`. -# -# #round -# : Returns the value of `self` rounded to the nearest value for the given -# a precision. -# -# #to_c -# : Returns the Complex representation of `self`. -# -# #to_int -# : Returns the Integer representation of `self`, truncating if necessary. -# -# #truncate -# : Returns `self` truncated (toward zero) to a given precision. -# -# -# # ### Other # -# #clone -# : Returns `self`; does not allow freezing. +# * #clone: Returns `self`; does not allow freezing. +# * #dup (aliased as #+@): Returns `self`. +# * #step: Invokes the given block with the sequence of specified numbers. # -# #dup (aliased as #+@) -# : Returns `self`. -# -# #step -# : Invokes the given block with the sequence of specified numbers. -# class Numeric include Comparable public @@ -245,13 +173,13 @@ # Of the Core and Standard Library classes, only Rational uses this # implementation. # # For Rational `r` and real number `n`, these expressions are equivalent: # - # c % n - # c-n*(c/n).floor - # c.divmod(n)[1] + # r % n + # r-n*(r/n).floor + # r.divmod(n)[1] # # See Numeric#divmod. # # Examples: # @@ -390,17 +318,19 @@ # # Raises an exception if any type conversion fails. # def coerce: (Numeric) -> [ Numeric, Numeric ] - # <!-- rdoc-file=complex.c --> - # Returns self. + # <!-- + # rdoc-file=numeric.rb + # - conj() + # --> # def conj: () -> Numeric # <!-- - # rdoc-file=complex.c + # rdoc-file=numeric.rb # - num.conj -> self # - num.conjugate -> self # --> # Returns self. # @@ -420,12 +350,12 @@ # --> # Returns the quotient `self/other` as an integer (via `floor`), using method # `/` in the derived class of `self`. (Numeric itself does not define method # `/`.) # - # Of the Core and Standard Library classes, Float, Rational, and Complex use - # this implementation. + # Of the Core and Standard Library classes, Only Float and Rational use this + # implementation. # def div: (Numeric) -> Integer # <!-- # rdoc-file=numeric.c @@ -522,17 +452,19 @@ # Rational(1, 2).i # => (0+(1/2)*i) # Complex(3, 4).i # Raises NoMethodError. # def i: () -> Complex - # <!-- rdoc-file=complex.c --> - # Returns zero. + # <!-- + # rdoc-file=numeric.rb + # - imag() + # --> # def imag: () -> Numeric # <!-- - # rdoc-file=complex.c + # rdoc-file=numeric.rb # - num.imag -> 0 # - num.imaginary -> 0 # --> # Returns zero. # @@ -575,13 +507,13 @@ # Of the Core and Standard Library classes, only Rational uses this # implementation. # # For Rational `r` and real number `n`, these expressions are equivalent: # - # c % n - # c-n*(c/n).floor - # c.divmod(n)[1] + # r % n + # r-n*(r/n).floor + # r.divmod(n)[1] # # See Numeric#divmod. # # Examples: # @@ -665,10 +597,10 @@ # Returns the most exact division (rational for integers, float for floats). # def quo: (Numeric) -> Numeric # <!-- - # rdoc-file=complex.c + # rdoc-file=numeric.rb # - num.real -> self # --> # Returns self. # def real: () -> Numeric