[#43610] Re: [ruby-list:48149] Re: requireが配列を取れたら便利だと思うんだけど.. — Hiroshi Nakamura <nakahiro@...>

cnVieS1saXN0GyRCJCskaTt9JEMkRk1oJF4kNyQ/ISMkRyRiQjMkKyRKJD0kJiEjGyhCCgoyMDEx

12 messages 2011/06/02

[#43643] DateTime.new! and DateTime.jd — Aaron Patterson <aaron.patterson@...>

こんにちは、アーロンです。

25 messages 2011/06/07
[#43647] Re: DateTime.new! and DateTime.jd — Tadayoshi Funaba <tadf@...> 2011/06/07

blocker はお前だろ。

[#43648] Re: DateTime.new! and DateTime.jd — Yukihiro Matsumoto <matz@...> 2011/06/07

まつもと ゆきひろです

[#43651] Re: DateTime.new! and DateTime.jd — Tadayoshi Funaba <tadf@...> 2011/06/07

> うーん、ただでさえ日英のコミュニケーション障壁があるのに、よ

[#43653] Re: DateTime.new! and DateTime.jd — Aaron Patterson <aaron.patterson@...> 2011/06/07

2011/6/7 Tadayoshi Funaba <tadf@dotrb.org>:

[#43657] Re: DateTime.new! and DateTime.jd — Tadayoshi Funaba <tadf@...> 2011/06/07

皆さんってのに俺は入ってないみたいだな。

[#43661] Re: DateTime.new! and DateTime.jd — Yukihiro Matsumoto <matz@...> 2011/06/07

まつもと ゆきひろです

[#43662] Re: DateTime.new! and DateTime.jd — Tadayoshi Funaba <tadf@...> 2011/06/07

> Aaronが言ってる「リリース」は1.9.3のことだと思いますよ。

[#43645] Re: [ruby-core:36778] Re: 1.8.7 release next month — Urabe Shyouhei <shyouhei@...>

Moving to ruby-dev to understand strategies of backporting the Tk

13 messages 2011/06/07

[#43787] [Ruby 1.9 - Feature #4878][Open] CMath に frexp, ldexp, hypot の3関数は不要ではないか — Kenta Murata <muraken@...>

24 messages 2011/06/13
[#43788] Re: [Ruby 1.9 - Feature #4878][Open] CMath に frexp, ldexp, hypot の3関数は不要ではないか — Yukihiro Matsumoto <matz@...> 2011/06/13

まつもと ゆきひろです

[#43789] Re: [Ruby 1.9 - Feature #4878][Open] CMath に frexp, ldexp, hypot の3関数は不要ではないか — Tadayoshi Funaba <tadf@...> 2011/06/13

もう結論が出てしまったようですが、これは、元々 lib/complex.rb にあった

[#43794] Re: [Ruby 1.9 - Feature #4878][Open] CMath に frexp, ldexp, hypot の3関数は不要ではないか — Kenta Murata <muraken@...> 2011/06/13

=E3=82=80=E3=82=89=E3=81=9F=E3=81=A7=E3=81=99=E3=80=82

[#43795] Re: [Ruby 1.9 - Feature #4878][Open] CMath に frexp, ldexp, hypot の3関数は不要ではないか — Tadayoshi Funaba <tadf@...> 2011/06/13

> complex.rb をロードすると Math が CMath 相当に置き換わりますから、

[#43797] Re: [Ruby 1.9 - Feature #4878][Open] CMath に frexp, ldexp, hypot の3関数は不要ではないか — Kenta Murata <muraken@...> 2011/06/14

=E3=82=80=E3=82=89=E3=81=9F=E3=81=A7=E3=81=99=E3=80=82

[#43799] Re: [Ruby 1.9 - Feature #4878][Open] CMath に frexp, ldexp, hypot の3関数は不要ではないか — Yukihiro Matsumoto <matz@...> 2011/06/14

まつもと ゆきひろです

[#43800] Re: [Ruby 1.9 - Feature #4878][Open] CMath に frexp, ldexp, hypot の3関数は不要ではないか — Kenta Murata <muraken@...> 2011/06/14

=E3=82=80=E3=82=89=E3=81=9F=E3=81=A7=E3=81=99=E3=80=82

[#43803] Re: [Ruby 1.9 - Feature #4878][Open] CMath に frexp, ldexp, hypot の3関数は不要ではないか — Tadayoshi Funaba <tadf@...> 2011/06/14

> これに相当する事をやっているのが complex.rb なので、

[#43806] Re: [Ruby 1.9 - Feature #4878][Open] CMath に frexp, ldexp, hypot の3関数は不要ではないか — Yusuke ENDOH <mame@...> 2011/06/14

遠藤です。

[#43807] Re: [Ruby 1.9 - Feature #4878][Open] CMath に frexp, ldexp, hypot の3関数は不要ではないか — Tadayoshi Funaba <tadf@...> 2011/06/14

> 定義域を増やすだけにしよう、ということですよね。賛成です。

[#43809] Re: [Ruby 1.9 - Feature #4878][Open] CMath に frexp, ldexp, hypot の3関数は不要ではないか — Yusuke ENDOH <mame@...> 2011/06/14

2011年6月14日22:17 Tadayoshi Funaba <tadf@dotrb.org>:

[#43810] Re: [Ruby 1.9 - Feature #4878][Open] CMath に frexp, ldexp, hypot の3関数は不要ではないか — Tadayoshi Funaba <tadf@...> 2011/06/14

> 互換性がないという点では同じ話だと思うのですが……。

[#43811] Re: [Ruby 1.9 - Feature #4878][Open] CMath に frexp, ldexp, hypot の3関数は不要ではないか — Yusuke ENDOH <mame@...> 2011/06/14

2011年6月14日23:02 Tadayoshi Funaba <tadf@dotrb.org>:

[#43812] Re: [Ruby 1.9 - Feature #4878][Open] CMath に frexp, ldexp, hypot の3関数は不要ではないか — Tadayoshi Funaba <tadf@...> 2011/06/14

> いやあ、5 月末の feature freeze 時点では -2 を返していたはずなんですが、

[#43852] [Ruby 1.9 - Bug #4909][Open] trapハンドラは再入されてはいけないのではないか? — Motohiro KOSAKI <kosaki.motohiro@...>

11 messages 2011/06/20

[ruby-dev:43780] Re: [Ruby 1.9 - Bug #3137] complex.rb changes exceptions of Math

From: keiju@... (keiju ISHITSUKA)
Date: 2011-06-13 10:34:39 UTC
List: ruby-dev #43780
けいじゅ@いしつかです.

これらのパッチだと, 複素数が渡されたとき正しい動作をしなくなります.

ただ, NoMethodErrorもイマイチですよねぇ. 

これって, 例外のクラスが一致していればメッセージの内容が異なっていても
良いわけですよね?

それであれば, CMathのなかで, Object#real? を定義して, TypeErrorを出す
ようにしようと思います.


In [ruby-dev:43716] the message: "[ruby-dev:43716] [Ruby 1.9 - Bug
#3137] complex.rb changes exceptions of Math", on Jun/11 14:59(JST)
Koichi Sasada writes:

> Issue #3137 has been updated by Koichi Sasada.
> 
> 
> この件,どうしましょうか.
> ----------------------------------------
> Bug #3137: complex.rb changes exceptions of Math
> http://redmine.ruby-lang.org/issues/3137
> 
> Author: Yusuke Endoh
> Status: Assigned
> Priority: Normal
> Assignee: Keiju Ishitsuka
> Category: lib
> Target version: 1.9.x
> ruby -v: ruby 1.9.2dev (2010-04-12 trunk 27317) [i686-linux]
> 
> 
> =begin
>  いしつかさん
>  遠藤です。
>  
>  [ruby-core:28204] にて Brian Ford が「complex を require すると
>  Math.atan(nil) で投げられる例外が変わる」という報告をしています。
>  
>  
>    $ ./ruby -e 'p Math.atanh(nil)'
>    -e:1:in `atanh': can't convert nil into Float (TypeError)
>            from -e:1:in `<main>'
>  
>    $ ./ruby -rcomplex -e 'p Math.atanh(nil)'
>    /home/mame/work/ruby-trunk-local/lib/ruby/1.9.1/cmath.rb:196:in `atanh': undefined method `real?' for nil:NilClass (NoMethodError)
>            from -e:1:in `<main>'
>  
>  
>  Ruby レベルのライブラリは duck typing のためにむやみに型チェック
>  すべきでないとはいえ、CMath は組み込みの Math クラスの置き換えを
>  前提としているので、なるべく Math クラスの挙動を尊重した方がよい
>  と思いました。
>  
>  以下のパッチをコミットしてもいいでしょうか。
>  
>  # ついでですが、[ruby-dev:40953] も見てください。
>  
>  
>  diff --git a/lib/cmath.rb b/lib/cmath.rb
>  index b23dac2..aa2d9bb 100644
>  --- a/lib/cmath.rb
>  +++ b/lib/cmath.rb
>  @@ -27,6 +27,7 @@ module CMath
>     alias atanh! atanh
>   
>     def exp(z)
>  +    z = Float(z)
>       if z.real?
>         exp!(z)
>       else
>  @@ -36,9 +37,9 @@ module CMath
>       end
>     end
>   
>  -  def log(*args)
>  -    z, b = args
>  -    if z.real? and z >= 0 and (b.nil? or b >= 0)
>  +  def log(z, b = nil)
>  +    z = Float(z)
>  +    if z.real? and z >= 0 and (b.nil? or (b = Float(b); b >= 0))
>         log!(*args)
>       else
>         a = Complex(log!(z.abs), z.arg)
>  @@ -50,6 +51,7 @@ module CMath
>     end
>   
>     def log2(z)
>  +    z = Float(z)
>       if z.real? and z >= 0
>         log2!(z)
>       else
>  @@ -58,6 +60,7 @@ module CMath
>     end
>   
>     def log10(z)
>  +    z = Float(z)
>       if z.real? and z >= 0
>         log10!(z)
>       else
>  @@ -66,6 +69,7 @@ module CMath
>     end
>   
>     def sqrt(z)
>  +    z = Float(z)
>       if z.real?
>         if z < 0
>   	Complex(0, sqrt!(-z))
>  @@ -85,6 +89,7 @@ module CMath
>     end
>   
>     def cbrt(z)
>  +    z = Float(z)
>       if z.real? and z >= 0
>         cbrt!(z)
>       else
>  @@ -93,6 +98,7 @@ module CMath
>     end
>   
>     def sin(z)
>  +    z = Float(z)
>       if z.real?
>         sin!(z)
>       else
>  @@ -102,6 +108,7 @@ module CMath
>     end
>   
>     def cos(z)
>  +    z = Float(z)
>       if z.real?
>         cos!(z)
>       else
>  @@ -111,6 +118,7 @@ module CMath
>     end
>   
>     def tan(z)
>  +    z = Float(z)
>       if z.real?
>         tan!(z)
>       else
>  @@ -119,6 +127,7 @@ module CMath
>     end
>   
>     def sinh(z)
>  +    z = Float(z)
>       if z.real?
>         sinh!(z)
>       else
>  @@ -128,6 +137,7 @@ module CMath
>     end
>   
>     def cosh(z)
>  +    z = Float(z)
>       if z.real?
>         cosh!(z)
>       else
>  @@ -137,6 +147,7 @@ module CMath
>     end
>   
>     def tanh(z)
>  +    z = Float(z)
>       if z.real?
>         tanh!(z)
>       else
>  @@ -145,6 +156,7 @@ module CMath
>     end
>   
>     def asin(z)
>  +    z = Float(z)
>       if z.real? and z >= -1 and z <= 1
>         asin!(z)
>       else
>  @@ -153,6 +165,7 @@ module CMath
>     end
>   
>     def acos(z)
>  +    z = Float(z)
>       if z.real? and z >= -1 and z <= 1
>         acos!(z)
>       else
>  @@ -161,6 +174,7 @@ module CMath
>     end
>   
>     def atan(z)
>  +    z = Float(z)
>       if z.real?
>         atan!(z)
>       else
>  @@ -169,6 +183,7 @@ module CMath
>     end
>   
>     def atan2(y,x)
>  +    x, y = Float(x), Float(y)
>       if y.real? and x.real?
>         atan2!(y,x)
>       else
>  @@ -177,6 +192,7 @@ module CMath
>     end
>   
>     def asinh(z)
>  +    z = Float(z)
>       if z.real?
>         asinh!(z)
>       else
>  @@ -185,6 +201,7 @@ module CMath
>     end
>   
>     def acosh(z)
>  +    z = Float(z)
>       if z.real? and z >= 1
>         acosh!(z)
>       else
>  @@ -193,6 +210,7 @@ module CMath
>     end
>   
>     def atanh(z)
>  +    z = Float(z)
>       if z.real? and z >= -1 and z <= 1
>         atanh!(z)
>       else
>  
>  -- 
>  Yusuke Endoh <mame@tsg.ne.jp>
> =end
> 
> 
> 
> -- 
> http://redmine.ruby-lang.org
> 



__
---------------------------------------------------->> 石塚 圭樹 <<---
---------------------------------->> e-mail: keiju@ishitsuka.com <<---

In This Thread