mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 04:07:58 +00:00
[DOC] Harmonize #-@ methods
This commit is contained in:
parent
acbf55f4e6
commit
cfd41cbf03
Notes:
git
2025-12-15 22:29:01 +00:00
@ -799,9 +799,9 @@ rb_complex_imag(VALUE self)
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* -complex -> new_complex
|
||||
* -self -> complex
|
||||
*
|
||||
* Returns the negation of +self+, which is the negation of each of its parts:
|
||||
* Returns +self+, negated, which is the negation of each of its parts:
|
||||
*
|
||||
* -Complex.rect(1, 2) # => (-1-2i)
|
||||
* -Complex.rect(-1, -2) # => (1+2i)
|
||||
|
||||
@ -576,7 +576,7 @@ num_imaginary(VALUE num)
|
||||
* call-seq:
|
||||
* -self -> numeric
|
||||
*
|
||||
* Unary Minus---Returns the receiver, negated.
|
||||
* Returns +self+, negated.
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
|
||||
17
numeric.rb
17
numeric.rb
@ -93,9 +93,14 @@ end
|
||||
|
||||
class Integer
|
||||
# call-seq:
|
||||
# -int -> integer
|
||||
# -self -> integer
|
||||
#
|
||||
# Returns +self+, negated:
|
||||
#
|
||||
# -1 # => -1
|
||||
# -(-1) # => 1
|
||||
# -0 # => 0
|
||||
#
|
||||
# Returns +self+, negated.
|
||||
def -@
|
||||
Primitive.attr! :leaf
|
||||
Primitive.cexpr! 'rb_int_uminus(self)'
|
||||
@ -373,9 +378,13 @@ class Float
|
||||
alias magnitude abs
|
||||
|
||||
# call-seq:
|
||||
# -float -> float
|
||||
# -self -> float
|
||||
#
|
||||
# Returns +self+, negated.
|
||||
# Returns +self+, negated:
|
||||
#
|
||||
# -3.14 # => -3.14
|
||||
# -(-3.14) # => 3.14
|
||||
# -0.0 # => -0.0
|
||||
#
|
||||
def -@
|
||||
Primitive.attr! :leaf
|
||||
|
||||
@ -609,9 +609,13 @@ nurat_denominator(VALUE self)
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* -rat -> rational
|
||||
* -self -> rational
|
||||
*
|
||||
* Returns +self+, negated:
|
||||
*
|
||||
* -(1/3r) # => (-1/3)
|
||||
* -(-1/3r) # => (1/3)
|
||||
*
|
||||
* Negates +rat+.
|
||||
*/
|
||||
VALUE
|
||||
rb_rational_uminus(VALUE self)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user