|
Boost : |
From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2001-09-27 13:52:06
----- Original Message -----
From: Beman Dawes <bdawes_at_[hidden]>
To: <boost_at_[hidden]>; <boost_at_[hidden]>
Sent: Thursday, September 27, 2001 12:48 PM
Subject: [boost] Integers and other numbers [was Re: dlw_int review]
> [SNIP]
>
> It would be nice if someone (or several people) with a strong numerics
> background could write a "big picture" roadmap that fits a bunch of
> numerical type together into a coherent plan. The ones in the C++
> standard, the C standard, and Boost as it stands today, but also with
slots
> open for big integers, fixed point types, and other possibilities.
>
> --Beman
>
I am not sure if I interpreted correctly what you have said here, but
AFAICT, the following is necessary to truly support the development of
generic numeric classes and algorithms:
* a numeric_traits<> class providing functionality beyond numeric_limits()
(and including it itself).
I have one, in which I added a numeric_bounds<> class.
numeric_bounds<> gives a consistent semantic to boundary values
(remember that numeric_limits::min has different semantics depending on
whether the type is integer or floating point).
* a numeric_cast<> facility (we have one already, though I tried before to
draw attention to some issues about this one)
* a numeric_comparator<T,U> class allowing type-safe and range-safe logical
operations between mixed numeric types.
Usage of this class can allow code to behave better than simply using
numeric_cast<> to cast operands into a common type.
* a template based functions library (this is already being addressed by
Eric Ford).
* a document with guidelines about how to write generic numeric code that
maximizes the chances to work "as is" for arbitrary number types.
This would include guidelines such as: use the tools above, never use
bare literal numbers, pre-construct repeated values (typically zeros and
ones), etc...
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