Boost logo

Boost :

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


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.

That would certainly satisfy the LIA-1 requirement

   A method shall be provided for a program to obtain the value of the
   derived constant /rnd_style/ for each floating point data type
   provided.

| If different rounding rules are never mixed for a given fixed-point object,

The mixing of different rounding rules could be handled by providing
conversion functions from one type to another using the appropriate
rounding function.

| it might be a lot cleaner to have one template parameter (which could
| default to a useful rule) that having a huge number of very ugly, basically
| duplicate, functions:
|
| > mul_with_truncate(a,b)
| > mul_with_rhlsd_up(a,b)
| > mul_with_rhlsd_ran(a,b)
| > mul_with_noround(a,b)
|
| and then it later turning out that there was yet another rounding rule
| needed.

100% agreed.

-- Gaby


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