[#41918] [Feature #3647] Array#sample(n, replace=false) — Kenta Murata <redmine@...>

Feature #3647: Array#sample(n, replace=false)

11 messages 2010/08/03

[#41966] [Bug #3673] PTY.getpty with IO.pipe doesn't finish on FreeBSD — Yui NARUSE <redmine@...>

Bug #3673: PTY.getpty with IO.pipe doesn't finish on FreeBSD

9 messages 2010/08/10

[#41969] [Feature #3675] String#prepend, String#>> — Sora Harakami <redmine@...>

Feature #3675: String#prepend, String#>>

15 messages 2010/08/10
[#41976] Re: [Feature #3675] String#prepend, String#>> — Yukihiro Matsumoto <matz@...> 2010/08/10

まつもと ゆきひろです

[#41974] Re: [ruby-cvs:36157] Ruby:r28955 (trunk): * complex.c (nucomp_to_[ifr]): don't allow complex with in-exact — Yukihiro Matsumoto <matz@...>

まつもと ゆきひろです

7 messages 2010/08/10

[#42003] WEBrickに関するセキュリティ修正 (CVE-2010-0541) — Hideki Yamane <henrich@...>

12 messages 2010/08/11

[#42090] Math::atan2(0, 0) on ruby 1.9.2 — KUBO Takehiro <kubo@...>

久保です。

18 messages 2010/08/22
[#42092] Re: Math::atan2(0, 0) on ruby 1.9.2 — Kenta Murata <muraken@...> 2010/08/22

=1B$B$`$i$?$G$9!#=1B(B

[#42166] Ruby'sライセンスの、BSDLとのデュアルライセンスへの変更 — "NARUSE, Yui" <naruse@...>

Ruby's ライセンスは BSDL と Ruby's のデュアルライセンスになります。

14 messages 2010/08/31

[ruby-dev:42090] Math::atan2(0, 0) on ruby 1.9.2

From: KUBO Takehiro <kubo@...>
Date: 2010-08-22 08:59:39 UTC
List: ruby-dev #42090
久保です。

ruby 1.9.2 では Math::atan2(0, 0) が例外を上げるように変更されています
が、元に戻したほうが良くありませんか?

以下、説明。

1.9.1 以前では Math::atan2(0, 0) は引数の符号によって、以下のような値
を戻していました。(Linux & Windows で試験)

   Math::atan2(+0.0, +0.0) -> +0.0
   Math::atan2(+0.0, -0.0) -> +Math::PI
   Math::atan2(-0.0, +0.0) -> -0.0
   Math::atan2(-0.0, -0.0) -> -Math::PI

1.9.2 では r26785 の変更で Math::DomainError 例外を上げるように変更さ
れていました。

英語版 Wikipadia の atan2 を見たところ、atan2(0, 0) の戻り値は
undefined で、Single UNIX Specification version 2 の atan2 の定義には

  If both arguments are 0.0, an implementation-dependent value is returned
  and errno may be set to [EDOM].
  (http://opengroup.org/onlinepubs/007908775/xsh/atan2.htmlより引用)

と書かれているので、この記述に従うと例外を上げるのもありかなとは思った
けど、2004年版の Single UNIX Specification version 3 では、
(2001年版はみつからなかった...)

   If y is ±0 and x is -0, ±π shall be returned.
   If y is ±0 and x is +0, ±0 shall be returned.
   (http://www.opengroup.org/onlinepubs/000095399/functions/atan2.htmlより引用)

と変更されていた。上記の Windows & Linux での試験結果はこの記述に従っ
たのだと思われる。

最近のシステムでは atan2(0, 0) の戻り値が実装依存ではなくなってきてお
り、また、"errno may be set to [EDOM]." という記述も消えているので、
Math::atan2(0, 0) で引数が両方とも 0 ならば Math::DomainError を上げる
というのは止めたほうが良いと思うのですが、どうでしょうか?

1.9.2 にしたらいきなり例外が上がるようになりびっくりしたもので...。

In This Thread

Prev Next