1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
Commit graph

6 commits

Author SHA1 Message Date
nagachika
597ce7966c merge revision(s) 54cad3123a: [Backport #19004]
[Bug #19004] `Complex.polar` handles complex singular `abs` argument

	`Complex.polar` accepts Complex values as arguments for the polar form as long
	as the value of the complex has no imaginary part (ie it is 'real'). In
	`f_complex_polar` this is handled by extracting the real part of the arguments.
	However in the case `polar` is called with only a single argument, the absolute
	value (abs), then the Complex is created without applying a check on the type
	of abs, meaning it is possible to create a Complex where the real part is itself
	an instance of a Complex. This change removes the short circuit for the single
	argument case meaning the real part extraction is performed correctly
	(by f_complex_polar).

	Also adds an example to `spec/ruby/core/complex/polar_spec.rb` to check that
	the real part of a complex argument is correctly extracted and used in the
	resulting Complex real and imaginary parts.
	---
	 complex.c                            | 13 ++++++-------
	 spec/ruby/core/complex/polar_spec.rb | 16 ++++++++++++++++
	 2 files changed, 22 insertions(+), 7 deletions(-)
2022-11-05 14:24:03 +09:00
Benoit Daloze
5c276e1cc9 Update to ruby/spec@875a09e 2019-07-27 12:40:09 +02:00
eregon
e87fb88be8 Update to ruby/spec@241f9e7
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-25 10:41:16 +00:00
eregon
401b64c4e8 Update to ruby/spec@c1b568b
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-04 15:09:32 +00:00
eregon
3fa5bd38af Update to ruby/spec@83063a3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-29 16:08:16 +00:00
eregon
1d15d5f080 Move spec/rubyspec to spec/ruby for consistency
* Other ruby implementations use the spec/ruby directory.
  [Misc #13792] [ruby-core:82287]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-20 20:18:52 +00:00
Renamed from spec/rubyspec/core/complex/polar_spec.rb (Browse further)