Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2001-09-27 18:25:16


----- Original Message -----
From: Eric Ford <eford_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, September 27, 2001 6:11 PM
Subject: [boost] Integers and other numbers [was Re: dlw_int review]

> > Meanwhile, I have added the files: cvt_n.h, numeric_bounds.h and
> > generic_math.h to the "standard_functions" directory you've created.
> > They are there for reference only!
> > Perhaps we can get some others to look at 'cvt_n.h' and
> 'numeric_bounds.h'
> > (hint, hint).
>
> In cvt_n.h: Any reason you use the T(x) syntax for the type
> conversion rather than static_cast<T>(x)?
>
Too late at night?
Just kidding... you're right, a static_cast<> should be used.

> > The file generic_math is not intended to compete with your
> > 'standard_fucntions.hpp' header. I've uploaded only to give a view
> of the
> > *other* functions and stuff I have found useful for generic numeric
> code.
>
> I'm not entirely happy with your Rounder.
Good.
I wrote those files to accomodate my particular needs; but here we're trying
to develop a very general library.
I expect you (and others) to be unhappy with many things there, as long as
we come out with something good.

> Obviously, there are
> several rounding schemes. First, yours appears to be just for
> rounding to integers.
Exactly.

>That's fine, but then a longer name may be in
> order, since a function that rounds to some arbitrary level may
> eventaully be added.
Right. Perhaps: round_to_integer()

>Second, there's truncate non-integral part,
> round towards zero, round towards -INF, round towards even integer,
> round to nearest int (with different ways of treating a half). Does a
> policy based rounder sound like overkill?
>
Depends on how we do it exactly.
I'll be fine with any flexibility that doesn't clutter the interface too
much and -of course- doesn't introduce unnecesary overhead.

I'll think how to add a rounding choice parameter.

Fernando Cacciola
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk