ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-dev:50281] [Ruby trunk Bug#13986] Integer#fdiv with Complex returns unexpected value
       [not found] <redmine.issue-13986.20171007134931@ruby-lang.org>
@ 2017-10-07 13:49 ` 5.5
  2017-10-07 23:13 ` [ruby-dev:50282] [Ruby trunk Bug#13986][Feedback] " nobu
  2018-10-20 23:55 ` [ruby-dev:50658] [Ruby trunk Bug#13986][Closed] " 5.5
  2 siblings, 0 replies; 3+ messages in thread
From: 5.5 @ 2017-10-07 13:49 UTC (permalink / raw)
  To: ruby-dev

Issue #13986 has been reported by 5.5 (5 5).

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

* Author: 5.5 (5 5)
* Status: Open
* 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` オブジェクトを与えると,期待と違う値が得られる場合があります。

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

期待は,それぞれ

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

でした。

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



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-dev:50282] [Ruby trunk Bug#13986][Feedback] Integer#fdiv with Complex returns unexpected value
       [not found] <redmine.issue-13986.20171007134931@ruby-lang.org>
  2017-10-07 13:49 ` [ruby-dev:50281] [Ruby trunk Bug#13986] Integer#fdiv with Complex returns unexpected value 5.5
@ 2017-10-07 23:13 ` nobu
  2018-10-20 23:55 ` [ruby-dev:50658] [Ruby trunk Bug#13986][Closed] " 5.5
  2 siblings, 0 replies; 3+ messages in thread
From: nobu @ 2017-10-07 23:13 UTC (permalink / raw)
  To: ruby-dev

Issue #13986 has been updated by nobu (Nobuyoshi Nakada).

Description updated
Status changed from Open to Feedback

5.5 (5 5) wrote:
> 期待は,それぞれ
> 
> ```ruby
> Complex(1.0, 0.0)
> Complex(0.0, -1.0)
> ```
> 
> でした。

2.4の結果がおかしいのは確かですが、その期待は本当に正しいんでしょうか。

ドキュメント上は以下のように単にfloatを返すことになっています。
>     int.fdiv(numeric)  ->  float
>
>  Returns the floating point result of dividing `int` by `numeric`.
>
>     654321.fdiv(13731)      #=> 47.652829364212366
>     654321.fdiv(13731.24)   #=> 47.65199646936475
>     -654321.fdiv(13731)     #=> -47.652829364212366

trunkでは`Complex(1.0, 0.0).to_f`と同様例外になります。

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

* Author: 5.5 (5 5)
* Status: Feedback
* 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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-dev:50658] [Ruby trunk Bug#13986][Closed] Integer#fdiv with Complex returns unexpected value
       [not found] <redmine.issue-13986.20171007134931@ruby-lang.org>
  2017-10-07 13:49 ` [ruby-dev:50281] [Ruby trunk Bug#13986] Integer#fdiv with Complex returns unexpected value 5.5
  2017-10-07 23:13 ` [ruby-dev:50282] [Ruby trunk Bug#13986][Feedback] " nobu
@ 2018-10-20 23:55 ` 5.5
  2 siblings, 0 replies; 3+ messages in thread
From: 5.5 @ 2018-10-20 23:55 UTC (permalink / raw)
  To: ruby-dev

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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-20 23:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-13986.20171007134931@ruby-lang.org>
2017-10-07 13:49 ` [ruby-dev:50281] [Ruby trunk Bug#13986] Integer#fdiv with Complex returns unexpected value 5.5
2017-10-07 23:13 ` [ruby-dev:50282] [Ruby trunk Bug#13986][Feedback] " nobu
2018-10-20 23:55 ` [ruby-dev:50658] [Ruby trunk Bug#13986][Closed] " 5.5

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).