[#35592] String#center — Take_tk <ggb03124@...>

 仕様拡張のお願い。と言うほどのものでもないですが・・

33 messages 2002/07/20
[#35593] Re: String#center — Kazuhiro NISHIYAMA <zn@...> 2002/07/20

西山和広です。

[#35596] Re: String#center — Take_tk <ggb03124@...> 2002/07/20

たけ(tk)です。

[#35597] Re: String#center — Kazuhiro NISHIYAMA <zn@...> 2002/07/20

西山和広です。

[#35599] Rational#to_int ← String#center — Take_tk <ggb03124@...> 2002/07/21

たけ(tk)です。

[#35601] Re: Rational#to_int ← String#center — matz@... (Yukihiro Matsumoto) 2002/07/21

まつもと ゆきひろです

[#35618] new mathn [Re: Rational#to_int ← String#center] — keiju@... (石塚圭樹) 2002/07/23

けいじゅ@日本ラショナルソフトウェアです.

[#35624] Re: new mathn [Re: Rational#to_int ← String#center] — matz@... (Yukihiro Matsumoto) 2002/07/24

まつもと ゆきひろです

[#35628] Re: new mathn [Re: Rational#to_int ← String#center] — keiju@... (石塚圭樹) 2002/07/24

けいじゅ@日本ラショナルソフトウェアです.

[#35630] Re: new mathn [Re: Rational#to_int ← String#center] — matz@... (Yukihiro Matsumoto) 2002/07/24

まつもと ゆきひろです

[ruby-list:35558] Re: Numeric#===

From: Kazuhiro Yoshida <moriq.kazuhiro@...>
Date: 2002-07-14 13:09:55 UTC
List: ruby-list #35558
もりきゅうです。

OZAWA -Crouton- Sakuro <crouton@weatherlight.org> wrote:
> === は釈然としないので、機械イプシロンを返す Float.EPS (or Math.EPS) を定義
> するあたりが妥当ではないでしょうか?

んで

class Float
  def ==(v)
    (self - v).abs < Float.EPS
  end
end

とすれば

p a = 2**0.5
p a**2 == 2   #=> true

になるのかな。

----
YOSHIDA Kazuhiro  moriq@moriq.com  http://www.moriq.com/

In This Thread