Boost logo

Boost :

From: Gabriel Dos Reis (Gabriel.Dos-Reis_at_[hidden])
Date: 2001-05-15 16:16:16


Howard Hinnant <hinnant_at_[hidden]> writes:

| On Tuesday, May 15, 2001, at 03:33 PM, Gabriel Dos Reis wrote:
| > Beman Dawes <bdawes_at_[hidden]> writes:
| >
| > | So a question is do you support that by having a whole bunch of
| > different
| > | functions, or by the class template taking some kind of a parameter
| > | (perhaps a traits or policy class) performing the rounding desired?
| >
| > I'm leaning toward a trait-based solution.
|
| I'm not positive that a trait-based solution is not the way to go, but
| I'm not yet convinced it is yet either. One of the uses for rounding
| mode manipulation is to run a computation with it set two ways to get a
| feel for the roundoff error in the result.

Yes that is -one- kind of uses.

However having distinct types to express distinct constraints has the
advantage that most invariants are verified at translation time. It
also makes it possible to conduct parallel computations. Moveover it
provides an extensible framework.

| ... By making rounding mode a
| compile time decision one is mandating that such users will have twice
| the code size (than if it is a run time parameter).

Actually the same argument applies for most the C++ standard library.

| In general I'm a very big fan of moving as much computation as possible
| to compile time. But part of me is questioning a compile time rounding
| mode. C describes rounding mode in the context of a floating point
| environment (which can be manipulated at run time). That model may be
| worthy of study.

Certainly. However, one should keep in mind that the way C99 did things
are highly conditioned by its lacks of compile time expressiveness.
C99 also does not provide provide an extensible frmaework. I cannot
conceive of C++ solution which doesn't make it possible for the user
to supply its own alternative.

-- Gaby


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