Boost logo

Boost :

From: d.frey_at_[hidden]
Date: 2000-11-28 08:57:24

--- In boost_at_[hidden], "Moore, Paul" <paul.moore_at_u...> wrote:
> Um. Are you arguing for NOT having a conversion from double? If so,
> I could easily agree with you.

Yes. I'm working in the finance-sector and 'rational' is a useful
class here, *if* it does not yield any unpredictable behaviour. I
think it's saver not to have a build-in conversion from double, but to
explicitly use a function to perform the conversion.

> Well, it has the unpredictability of "what is the format?"... In my
> view, rationals have the canonical string representation n/m, and
> that's what is currently supported (admittedly not by a constructor,
> but by IO, and hence by lexical_cast). What format (exactly!) would
> you want? Does it never depend on the application?

Good point. I never looked at it from that side, since I always
thought about a standard float-like representation with "unlimited"
digits. Your n/m-approach looks a bit like a simple calculator to me.

BTW: A float (or double) that has a binary internal representation can
never result in an infite decimal representation, as every bit is a
finite number and therefore their sum is finite, too.

Regards, Daniel

Boost list run by bdawes at, gregod at, cpdaniel at, john at