mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-complex: add parentheses to Math method calls
added parentheses to Math.hypot and Math.atan2 calls where the return value is used. Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -97,7 +97,7 @@ class Complex < Numeric
|
||||
# Complex(3.0, -4.0).abs #=> 5.0
|
||||
#
|
||||
def abs
|
||||
Math.hypot imaginary, real
|
||||
Math.hypot(imaginary, real)
|
||||
end
|
||||
alias_method :magnitude, :abs
|
||||
|
||||
@@ -125,7 +125,7 @@ class Complex < Numeric
|
||||
# Complex.polar(3, Math::PI/2).arg #=> 1.5707963267948966
|
||||
#
|
||||
def arg
|
||||
Math.atan2 imaginary, real
|
||||
Math.atan2(imaginary, real)
|
||||
end
|
||||
alias_method :angle, :arg
|
||||
alias_method :phase, :arg
|
||||
|
||||
Reference in New Issue
Block a user