From: Yasushi Shoji Date: 2000-01-25T14:04:46+09:00 Subject: [ruby-list:20380] Re: divmod() From: matz@netlab.co.jp (Yukihiro Matsumoto) Subject: [ruby-list:20377] Re: divmod() Date: Tue, 25 Jan 2000 12:58:24 +0900 > |> 13 % 4 => 1 13 % -4 => -3 -13 % 4 => 3 -13 % -4 => -1 > |> 13.remainder(4) => 1 13.remainder(-4) => 1 -13.remainder(4) => > |> -1 -13.remainder(-4) => -1 > | > |って、あるので‥。 > > #
なのに畳み込まれている...

# む‥‥うちの copyは
# 
# # に、なってる‥‥。新しくなってたのか‥‥ > この挙動はScheme由来です。もちろん、将来の変更について議論す > ることは可能です。 数学屋さんではないので教えて欲いのですが、modulusと remainderの違いが Rubyや Schemeに反映されてるのでしょうか? # modulusと remainderの違いもわかってません(汗 なんとなく "remainder" == "残り" なら、負の数の残りって??って感じなので % と remainderを入れ替えたら分りやすかなぁ〜と‥。 -13 % 4 => -1 #他(Scheme以外 ^^;)の言語と同じ -13.remainder(4) => 3 #三つ残る # ruby-mathの方々におまかせします‥。 -- yashi