[ruby-dev:50658] [Ruby trunk Bug#13986][Closed] Integer#fdiv with Complex returns unexpected value

From: 5.5@...
Date: 2018-10-20 23:55:32 UTC
List: ruby-dev #50658
Issue #13986 has been updated by 5.5 (5 5).

Status changed from Feedback to Closed

反応が遅くなってすみません。
現行の(修正後の)仕様について、そういうものなのだろう、と納得いたしました。

----------------------------------------
Bug #13986: Integer#fdiv with Complex returns unexpected value
https://bugs.ruby-lang.org/issues/13986#change-74548

* Author: 5.5 (5 5)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin15]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
Ruby 2.4 では,`Integer#fdiv` に `Complex` オブジェクトを与えると,期待と違う値が得られる場合があります。

```ruby
p 1.fdiv(1+0i) #=> -1.404447761611185e+306
p 1.fdiv(1i) #=> -1.0e-323
```

期待は,それぞれ

```ruby
Complex(1.0, 0.0)
Complex(0.0, -1.0)
```

でした。

Ruby 2.3.3 では期待のとおりでした。



-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next