core/float.rbs in rbs-3.3.2 vs core/float.rbs in rbs-3.4.0.pre.1
- old
+ new
@@ -4,12 +4,12 @@
#
# Floating point has a different arithmetic and is an inexact number. So you
# should know its esoteric system. See following:
#
# * https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
-# * https://github.com/rdp/ruby_tutorials_core/wiki/Ruby-Talk-FAQ#floats_impre
-# cise
+# * https://github.com/rdp/ruby_tutorials_core/wiki/Ruby-Talk-FAQ#-why-are-rub
+# ys-floats-imprecise
# * https://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
#
#
# You can create a Float object explicitly with:
#
@@ -107,12 +107,10 @@
# 10.0 % -4 # => -2.0
#
# 10.0 % 4.0 # => 2.0
# 10.0 % Rational(4, 1) # => 2.0
#
- # Float#modulo is an alias for Float#%.
- #
def %: (Integer) -> Float
| (Float) -> Float
| (Rational) -> Float
| (Numeric) -> Numeric
@@ -179,13 +177,13 @@
def -: (Complex) -> Complex
| (Numeric) -> Float
# <!--
# rdoc-file=numeric.rb
- # - -float -> float
+ # - -float -> float
# -->
- # Returns `float`, negated.
+ # Returns `self`, negated.
#
def -@: () -> Float
# <!--
# rdoc-file=numeric.c
@@ -324,21 +322,18 @@
#
def >=: (Numeric) -> bool
# <!--
# rdoc-file=numeric.rb
- # - float.abs -> float
- # - float.magnitude -> float
+ # - float.abs -> float
# -->
- # Returns the absolute value of `float`.
+ # Returns the absolute value of `self`:
#
- # (-34.56).abs #=> 34.56
- # -34.56.abs #=> 34.56
- # 34.56.abs #=> 34.56
+ # (-34.56).abs # => 34.56
+ # -34.56.abs # => 34.56
+ # 34.56.abs # => 34.56
#
- # Float#magnitude is an alias for Float#abs.
- #
def abs: () -> Float
def abs2: () -> Float
# <!-- rdoc-file=complex.c -->
@@ -479,12 +474,10 @@
# f.quo(2) # => 1.57
# f.quo(-2) # => -1.57
# f.quo(Rational(2, 1)) # => 1.57
# f.quo(Complex(2, 0)) # => (1.57+0.0i)
#
- # Float#fdiv is an alias for Float#quo.
- #
def fdiv: (Complex) -> Complex
| (Numeric) -> Float
# <!--
# rdoc-file=numeric.c
@@ -628,12 +621,10 @@
# 10.0 % -4 # => -2.0
#
# 10.0 % 4.0 # => 2.0
# 10.0 % Rational(4, 1) # => 2.0
#
- # Float#modulo is an alias for Float#%.
- #
def modulo: (Numeric) -> Float
# <!--
# rdoc-file=numeric.c
# - nan? -> true or false
@@ -647,13 +638,13 @@
#
def nan?: () -> bool
# <!--
# rdoc-file=numeric.rb
- # - float.negative? -> true or false
+ # - negative? -> true or false
# -->
- # Returns `true` if `float` is less than 0.
+ # Returns `true` if `self` is less than 0, `false` otherwise.
#
def negative?: () -> bool
# <!--
# rdoc-file=numeric.c
@@ -723,13 +714,13 @@
def polar: () -> [ Float, Integer | Float ]
# <!--
# rdoc-file=numeric.rb
- # - float.positive? -> true or false
+ # - positive? -> true or false
# -->
- # Returns `true` if `float` is greater than 0.
+ # Returns `true` if `self` is greater than 0, `false` otherwise.
#
def positive?: () -> bool
# <!--
# rdoc-file=numeric.c
@@ -777,12 +768,10 @@
# f.quo(2) # => 1.57
# f.quo(-2) # => -1.57
# f.quo(Rational(2, 1)) # => 1.57
# f.quo(Complex(2, 0)) # => (1.57+0.0i)
#
- # Float#fdiv is an alias for Float#quo.
- #
def quo: (Complex) -> Complex
| (Numeric) -> Float
# <!--
# rdoc-file=rational.c
@@ -873,13 +862,13 @@
def to_c: () -> Complex
# <!--
# rdoc-file=numeric.rb
- # - float.to_f -> self
+ # - to_f -> self
# -->
- # Since `float` is already a Float, returns `self`.
+ # Returns `self` (which is already a Float).
#
def to_f: () -> Float
# <!--
# rdoc-file=numeric.c
@@ -893,12 +882,10 @@
# Note that the limited precision of floating-point arithmetic may lead to
# surprising results:
#
# (0.3 / 0.1).to_i # => 2 (!)
#
- # Float#to_int is an alias for Float#to_i.
- #
def to_i: () -> Integer
# <!-- rdoc-file=numeric.c -->
# Returns `self` truncated to an Integer.
#
@@ -908,12 +895,10 @@
# Note that the limited precision of floating-point arithmetic may lead to
# surprising results:
#
# (0.3 / 0.1).to_i # => 2 (!)
#
- # Float#to_int is an alias for Float#to_i.
- #
alias to_int to_i
# <!--
# rdoc-file=rational.c
# - flt.to_r -> rational
@@ -992,12 +977,12 @@
def truncate: () -> Integer
| (Integer ndigits) -> (Integer | Float)
# <!--
# rdoc-file=numeric.rb
- # - float.zero? -> true or false
+ # - zero? -> true or false
# -->
- # Returns `true` if `float` is 0.0.
+ # Returns `true` if `self` is 0.0, `false` otherwise.
#
def zero?: () -> bool
end
# <!-- rdoc-file=numeric.c -->