[#30426] CGI でグラフを描くときにお勧めのライブラリは? — 堀川 久 <vzw00011@...>

こんにちは。

12 messages 2001/07/01

[#30453] syntax check without execution? — Tanaka Akira <akr@...17n.org>

最近、eRuby のまねごとをしていて、そのなかで Ruby のコードを生成してい

16 messages 2001/07/04
[#30455] Re: syntax check without execution? — matz@... (Yukihiro Matsumoto) 2001/07/04

まつもと ゆきひろです

[#30479] Object#dup — "Shin'ya Adzumi" <adzumi@...>

あづみです。

20 messages 2001/07/05

[#30512] open errno EALREADY triggerd — "Inoue" <inoue@...>

井上です。

16 messages 2001/07/08

[#30514] Ruby module frame work? — Takahiro Kambe <taca@...>

こんにちは。

16 messages 2001/07/09
[#30515] Re: Ruby module frame work? — matz@... (Yukihiro Matsumoto) 2001/07/09

まつもと ゆきひろです

[#30529] InterBase を使用したい — "YOUJI KUROKAWA" <CQE10242@...>

環境

22 messages 2001/07/09

[#30530] Question about script on the book "Ruby nyuumon" — NAWATE Masahiko <agul@...>

縄手@松江と言います。

17 messages 2001/07/09
[#30531] Re: Question about script on the book "Ruby nyuumon" — rubikitch <rubikitch@...> 2001/07/09

From: NAWATE Masahiko <agul@mag.shimane-u.ac.jp>

[#30533] Re: Question about script on the book "Ruby nyuumon" — NAWATE Masahiko <agul@...> 2001/07/09

縄手@松江です。

[#30734] UML クラス図と Ruby の記述についての対応 — Ken-ichi HASHIMOTO <ken@...>

橋本@福井県在住です。

13 messages 2001/07/28

[#30764] int/int => float? — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

50 messages 2001/07/31
[#30767] Re: int/int => float? — keiju@... (石塚圭樹) 2001/07/31

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

[#30768] Re: int/int => float? — matz@... (Yukihiro Matsumoto) 2001/07/31

まつもと ゆきひろです

[#30770] Re: int/int => float? — Take_tk <ggb03124@...> 2001/07/31

たけ(tk)です。

[#30771] Re: int/int => float? — matz@... (Yukihiro Matsumoto) 2001/07/31

まつもと ゆきひろです

[#30785] Re: int/int => float? — Konishi@... (Hiromasa KONISHI) 2001/07/31

 KONISHI Hiromasaです。

[ruby-list:30764] int/int => float?

From: matz@... (Yukihiro Matsumoto)
Date: 2001-07-31 03:01:06 UTC
List: ruby-list #30764
まつもと ゆきひろです

comp.lang.pythonからこのような話題が流れてきました。
識者の意見が聞きたいです。

要するに5/2が2.5であるべきかって話ですが。

Date: Mon, 30 Jul 2001 05:58:22 +0900
Posted: Sun, 29 Jul 2001 13:58:15 -0700
From: Paul Prescod <paulp@ActiveState.com>
Subject: [ruby-talk:18759] Re: Ruby as opposed to Python?
To: ruby-talk@ruby-lang.org (ruby-talk ML)

Yukihiro Matsumoto wrote:
> 
>...
> 
> Ah, you mean you believe 5/2 should be 2.5, do you?
> 
> I don't believe it.  Any operation on two exact numbers should not
> result in inexact number, unless explicitly specified.  So 5/2 may
> return 5/2 (rational number) in the future, but not 2.5.

Python may adopt rationals one day also, but the change to having 5/2
return a rational will be much less painful if the code out there
expects it to return a float than if the code expects it to return the
floor. Most code doesn't break when you make it more accurate but
switching from floor division to integer division breaks a lot of code
in an obvious way. The sooner it is done the sooner he can move on to
tackling rationals.

Anyhow, even if Python or Ruby never adopts rationals, I tend to think
that the substitutability principle is more important than the principle
that "any operation on two exact numbers should not result in inexact
number, unless explicitly specified." I would say if you strongly
believe that then the consistent thing to do is disallow all uses of
exact integers in place of floats. You could just as easily extend the
principle to say: "no operation involving an exact number should result
in an inexact number." Then people would be trained that floats and
integers are deeply different and distinct and they wouldn't accidently
pass integers to functions expecting floats.
-- 
Take a recipe. Leave a recipe.  
Python Cookbook!  http://www.ActiveState.com/pythoncookbook

In This Thread

Prev Next